Bug #6628

Default values in F3\FLOW3\Locale\Locale

Added by Arno Dudek over 11 years ago. Updated almost 11 years ago.

Status:
Resolved
Priority:
Should have
Assignee:
Category:
I18n
Target version:
-
Start date:
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

Description

Hi!

If you create an locale object (\F3\FLOW3\Locale\Locale) with only the language, the default values interferes.

For example: If you create locale objects out of the browser env. 'accept-language', the locale settings are like this: de,de-DE;q=0.8,en-EN;q=0.5,en-US; ...

You'll see the first item is only "de". After create a locale you get:
>getLanguage() = 'de'
>getRegion() = 'EN'

Perhaps needed here an locale mapping with defaults to avoid this. I've done this once but i'm not shure if the list is completed. The proprty "script" is missing. I think it good enough for this time ;)

        $this->locale = array(
            'af' => array('encode' => 'UTF-8', 'af_ZA'),
            'am' => array('encode' => 'UTF-8', 'am_ET'),
            'be' => array('encode' => 'UTF-8', 'be_BY'),
            'bg' => array('encode' => 'UTF-8', 'bg_BG'),
            'ca' => array('encode' => 'UTF-8', 'ca_ES'),
            'cz' => array('encode' => 'UTF-8', 'cs_CZ'),
            'da' => array('encode' => 'UTF-8', 'da_DK'),
            'de' => array('encode' => 'UTF-8', 'de_DE', 'de_AT', 'de_CH', 'de_LU'),
            'el' => array('encode' => 'UTF-8', 'el_GR'),
            'en' => array('encode' => 'UTF-8', 'en_GB', 'en_US', 'en_AU', 'en_CA', 'en_IE', 'en_NZ'),
            'es' => array('encode' => 'UTF-8', 'es_ES'),
            'et' => array('encode' => 'UTF-8', 'et_EE'),
            'eu' => array('encode' => 'UTF-8', 'eu_ES'),
            'fi' => array('encode' => 'UTF-8', 'fi_FI'),
            'fr' => array('encode' => 'UTF-8', 'fr_FR', 'fr_CH', 'fr_CA', 'fr_BE'),
            'he' => array('encode' => 'UTF-8', 'he_IL'),
            'hi' => array('encode' => 'UTF-8', 'hi_IN'),
            'hr' => array('encode' => 'UTF-8', 'hr_HR'),
            'hu' => array('encode' => 'UTF-8', 'hu_HU'),
            'hy' => array('encode' => 'UTF-8', 'hy_AM'),
            'is' => array('encode' => 'UTF-8', 'is_IS'),
            'it' => array('encode' => 'UTF-8', 'it_IT', 'it_CH'),
            'ja' => array('encode' => 'UTF-8', 'ja_JP'),
            'kk' => array('encode' => 'UTF-8', 'kk_KZ'),
            'ko' => array('encode' => 'UTF-8', 'ko_KR'),
            'lt' => array('encode' => 'UTF-8', 'lt_LT'),
            'nl' => array('encode' => 'UTF-8', 'nl_NL', 'nl_BE'),
            'no' => array('encode' => 'UTF-8', 'no_NO'),
            'pl' => array('encode' => 'UTF-8', 'pl_PL'),
            'pt' => array('encode' => 'UTF-8', 'pt_PT', 'pt_BR'),
            'ro' => array('encode' => 'UTF-8', 'ro_RO'),
            'ru' => array('encode' => 'UTF-8', 'ru_RU'),
            'sk' => array('encode' => 'UTF-8', 'sk_SK'),
            'sl' => array('encode' => 'UTF-8', 'sl_SI'),
            'sr' => array('encode' => 'UTF-8', 'sr_YU'),
            'sv' => array('encode' => 'UTF-8', 'sv_SE'),
            'tr' => array('encode' => 'UTF-8', 'tr_TR'),
            'uk' => array('encode' => 'UTF-8', 'uk_UA'),
            'zh' => array('encode' => 'UTF-8', 'zh_CN', 'zh_HK', 'zh_TW'),
        );


Related issues

Related to TYPO3.Flow - Task #7719: Implement Locale classResolvedKarol Gusak

Actions
#1

Updated by Karsten Dambekalns over 11 years ago

  • Category set to I18n
#2

Updated by Karsten Dambekalns about 11 years ago

  • Assignee set to Karol Gusak
  • Start date deleted (2010-02-27)
#3

Updated by Karol Gusak about 11 years ago

  • Status changed from New to Resolved

Default values in Locale class were removed in Revision r4308.

As for now, the idea is as follows:
  • Locale objects are light representations of particular locales. They do not validate themselves (so they can represent nonexistent locale)
  • In order to obtain validated (correct) Locale object, specific API should be used (like getDefaultLocale() in \F3\FLOW3\Locale\Service or detectLocaleFromHttpHeader() in \F3\FLOW3\Locale\Detector)
  • More classes will be done to cover all use-cases when validated Locale object is needed. But self-validation of Locale objects would be bad as they are meant to be used very frequently (so I think they should be as light as possible).
#4

Updated by Karol Gusak about 11 years ago

  • % Done changed from 0 to 100

Also available in: Atom PDF