Closed mahotilo closed 6 years ago
Another i18n question.
I want to do something like this in section.php
$section_lang = self::$i18n['section']['lang'];
...
$javascript = 'var $MYCART_LANG = '.json_encode($section_lang).';';
to pass strings into JS plugin. But I get an empty array.
If I load en.php
directly in section.php
all works fine
If I correctly understand, we need to initialize $i18n
a bit earlier?
P.S. And sorry, I give you an enigma but I will be off-line for a couple of days:)
Looks like we always use only strings from $section_lang = array();
They are only different if you are using Multi-Language Manager. If so, the editor will always use Typesetter's config language, while the content section will adopt the language of the current page.
If I correctly understand, we need to initialize $i18n a bit earlier?
Absolutely correct. And fixed
Does it corresponds to $section_lang = array(); $editor_lang = array();
No, there is only $section_lang The differentiation happens only when Multi-Language Manager's page language deviates from Typesetter's admin ui language.
edit/ Maybe needs explanation: The $section_lang array in /i18n/*.php may contain terms/translations for both editor components and page content output. With Multi-Language Manager running, pages may have different languages assigned. This way, for example, we can still have the admin UI running in english but the generated content will obey the page language, e.g. french, ukraininan, you name it --> So you will see the editor in english but the rendered page in french.
Thanks, all works. And I agree with yours vision of i18n. Word "section" simply misguided me.
We have
Does it corresponds to
in
en.php
?Looks like we always use only strings from
$section_lang = array();