[TYPO3-english] Formhandler localization problem. Typo3 6.1.5

Reinhard Führicht fuehricht at gmx.at
Tue Nov 26 11:42:52 CET 2013


It seems my last message got lost, so here it is again:

Hi Andrei,

I did a little research:

***************************
* Problem:
***************************

I found out that TYPO3 can only translate messages in language files 
using a "known" language.

Currently, these languages are set in 
typo/sysext/core/Classes/Localization/Locales.php:

'default' => 'English',
'af' => 'Afrikaans',
'ar' => 'Arabic',
'bs' => 'Bosnian',
'bg' => 'Bulgarian',
'ca' => 'Catalan',
'ch' => 'Chinese (Simpl.)',
'cs' => 'Czech',
'da' => 'Danish',
'de' => 'German',
'el' => 'Greek',
'eo' => 'Esperanto',
'es' => 'Spanish',
'et' => 'Estonian',
'eu' => 'Basque',
'fa' => 'Persian',
'fi' => 'Finnish',
'fo' => 'Faroese',
'fr' => 'French',
'fr_CA' => 'French (Canada)',
'gl' => 'Galician',
'he' => 'Hebrew',
'hi' => 'Hindi',
'hr' => 'Croatian',
'hu' => 'Hungarian',
'is' => 'Icelandic',
'it' => 'Italian',
'ja' => 'Japanese',
'ka' => 'Georgian',
'kl' => 'Greenlandic',
'km' => 'Khmer',
'ko' => 'Korean',
'lt' => 'Lithuanian',
'lv' => 'Latvian',
'ms' => 'Malay',
'nl' => 'Dutch',
'no' => 'Norwegian',
'pl' => 'Polish',
'pt' => 'Portuguese',
'pt_BR' => 'Brazilian Portuguese',
'ro' => 'Romanian',
'ru' => 'Russian',
'sk' => 'Slovak',
'sl' => 'Slovenian',
'sq' => 'Albanian',
'sr' => 'Serbian',
'sv' => 'Swedish',
'th' => 'Thai',
'tr' => 'Turkish',
'uk' => 'Ukrainian',
'vi' => 'Vietnamese',
'zh' => 'Chinese (Trad.)'


As you can see, there is no 'id' => 'Indonesian'.

***************************
* How to fix it:
***************************

Fortunately, you can set additional languages in ext_localconf.php in a 
custom extension (or in AdditionalConfiguration.php):

$TYPO3_CONF_VARS['SYS']['localization']['locales']['user']['id'] = 
'Indonesian';

Unfortunately, this setting is not taken into account because of a bug 
in 
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php:

This block:

$locales = 
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Locales');

// Language is found. Configure it:
if (in_array($this->lang, $locales->getLocales())) {
         $this->languageDependencies[] = $this->lang;
         foreach ($locales->getLocaleDependencies($this->lang) as 
$language) {
                 $this->languageDependencies[] = $language;
         }
}

Should look like this:

$locales = 
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Locales');
$locales->initialize();

// Language is found. Configure it:
if (in_array($this->lang, $locales->getLocales())) {
         $this->languageDependencies[] = $this->lang;
         foreach ($locales->getLocaleDependencies($this->lang) as 
$language) {
                 $this->languageDependencies[] = $language;
         }
}

As you can see, the line $locales->initialize(); was missing.

***************************
* Conclusion:
***************************

I will have a look, if this bug still exists in the GIT repository and 
request a fix then.

So, this has nothing to do with Formhandler, but with the translation 
handling of TYPO3.

Regards,
Reinhard

Am 26.11.2013 09:03, schrieb Andrei Shishkin:
> Hello.
> Have 3 languages, setup:
>
> config {
>    linkVars = L
>    sys_language_uid = 0
>    uniqueLinkVars = 1
>    language = en
>    locale_all = en_EN
>    sys_language_overlay = 1
>    sys_language_mode = ignore
>    htmlTag_langKey = en-EN
> }
> [globalVar = GP:L=1]
> config {
>    sys_language_uid = 1
>    language = id
>    locale_all = id_ID
>    htmlTag_langKey = id-ID
> }
> [global]
> [globalVar = GP:L=2]
> config {
>    sys_language_uid = 2
>    language = ru
>    locale_all = ru_RU
>    htmlTag_langKey = ru-RU
> }
> [global]
>
> Menus and content translating works good. Trying to use formhandler
> extention for organise contact form. Installing it like said in
> www.typo3-formhandler.com/documentation/articles-howtos/b/how-to-set-up-a-simple-form/
> using xml langFile, with this sructure:
>
> <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
> <T3locallang>
> <meta type="array">
>   <description>Language labels for my form</description>
> </meta>
> <data type="array">
>   <languageKey index="default" type="array">
>     <label index="error_message_required">English</label>
>   </languageKey>
>   <languageKey index="id" type="array">
>     <label index="error_message_required">Indonasian</label>
>   </languageKey>
>   <languageKey index="ru" type="array">
>     <label index="error_message_required">Russian</label>  </languageKey>
> </data>
> </T3locallang>
>
> As result -  default english version works, russian version - works.
> Indonesian - NO. It just do not whant to take translation from
> <languageKey index="id" type="array"> section. In the same time all site
> showing indonesian version of the site, but formhandler showing default
> version of lang, english. What can do to solve this problem?
> Thanks for looking.


-- 
--------------------------------
http://www.typo3-formhandler.com
--------------------------------


More information about the TYPO3-english mailing list