Project

General

Profile

Actions

Bug #46688

closed

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

Added by David Gurk over 11 years ago. Updated about 6 years ago.

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

100%

Estimated time:
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 2 (0 open2 closed)

Related to TYPO3 Core - Bug #44099: L10n fallback does not work for TS labelsClosedXavier Perseguers2012-12-18

Actions
Related to TYPO3 Core - Bug #46748: Custom languages won't be displayed in the frontendClosed2013-03-28

Actions
Actions #1

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.)').

Actions #2

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?

Actions #3

Updated by David Gurk over 11 years ago

  • % Done changed from 0 to 50
Actions #4

Updated by David Gurk over 11 years ago

  • Assignee set to Xavier Perseguers
Actions #5

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)

Actions #6

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.

Actions #7

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?

Actions #8

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".

Actions #9

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?

Actions #10

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.

Actions #11

Updated by Xavier Perseguers over 11 years ago

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

Solved by the author :)

Actions #12

Updated by Ernesto Baschny over 11 years ago

  • Target version deleted (2194)
Actions #13

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF