how to : use a specific translation in codeblock

vincent3569 Member, Translator
edited December 2018 in General support

in the codeblock 2 of a page, I have this code
<?php echo gettext_th('Demo site'); ?>

this blockcode is called by a macro [CODEBLOCK 2] in the page ExtraContent.

I add this specific translation in a extra file of my theme, and so, the string is translated in my po and mo files.

but it doesn't work and my string remains in english as my locale is french.
what's is the matter?


  • acrylian Administrator, Developer

    Technically the codeblock is not within the theme as it is a core funciton. I have never tried this use case. Perhaps the theme based translation is not yet loaded when the codeblock is executed. It should use the current theme but try to set it specifially as the 2nd parameter.

  • vincent3569 Member, Translator

    hi, in fact it works well.
    my mistake was about having multiple website and forgot one update.

    next step for me : having a plugin for specific translations to avoid have it in my theme translations.

  • acrylian Administrator, Developer

    Thanks for the feedback. Know the problem with several sites ;) Sure, you should be able to create a simple basically functionless plugin which just consists of strings to translate. However if these strings are still site/theme related they should be in the theme IMHO.

Sign In or Register to comment.