Bug #46688

Bugfix for "L10n fallback" (#44099) does not work for local languages like "at" (Austria)

Added by David Gurk about 6 years ago. Updated 9 months ago.

Status:
Closed
Priority:
Must have
Category:
-
Target version:
-
Start date:
2013-03-26
Due date:
% Done:

100%

TYPO3 Version:
4.6
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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?


Related issues

Related to TYPO3 Core - Bug #44099: L10n fallback does not work for TS labels Closed 2012-12-18
Related to TYPO3 Core - Bug #46748: Custom languages won't be displayed in the frontend Closed 2013-03-28

History

#1 Updated by David Gurk about 6 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.)').

#2 Updated by David Gurk about 6 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?

#3 Updated by David Gurk about 6 years ago

  • % Done changed from 0 to 50

#4 Updated by David Gurk about 6 years ago

  • Assignee set to Xavier Perseguers

#5 Updated by Xavier Perseguers about 6 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)

#6 Updated by David Gurk about 6 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.

#7 Updated by David Gurk about 6 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?

#8 Updated by David Gurk about 6 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".

#9 Updated by David Gurk about 6 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?

#10 Updated by David Gurk about 6 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.

#11 Updated by Xavier Perseguers about 6 years ago

  • Status changed from New to Resolved
  • % Done changed from 50 to 100

Solved by the author :)

#12 Updated by Ernesto Baschny about 6 years ago

  • Target version deleted (2194)

#13 Updated by Benni Mack 9 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF