Need of two separate Language Keys for the Comment Block

Hi @Alex T⚜️

Following your orientations found ‍here https://una.io/page/view-discussion?id=9046 , ‍I have managed to unable the Comment block and get the Comment Button (action) to work on the Ads App. Thanks.

Now I have came up with another small issue. I have been trying to edit the Comment block in the Ads App and change it from 'Comments ({0})' to ''Comments, Questions & Answers  ({0})' because this block will be used to ask a question about the item (product or service) being sold which is different from the Review block.

You can review and rate a product only once while you can comment or ask a question or interact with the seller as many time as you want.

Many Marketplace or Classidieds Websites use this title 'Comments, Questions & Answers' or 'Customer Questions & Answers' (like on Amazon) for their Comment block to clearly distinguish it from the Review block.

The problem is the language key: '_cmt_block_comments_title' is use globably. Whenever I edit it, it changes the comment block title of all the Apps: Albums, Photos, Videos etc.

It makes absolutely no sense.to have the comment block of the Photos or Videos Apps titled: 'Comments, Questions & Answers' or 'Customer Questions & Answers'.

Please consider creating / separating the comment block title language key of the Ads App from the one used in the remaining apps. @Anton L

Example:

_cmt_block_comments_title

and

_cmt_block_ad_comments_title

Many Thanks.

  • 405
  • More
Replies (11)
    • Hello @OneEagle !

      If you use 1 language in your UNA then you may apply this easiest solution. Create the RAW block on the View Ad page before the comments block and add there the following code:

      <script>

       $("div.bx-db-title").first().html(_t('Your new caption'));

      </script>

      If you have not only one language then you need to create the lang block and place the mentioned code in each language text box. Vary only the Your new caption part.

      • Hi @LeonidS

        Thanks for your reply and for the solution which worked. You always impressed me with your programming skills!

        Now I have some concerns:

        1) I have a multilingual site (3 languages). Instead of adding many lang blocks, can I use the code above in a Raw block and use a language key instead?

        example: _cmt_block_comments_title_2 (previously created in the Polyglot app)

        which will have the following text:

        Comments, Questions & Answers ({0})

        I have tried:

        <script>

         $("div.bx-db-title").first().html(_t('_cmt_block_comments_title_2'));

        </script>

        but it doesn't work.

        2) Using the example you gave and the 'Raw block', the Comment block title changes to 'Your new caption' which is fine but it creates an additional empty/blank block just below the comment block with the block title: 'Raw'. How to get rid of this additional and empty block?

        Thanks

        • 1) Lang block is the more proper way.

          2) In the settings of the block you need to leave only "Content" without any Title, Padding etc.

          • It works! The additional block has disappeared. Thanks a lot for helping.

            Now using the Lang block, I added the following text:

            Comments, Questions & Answers ({0})

            The ({0}) should call and display the counter with the number of comments like when used in the language key. Unfortunately. it doesn't work. How the get the Comment counter displayed? Thanks

            • THe JS code should look like:

              _t('_lang_key', 'argument to be pasted');

              • Thanks. As you suggested, I've tried the following code but it doesn't work:

                <script>

                $("div.bx-db-title").first().html(_t('our new caption', '{0}'));

                </script>

                Any idea?

                • our new caption' is the key with {0} replaceable part. So in my code, you should have the real word(s) to pass instead of {0}

                  • So using your code, how to display the comment counter?

                    Example:

                    Comments (19)

                    Normally, before applying your code, the comment block title looks like this:

                    Comments ({0})

                    It is taken from this language key: _cmt_block_comments_title

                      • The call of this lang key will look like

                        _t('_cmt_block_comments_title', 19);

                        • Dear @LeonidS .Thanks for reply but it seems that maybe you don't understand me. The '19' is not a static number.but a dynamic one. It is the comment counter that shows the number of comments in the comment block title. As the comments are being added, this number will be increasing automatically: 20, 21, 22, 23 etc.

                          Without your code change (in the default UNA comment block title), {0} is used in the language key _cmt_block_comments_title to display the comment counter, {0} being the argument to be pasted.

                          So my question is how to also get the dynamic comment counter to display in the code you provided above?

                          Hope that makes sense now. Thanks

                          Login or Join to comment.