Bug #46688
closedBugfix for "L10n fallback" (#44099) does not work for local languages like "at" (Austria)
100%
Description
exmple TypoScript:
# German config { sys_language_uid = 0 language = de locale_all = de_DE } # German for austria [globalVar=GP:L=1] config { sys_language_uid = 1 language = at locale_all = de_AT } [global] # German for swiss [globalVar=GP:L=2] config { sys_language_uid = 2 language = ch locale_all = de_CH } [global] # Polish [globalVar=GP:L=3] config { sys_language_uid = 3 language = pl locale_all = pl_PL } [global] # Czech [globalVar=GP:L=4] config { sys_language_uid = 4 language = cz locale_all = cs_CZ } [global]
example locallang.xml:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <T3locallang> <meta type="array"> <description>Example</description> </meta> <data type="array"> <languageKey index="default" type="array"> <label index="example">German</label> </languageKey> <languageKey index="at" type="array"> <label index="example">German for austria</label> </languageKey> <languageKey index="ch" type="array"> <label index="example">German for swiss</label> </languageKey> <languageKey index="pl" type="array"> <label index="example">Polish</label> </languageKey> <languageKey index="cz" type="array"> <label index="example">Czech</label> </languageKey> </data> </T3locallang>
The updated function "readLLfile" in the class "tslib_fe" won't work in this case since TYPO3 v4.6.16 (see the related issue). In the frontend the default language appears for AT and CZ. Normally AT and CZ should be shown from the locallang file. The other languages (default/DE, PL, CZ) works well.
The old version of this function works well (TYPO3 through v4.6.15):
function readLLfile($fileRef) { return t3lib_div::readLLfile($fileRef, $this->lang, $this->renderCharset); }
Is it necessary to change all my language handling or is there another solution?
Updated by David Gurk over 11 years ago
The only reason why the language CH (swiss) works, is because in the class "t3lib_l10n_Locales" the string "ch" stands for chinese ('ch' => 'Chinese (Simpl.)').
Updated by David Gurk over 11 years ago
- Target version set to 2194
In my opinion this should be added to the class t3lib_l10n_Locales:
protected $languages = array( ... 'de_AT' => 'German (Austria)', 'de_CH' => 'German (Swiss)', ... );
What do you mean?
Updated by Xavier Perseguers over 11 years ago
Did you check this: http://xavier.perseguers.ch/tutoriels/typo3/articles/managing-localization-files.html#c954 ?
(sorry don't know where the info has been integrated in official documentation)
Updated by David Gurk over 11 years ago
Thanks for your reply.
I found the official documentation here: http://docs.typo3.org/typo3cms/CoreApiReference/Internationalization/Translation/Index.html#xliff-translating-languages
But it seems it won't work in the frontend.
In typo3conf/extTables.php I added the following lines:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['localization']['locales']['user'] = array( 'de_AT' => 'German (Austria)', 'de_CH' => 'German (Swiss)', ); $GLOBALS['TYPO3_CONF_VARS']['SYS']['localization']['locales']['dependencies'] = array( 'de_AT' => array('de'), 'de_CH' => array('de'), );
This is the shortened version from the TypoScript setup:
# German config { sys_language_uid = 0 language = de locale_all = de_DE } # German for austria [globalVar=GP:L=1] config { sys_language_uid = 1 language = de_AT locale_all = de_AT } [global] # German for swiss [globalVar=GP:L=2] config { sys_language_uid = 2 language = de_CH locale_all = de_CH } [global] # Polish [globalVar=GP:L=3] config { sys_language_uid = 3 language = pl locale_all = pl_PL } [global] # Czech [globalVar=GP:L=4] config { sys_language_uid = 4 language = cs locale_all = cs_CZ } [global]
And this is a sample locallang.xml:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <T3locallang> <meta type="array"> <description>Example</description> </meta> <data type="array"> <languageKey index="default" type="array"> <label index="example">German</label> </languageKey> <languageKey index="de_AT" type="array"> <label index="example">German for austria</label> </languageKey> <languageKey index="de_CH" type="array"> <label index="example">German for swiss</label> </languageKey> <languageKey index="pl" type="array"> <label index="example">Polish</label> </languageKey> <languageKey index="cs" type="array"> <label index="example">Czech</label> </languageKey> </data> </T3locallang>
The result is the same, de_AT won't work in the frontend. Instead the default text ist shown. I'm clueless.
Updated by David Gurk over 11 years ago
Hi,
If I understand aright the languages from "$GLOBALS['TYPO3_CONF_VARS']['SYS']['localization']['locales']['user']" should be added in the class "typo3_src-4.6.18/t3lib/l10n/class.t3lib_l10n_locales.php" in line 158.
But if I do a "var_dump($locales->getLocales());" in the class "typo3_src-4.6.18/typo3/sysext/cms/tslib/class.tslib_fe.php" in line 4751 in the function "initLLvars", the new languages won't added to the array. And this is why the new languages don't appears in the frontend.
Do you have any idear?
Updated by David Gurk over 11 years ago
It seems that the function "initialize()" won't execute in class "typo3_src-4.6.18/t3lib/l10n/class.t3lib_l10n_locales.php".
Updated by David Gurk over 11 years ago
Hi,
I have uploaded an t3d-file for a blank TYPO3 v4.6.18:
http://www.file-upload.net/download-7446538/t3d-bug-tracing.zip.html
This is related to the comment #note-6 (http://forge.typo3.org/issues/46688#note-6).
The t3d includes simplified TypoScript-Templates and configurations. I also added the locallang.xml example.
The following would be displayed:
# For: /index.php?L=0 HELLO WORLD! TEST:German # For: /index.php?L=1 HELLO WORLD! TEST:German # For: /index.php?L=2 HELLO WORLD! TEST:German # For: /index.php?L=3 HELLO WORLD! TEST:Polish
So it wouldn't work.
Could someone else try this setup, please?
Updated by David Gurk over 11 years ago
Okay, it's a bit odd.
I moved the code for "$GLOBALS['TYPO3_CONF_VARS']['SYS']['localization']['locales']['user'] ..." from "typo3conf/extTables.php" to "typo3conf/localconf.php".
tadaaa It works. -_-°
The really odd thing is, that I have the following line in my localconf.php:
$typo_db_extTableDef_script = 'extTables.php';
So I think this "issue" can be closed.
Updated by Xavier Perseguers over 11 years ago
- Status changed from New to Resolved
- % Done changed from 50 to 100
Solved by the author :)