I managed to successfully enable internationalization and the tag {% trans%} in the branch using the following lines:
$language = "..."; $domain = "project"; putenv("LC_MESSAGES=$language"); setlocale(LC_MESSAGES, $language); bindtextdomain($domain, SITE_DIR . "locale"); textdomain($domain); bind_textdomain_codeset($domain, "UTF-8");
And the branch template:
... {% trans "Translation.Key" %} ...
Unfortunately, this works randomly. I mean, by continuing to press F5, say, every second or moving between pages, sometimes it switches to the translated line, as it should ("Translation.Key" becomes "Localized value for output"), and sometimes it returns to the output of the string in the tag {% trans%} ("Translation.Key").
Meanwhile, I see no errors in my magazines. What should I check to understand the source of the problem and make it work consistently?
Thanks in advance.
source share