Version Notes
First stable release
Download this release
Release Info
Developer | Magento Core Team |
Extension | Lib_ZF_Locale |
Version | 1.0.18800 |
Comparing to | |
See all releases |
Version 1.0.18800
- lib/Zend/Locale.php +837 -0
- lib/Zend/Locale/Data.php +1169 -0
- lib/Zend/Locale/Data/Translation.php +93 -0
- lib/Zend/Locale/Data/aa.xml +261 -0
- lib/Zend/Locale/Data/aa_DJ.xml +36 -0
- lib/Zend/Locale/Data/aa_ER.xml +21 -0
- lib/Zend/Locale/Data/aa_ER_SAAHO.xml +40 -0
- lib/Zend/Locale/Data/aa_ET.xml +11 -0
- lib/Zend/Locale/Data/af.xml +732 -0
- lib/Zend/Locale/Data/af_NA.xml +76 -0
- lib/Zend/Locale/Data/af_ZA.xml +11 -0
- lib/Zend/Locale/Data/ak.xml +195 -0
- lib/Zend/Locale/Data/ak_GH.xml +11 -0
- lib/Zend/Locale/Data/am.xml +1344 -0
- lib/Zend/Locale/Data/am_ET.xml +11 -0
- lib/Zend/Locale/Data/ar.xml +2944 -0
- lib/Zend/Locale/Data/ar_AE.xml +16 -0
- lib/Zend/Locale/Data/ar_BH.xml +16 -0
- lib/Zend/Locale/Data/ar_DZ.xml +21 -0
- lib/Zend/Locale/Data/ar_EG.xml +11 -0
- lib/Zend/Locale/Data/ar_IQ.xml +16 -0
- lib/Zend/Locale/Data/ar_JO.xml +67 -0
- lib/Zend/Locale/Data/ar_KW.xml +16 -0
- lib/Zend/Locale/Data/ar_LB.xml +72 -0
- lib/Zend/Locale/Data/ar_LY.xml +16 -0
- lib/Zend/Locale/Data/ar_MA.xml +21 -0
- lib/Zend/Locale/Data/ar_OM.xml +16 -0
- lib/Zend/Locale/Data/ar_QA.xml +51 -0
- lib/Zend/Locale/Data/ar_SA.xml +51 -0
- lib/Zend/Locale/Data/ar_SD.xml +16 -0
- lib/Zend/Locale/Data/ar_SY.xml +83 -0
- lib/Zend/Locale/Data/ar_TN.xml +55 -0
- lib/Zend/Locale/Data/ar_YE.xml +51 -0
- lib/Zend/Locale/Data/as.xml +237 -0
- lib/Zend/Locale/Data/as_IN.xml +11 -0
- lib/Zend/Locale/Data/az.xml +329 -0
- lib/Zend/Locale/Data/az_AZ.xml +11 -0
- lib/Zend/Locale/Data/az_Cyrl.xml +86 -0
- lib/Zend/Locale/Data/az_Cyrl_AZ.xml +12 -0
- lib/Zend/Locale/Data/az_Latn.xml +11 -0
- lib/Zend/Locale/Data/az_Latn_AZ.xml +12 -0
- lib/Zend/Locale/Data/be.xml +909 -0
- lib/Zend/Locale/Data/be_BY.xml +11 -0
- lib/Zend/Locale/Data/bg.xml +2987 -0
- lib/Zend/Locale/Data/bg_BG.xml +11 -0
- lib/Zend/Locale/Data/bn.xml +766 -0
- lib/Zend/Locale/Data/bn_BD.xml +11 -0
- lib/Zend/Locale/Data/bn_IN.xml +178 -0
- lib/Zend/Locale/Data/bo.xml +506 -0
- lib/Zend/Locale/Data/bo_CN.xml +10 -0
- lib/Zend/Locale/Data/bo_IN.xml +11 -0
- lib/Zend/Locale/Data/bs.xml +338 -0
- lib/Zend/Locale/Data/bs_BA.xml +11 -0
- lib/Zend/Locale/Data/byn.xml +509 -0
- lib/Zend/Locale/Data/byn_ER.xml +11 -0
- lib/Zend/Locale/Data/ca.xml +1012 -0
- lib/Zend/Locale/Data/ca_ES.xml +11 -0
- lib/Zend/Locale/Data/cch.xml +195 -0
- lib/Zend/Locale/Data/cch_NG.xml +11 -0
- lib/Zend/Locale/Data/cop.xml +203 -0
- lib/Zend/Locale/Data/cop_Arab.xml +23 -0
- lib/Zend/Locale/Data/cop_Arab_EG.xml +12 -0
- lib/Zend/Locale/Data/cop_Arab_US.xml +12 -0
- lib/Zend/Locale/Data/cop_EG.xml +11 -0
- lib/Zend/Locale/Data/cop_US.xml +11 -0
- lib/Zend/Locale/Data/cs.xml +2098 -0
- lib/Zend/Locale/Data/cs_CZ.xml +11 -0
- lib/Zend/Locale/Data/cy.xml +635 -0
- lib/Zend/Locale/Data/cy_GB.xml +11 -0
- lib/Zend/Locale/Data/da.xml +2313 -0
- lib/Zend/Locale/Data/da_DK.xml +11 -0
- lib/Zend/Locale/Data/de.xml +2370 -0
- lib/Zend/Locale/Data/de_AT.xml +48 -0
- lib/Zend/Locale/Data/de_BE.xml +73 -0
- lib/Zend/Locale/Data/de_CH.xml +55 -0
- lib/Zend/Locale/Data/de_DE.xml +11 -0
- lib/Zend/Locale/Data/de_LI.xml +24 -0
- lib/Zend/Locale/Data/de_LU.xml +20 -0
- lib/Zend/Locale/Data/dv.xml +228 -0
- lib/Zend/Locale/Data/dv_MV.xml +11 -0
- lib/Zend/Locale/Data/dz.xml +420 -0
- lib/Zend/Locale/Data/dz_BT.xml +11 -0
- lib/Zend/Locale/Data/ee.xml +199 -0
- lib/Zend/Locale/Data/ee_GH.xml +11 -0
- lib/Zend/Locale/Data/ee_TG.xml +11 -0
- lib/Zend/Locale/Data/el.xml +758 -0
lib/Zend/Locale.php
ADDED
@@ -0,0 +1,837 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Zend Framework
|
4 |
+
*
|
5 |
+
* LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the new BSD license that is bundled
|
8 |
+
* with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://framework.zend.com/license/new-bsd
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@zend.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Zend
|
16 |
+
* @package Zend_Locale
|
17 |
+
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
18 |
+
* @version $Id: Locale.php 8855 2008-03-16 11:15:58Z thomas $
|
19 |
+
* @license http://framework.zend.com/license/new-bsd New BSD License
|
20 |
+
*/
|
21 |
+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @category Zend
|
25 |
+
* @package Zend_Locale
|
26 |
+
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
27 |
+
* @license http://framework.zend.com/license/new-bsd New BSD License
|
28 |
+
*/
|
29 |
+
class Zend_Locale {
|
30 |
+
|
31 |
+
// Class wide Locale Constants
|
32 |
+
private static $_localeData = array(
|
33 |
+
'root' => true, 'aa_DJ' => true, 'aa_ER' => true, 'aa_ET' => true, 'aa' => true, 'af_NA' => true, 'af_ZA' => true, 'af' => true, 'ak_GH' => true, 'ak' => true,
|
34 |
+
'am_ET' => true, 'am' => true, 'ar_AE' => true, 'ar_BH' => true, 'ar_DZ' => true, 'ar_EG' => true, 'ar_IQ' => true, 'ar_JO' => true, 'ar_KW' => true, 'ar_LB' => true,
|
35 |
+
'ar_LY' => true, 'ar_MA' => true, 'ar_OM' => true, 'ar_QA' => true, 'ar_SA' => true, 'ar_SD' => true, 'ar_SY' => true, 'ar_TN' => true, 'ar_YE' => true, 'ar' => true,
|
36 |
+
'as_IN' => true, 'as' => true, 'az_AZ' => true, 'az' => true, 'be_BY' => true, 'be' => true, 'bg_BG' => true, 'bg' => true, 'bn_BD' => true, 'bn_IN' => true,
|
37 |
+
'bn' => true, 'bo_CN' => true, 'bo_IN' => true, 'bo' => true, 'bs_BA' => true, 'bs' => true, 'byn_ER'=> true, 'byn' => true, 'ca_ES' => true, 'ca' => true,
|
38 |
+
'cch_NG'=> true, 'cch' => true, 'cop_EG'=> true, 'cop_US'=> true, 'cop' => true, 'cs_CZ' => true, 'cs' => true, 'cy_GB' => true, 'cy' => true, 'da_DK' => true,
|
39 |
+
'da' => true, 'de_AT' => true, 'de_BE' => true, 'de_CH' => true, 'de_DE' => true, 'de_LI' => true, 'de_LU' => true, 'de' => true, 'dv_MV' => true, 'dv' => true,
|
40 |
+
'dz_BT' => true, 'dz' => true, 'ee_GH' => true, 'ee_TG' => true, 'ee' => true, 'el_CY' => true, 'el_GR' => true, 'el' => true, 'en_AS' => true, 'en_AU' => true,
|
41 |
+
'en_BE' => true, 'en_BW' => true, 'en_BZ' => true, 'en_CA' => true, 'en_GB' => true, 'en_GU' => true, 'en_HK' => true, 'en_IE' => true, 'en_IN' => true, 'en_JM' => true,
|
42 |
+
'en_MH' => true, 'en_MP' => true, 'en_MT' => true, 'en_NZ' => true, 'en_PH' => true, 'en_PK' => true, 'en_SG' => true, 'en_TT' => true, 'en_UM' => true, 'en_US' => true,
|
43 |
+
'en_VI' => true, 'en_ZA' => true, 'en_ZW' => true, 'en' => true, 'eo' => true, 'es_AR' => true, 'es_BO' => true, 'es_CL' => true, 'es_CO' => true, 'es_CR' => true,
|
44 |
+
'es_DO' => true, 'es_EC' => true, 'es_ES' => true, 'es_GT' => true, 'es_HN' => true, 'es_MX' => true, 'es_NI' => true, 'es_PA' => true, 'es_PE' => true, 'es_PR' => true,
|
45 |
+
'es_PY' => true, 'es_SV' => true, 'es_US' => true, 'es_UY' => true, 'es_VE' => true, 'es' => true, 'et_EE' => true, 'et' => true, 'eu_ES' => true, 'eu' => true,
|
46 |
+
'fa_AF' => true, 'fa_IR' => true, 'fa' => true, 'fi_FI' => true, 'fi' => true, 'fil' => true, 'fo_FO' => true, 'fo' => true, 'fr_BE' => true, 'fr_CA' => true,
|
47 |
+
'fr_CH' => true, 'fr_FR' => true, 'fr_LU' => true, 'fr_MC' => true, 'fr' => true, 'fur_IT'=> true, 'fur' => true, 'ga_IE' => true, 'ga' => true, 'gaa_GH'=> true,
|
48 |
+
'gaa' => true, 'gez_ER'=> true, 'gez_ET'=> true, 'gez' => true, 'gl_ES' => true, 'gl' => true, 'gu_IN' => true, 'gu' => true, 'gv_GB' => true, 'gv' => true,
|
49 |
+
'ha_GH' => true, 'ha_NE' => true, 'ha_NG' => true, 'ha' => true, 'haw_US'=> true, 'haw' => true, 'he_IL' => true, 'he' => true, 'hi_IN' => true, 'hi' => true,
|
50 |
+
'hr_HR' => true, 'hr' => true, 'hu_HU' => true, 'hu' => true, 'hy_AM' => true, 'hy' => true, 'ia' => true, 'id_ID' => true, 'id' => true, 'ig_NG' => true,
|
51 |
+
'ig' => true, 'ii_CN' => true, 'ii' => true, 'is_IS' => true, 'is' => true, 'it_CH' => true, 'it_IT' => true, 'it' => true, 'iu' => true, 'ja_JP' => true,
|
52 |
+
'ja' => true, 'ka_GE' => true, 'ka' => true, 'kaj_NG'=> true, 'kaj' => true, 'kam_KE'=> true, 'kam' => true, 'kcg_NG'=> true, 'kcg' => true, 'kfo_NG'=> true,
|
53 |
+
'kfo' => true, 'kk_KZ' => true, 'kk' => true, 'kl_GL' => true, 'kl' => true, 'km_KH' => true, 'km' => true, 'kn_IN' => true, 'kn' => true, 'ko_KR' => true,
|
54 |
+
'ko' => true, 'kok_IN'=> true, 'kok' => true, 'kpe_GN'=> true, 'kpe_LR'=> true, 'kpe' => true, 'ku_IQ' => true, 'ku_IR' => true, 'ku_SY' => true, 'ku_TR' => true,
|
55 |
+
'ku' => true, 'kw_GB' => true, 'kw' => true, 'ky_KG' => true, 'ky' => true, 'ln_CD' => true, 'ln_CG' => true, 'ln' => true, 'lo_LA' => true, 'lo' => true,
|
56 |
+
'lt_LT' => true, 'lt' => true, 'lv_LV' => true, 'lv' => true, 'mk_MK' => true, 'mk' => true, 'ml_IN' => true, 'ml' => true, 'mn_MN' => true, 'mn' => true,
|
57 |
+
'mr_IN' => true, 'mr' => true, 'ms_BN' => true, 'ms_MY' => true, 'ms' => true, 'mt_MT' => true, 'mt' => true, 'my_MM' => true, 'my' => true, 'nb_NO' => true,
|
58 |
+
'nb' => true, 'ne_NP' => true, 'ne' => true, 'nl_BE' => true, 'nl_NL' => true, 'nl' => true, 'nn_NO' => true, 'nn' => true, 'nr_ZA' => true, 'nr' => true,
|
59 |
+
'nso_ZA'=> true, 'nso' => true, 'ny_MW' => true, 'ny' => true, 'om_ET' => true, 'om_KE' => true, 'om' => true, 'or_IN' => true, 'or' => true, 'pa_IN' => true,
|
60 |
+
'pa_PK' => true, 'pa' => true, 'pl_PL' => true, 'pl' => true, 'ps_AF' => true, 'ps' => true, 'pt_BR' => true, 'pt_PT' => true, 'pt' => true, 'ro_RO' => true,
|
61 |
+
'ro' => true, 'ru_RU' => true, 'ru_UA' => true, 'ru' => true, 'rw_RW' => true, 'rw' => true, 'sa_IN' => true, 'sa' => true, 'se_FI' => true, 'se_NO' => true,
|
62 |
+
'se' => true, 'sh_BA' => true, 'sh_CS' => true, 'sh_YU' => true, 'sh' => true, 'sid_ET'=> true, 'sid' => true, 'sk_SK' => true, 'sk' => true, 'sl_SI' => true,
|
63 |
+
'sl' => true, 'so_DJ' => true, 'so_ET' => true, 'so_KE' => true, 'so_SO' => true, 'so' => true, 'sq_AL' => true, 'sq' => true, 'sr_BA' => true, 'sr_CS' => true,
|
64 |
+
'sr_ME' => true, 'sr_RS' => true, 'sr_YU' => true, 'sr' => true, 'ss_ZA' => true, 'ss' => true, 'ssy' => true, 'st_ZA' => true, 'st' => true, 'sv_FI' => true,
|
65 |
+
'sv_SE' => true, 'sv' => true, 'sw_KE' => true, 'sw_TZ' => true, 'sw' => true, 'syr_SY'=> true, 'syr' => true, 'ta_IN' => true, 'ta' => true, 'te_IN' => true,
|
66 |
+
'te' => true, 'tg_TJ' => true, 'tg' => true, 'th_TH' => true, 'th' => true, 'ti_ER' => true, 'ti_ET' => true, 'ti' => true, 'tig_ER'=> true, 'tig' => true,
|
67 |
+
'tn_ZA' => true, 'tn' => true, 'to_TO' => true, 'to' => true, 'tr_TR' => true, 'tr' => true, 'ts_ZA' => true, 'ts' => true, 'tt_RU' => true, 'tt' => true,
|
68 |
+
'ug' => true, 'uk_UA' => true, 'uk' => true, 'und_ZZ'=> true, 'und' => true, 'ur_IN' => true, 'ur_PK' => true, 'ur' => true, 'uz_AF' => true, 'uz_UZ' => true,
|
69 |
+
'uz' => true, 've_ZA' => true, 've' => true, 'vi_VN' => true, 'vi' => true, 'wal_ET'=> true, 'wal' => true, 'wo_SN' => true, 'wo' => true, 'xh_ZA' => true,
|
70 |
+
'xh' => true, 'yo_NG' => true, 'yo' => true, 'zh_CN' => true, 'zh_HK' => true, 'zh_MO' => true, 'zh_SG' => true, 'zh_TW' => true, 'zh' => true, 'zu_ZA' => true,
|
71 |
+
'zu' => true,
|
72 |
+
'auto' => false, 'browser' => false, 'environment' => false
|
73 |
+
);
|
74 |
+
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Autosearch constants
|
78 |
+
*/
|
79 |
+
const BROWSER = 1;
|
80 |
+
const ENVIRONMENT = 2;
|
81 |
+
const FRAMEWORK = 3;
|
82 |
+
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Actual set locale
|
86 |
+
*/
|
87 |
+
private $_Locale;
|
88 |
+
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Actual set Codeset
|
92 |
+
*/
|
93 |
+
private $_Codeset;
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Automatic detected locale
|
97 |
+
*/
|
98 |
+
private static $_auto;
|
99 |
+
private static $_browser;
|
100 |
+
private static $_environment;
|
101 |
+
|
102 |
+
private static $_Default = "en";
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Generates a locale object
|
106 |
+
* If no locale is given a automatic search is done
|
107 |
+
* Then the most probable locale will be automatically set
|
108 |
+
* Search order is
|
109 |
+
* 1. Given Locale
|
110 |
+
* 2. HTTP Client
|
111 |
+
* 3. Server Environment
|
112 |
+
* 4. Framework Standard
|
113 |
+
*
|
114 |
+
* @param string $locale OPTIONAL locale for parsing input
|
115 |
+
* @throws Zend_Locale_Exception
|
116 |
+
*/
|
117 |
+
public function __construct($locale = null)
|
118 |
+
{
|
119 |
+
if (empty(self::$_auto)) {
|
120 |
+
self::$_auto = $this->getDefault(null, false);
|
121 |
+
self::$_browser = $this->getDefault(self::BROWSER, false);
|
122 |
+
self::$_environment = $this->getDefault(self::ENVIRONMENT, false);
|
123 |
+
if (empty($locale) and empty(self::$_auto) and empty(self::$_Default)) {
|
124 |
+
require_once 'Zend/Locale/Exception.php';
|
125 |
+
throw new Zend_Locale_Exception('Autodetection of Locale has been failed!');
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
if ($locale instanceof Zend_Locale) {
|
130 |
+
$locale = $locale->toString();
|
131 |
+
}
|
132 |
+
$this->setLocale($locale);
|
133 |
+
}
|
134 |
+
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Serialization Interface
|
138 |
+
*
|
139 |
+
* @return string
|
140 |
+
*/
|
141 |
+
public function serialize()
|
142 |
+
{
|
143 |
+
return serialize($this);
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Returns a string representation of the object
|
149 |
+
*
|
150 |
+
* @return string
|
151 |
+
*/
|
152 |
+
public function toString()
|
153 |
+
{
|
154 |
+
return (string) $this->_Locale;
|
155 |
+
}
|
156 |
+
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Returns a string representation of the object
|
160 |
+
* Alias for toString
|
161 |
+
*
|
162 |
+
* @return string
|
163 |
+
*/
|
164 |
+
public function __toString()
|
165 |
+
{
|
166 |
+
return $this->toString();
|
167 |
+
}
|
168 |
+
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Search the locale automatically and return all used locales
|
172 |
+
* ordered by quality
|
173 |
+
*
|
174 |
+
* Standard Searchorder is
|
175 |
+
* - getBrowser
|
176 |
+
* - getEnvironment
|
177 |
+
* - getFramework
|
178 |
+
*
|
179 |
+
* @param $searchorder - OPTIONAL searchorder
|
180 |
+
* @param $fastsearch - OPTIONAL returnes the first found locale array when true
|
181 |
+
* otherwise all found default locales will be returned
|
182 |
+
* @return locale - returns an array of all the mosta locale string
|
183 |
+
*/
|
184 |
+
public function getDefault($searchorder = null, $fastsearch = null)
|
185 |
+
{
|
186 |
+
$languages = array();
|
187 |
+
if ($searchorder == self::ENVIRONMENT) {
|
188 |
+
|
189 |
+
$languages = $this->getEnvironment();
|
190 |
+
if (empty($languages) or !$fastsearch) {
|
191 |
+
$languages = array_merge($languages, $this->getFramework());
|
192 |
+
}
|
193 |
+
if (empty($languages) or !$fastsearch) {
|
194 |
+
$languages = array_merge($languages, $this->getBrowser());
|
195 |
+
}
|
196 |
+
|
197 |
+
} else if ($searchorder == self::FRAMEWORK) {
|
198 |
+
|
199 |
+
$languages = $this->getFramework();
|
200 |
+
if (empty($languages) or !$fastsearch) {
|
201 |
+
$languages = array_merge($languages, $this->getEnvironment());
|
202 |
+
}
|
203 |
+
if (empty($languages) or !$fastsearch) {
|
204 |
+
$languages = array_merge($languages, $this->getBrowser());
|
205 |
+
}
|
206 |
+
|
207 |
+
} else {
|
208 |
+
|
209 |
+
$languages = $this->getBrowser();
|
210 |
+
if (empty($languages) or !$fastsearch) {
|
211 |
+
$languages = array_merge($languages, $this->getEnvironment());
|
212 |
+
}
|
213 |
+
if (empty($languages) or !$fastsearch) {
|
214 |
+
$languages = array_merge($languages, $this->getFramework());
|
215 |
+
}
|
216 |
+
|
217 |
+
}
|
218 |
+
|
219 |
+
if (!array_key_exists(self::$_Default, $languages)) {
|
220 |
+
$languages[self::$_Default] = 0.1;
|
221 |
+
}
|
222 |
+
return $languages;
|
223 |
+
}
|
224 |
+
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Sets a new default locale
|
228 |
+
*
|
229 |
+
* @param String $locale
|
230 |
+
* @return boolean
|
231 |
+
* @throws Zend_Locale_Exception
|
232 |
+
*/
|
233 |
+
public static function setDefault($locale)
|
234 |
+
{
|
235 |
+
if (($locale == "auto") or ($locale == "root") or
|
236 |
+
($locale == "environment") or ($locale == "browser")) {
|
237 |
+
require_once 'Zend/Locale/Exception.php';
|
238 |
+
throw new Zend_Locale_Exception('Only full qualified locales can be used as default!');
|
239 |
+
}
|
240 |
+
if (array_key_exists($locale, self::$_localeData)) {
|
241 |
+
self::$_Default = $locale;
|
242 |
+
return true;
|
243 |
+
} else {
|
244 |
+
$locale = explode('_', $locale);
|
245 |
+
if (array_key_exists($locale[0], self::$_localeData)) {
|
246 |
+
self::$_Default = $locale[0];
|
247 |
+
return true;
|
248 |
+
}
|
249 |
+
}
|
250 |
+
require_once 'Zend/Locale/Exception.php';
|
251 |
+
throw new Zend_Locale_Exception("Unknown locale '$locale' can not be set as default!");
|
252 |
+
}
|
253 |
+
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Expects the Systems standard locale
|
257 |
+
*
|
258 |
+
* For Windows:
|
259 |
+
* f.e.: LC_COLLATE=C;LC_CTYPE=German_Austria.1252;LC_MONETARY=C
|
260 |
+
* would be recognised as de_AT
|
261 |
+
*
|
262 |
+
* @return array
|
263 |
+
*/
|
264 |
+
public function getEnvironment()
|
265 |
+
{
|
266 |
+
require_once 'Zend/Locale/Data/Translation.php';
|
267 |
+
|
268 |
+
$language = setlocale(LC_ALL, 0);
|
269 |
+
$languages = explode(';', $language);
|
270 |
+
|
271 |
+
$languagearray = array();
|
272 |
+
|
273 |
+
foreach ($languages as $locale) {
|
274 |
+
|
275 |
+
if (strpos($locale, '=') !== false) {
|
276 |
+
$language = substr($locale, strpos($locale, '='));
|
277 |
+
$language = substr($language, 1);
|
278 |
+
}
|
279 |
+
|
280 |
+
if ($language != 'C') {
|
281 |
+
if (strpos($language, '.') !== false) {
|
282 |
+
$language = substr($language, 0, strpos($language, '.') - 1);
|
283 |
+
} else if (strpos($language, '@') !== false) {
|
284 |
+
$language = substr($language, 0, strpos($language, '@') - 1);
|
285 |
+
}
|
286 |
+
$splitted = explode('_', $language);
|
287 |
+
if (array_key_exists((string) $language, self::$_localeData)) {
|
288 |
+
$languagearray[$language] = 1;
|
289 |
+
if (strlen($language) > 4) {
|
290 |
+
$languagearray[substr($language, 0, 2)] = 1;
|
291 |
+
}
|
292 |
+
continue;
|
293 |
+
}
|
294 |
+
|
295 |
+
if (!empty(Zend_Locale_Data_Translation::$localeTranslation[$splitted[0]])) {
|
296 |
+
if (!empty(Zend_Locale_Data_Translation::$localeTranslation[$splitted[1]])) {
|
297 |
+
$languagearray[Zend_Locale_Data_Translation::$localeTranslation[$splitted[0]] . '_'
|
298 |
+
. Zend_Locale_Data_Translation::$localeTranslation[$splitted[1]]] = 1;
|
299 |
+
}
|
300 |
+
$languagearray[Zend_Locale_Data_Translation::$localeTranslation[$splitted[0]]] = 1;
|
301 |
+
}
|
302 |
+
}
|
303 |
+
}
|
304 |
+
return $languagearray;
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Return an array of all accepted languages of the client
|
309 |
+
* Expects RFC compilant Header !!
|
310 |
+
*
|
311 |
+
* The notation can be :
|
312 |
+
* de,en-UK-US;q=0.5,fr-FR;q=0.2
|
313 |
+
*
|
314 |
+
* @return array - list of accepted languages including quality
|
315 |
+
*/
|
316 |
+
public function getBrowser()
|
317 |
+
{
|
318 |
+
$httplanguages = getenv("HTTP_ACCEPT_LANGUAGE");
|
319 |
+
|
320 |
+
$languages = array();
|
321 |
+
if (empty($httplanguages)) {
|
322 |
+
return $languages;
|
323 |
+
}
|
324 |
+
|
325 |
+
$accepted = preg_split('/,\s*/', $httplanguages);
|
326 |
+
|
327 |
+
foreach ($accepted as $accept) {
|
328 |
+
$result = preg_match('/^([a-z]{1,8}(?:[-_][a-z]{1,8})*)(?:;\s*q=(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3})?))?$/i',
|
329 |
+
$accept, $match);
|
330 |
+
|
331 |
+
if (!$result) {
|
332 |
+
continue;
|
333 |
+
}
|
334 |
+
|
335 |
+
if (isset($match[2])) {
|
336 |
+
$quality = (float) $match[2];
|
337 |
+
} else {
|
338 |
+
$quality = 1.0;
|
339 |
+
}
|
340 |
+
|
341 |
+
$countrys = explode('-', $match[1]);
|
342 |
+
$region = array_shift($countrys);
|
343 |
+
|
344 |
+
$country2 = explode('_', $region);
|
345 |
+
$region = array_shift($country2);
|
346 |
+
|
347 |
+
foreach($countrys as $country) {
|
348 |
+
$languages[$region . '_' . strtoupper($country)] = $quality;
|
349 |
+
}
|
350 |
+
foreach($country2 as $country) {
|
351 |
+
$languages[$region . '_' . strtoupper($country)] = $quality;
|
352 |
+
}
|
353 |
+
if (!isset($languages[$region]) || ($languages[$region] < $quality)) {
|
354 |
+
$languages[$region] = $quality;
|
355 |
+
}
|
356 |
+
}
|
357 |
+
return $languages;
|
358 |
+
}
|
359 |
+
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Returns the locale which the framework is set to
|
363 |
+
*
|
364 |
+
* @return array
|
365 |
+
*/
|
366 |
+
public function getFramework()
|
367 |
+
{
|
368 |
+
$languages = array();
|
369 |
+
return $languages;
|
370 |
+
}
|
371 |
+
|
372 |
+
|
373 |
+
/**
|
374 |
+
* Sets a new locale
|
375 |
+
*
|
376 |
+
* @param mixed $locale OPTIONAL new locale to set
|
377 |
+
*/
|
378 |
+
public function setLocale($locale = null)
|
379 |
+
{
|
380 |
+
if (($locale == self::BROWSER) or ($locale == self::ENVIRONMENT) or ($locale === null)) {
|
381 |
+
$locale = $this->getDefault($locale, true);
|
382 |
+
}
|
383 |
+
|
384 |
+
if (($locale == 'auto') or ($locale === null)) {
|
385 |
+
$locale = self::$_auto;
|
386 |
+
}
|
387 |
+
if ($locale == 'browser') {
|
388 |
+
$locale = self::$_browser;
|
389 |
+
}
|
390 |
+
if ($locale == 'environment') {
|
391 |
+
$locale = self::$_environment;
|
392 |
+
}
|
393 |
+
if (is_array($locale)) {
|
394 |
+
$locale = key($locale);
|
395 |
+
}
|
396 |
+
if (!array_key_exists((string) $locale, self::$_localeData)) {
|
397 |
+
$region = substr($locale, 0, 3);
|
398 |
+
if (isset($region[2])) {
|
399 |
+
if (($region[2] == '_') or ($region[2] == '-')) {
|
400 |
+
$region = substr($region, 0, 2);
|
401 |
+
}
|
402 |
+
}
|
403 |
+
if (array_key_exists((string) $region, self::$_localeData)) {
|
404 |
+
$this->_Locale = $region;
|
405 |
+
} else {
|
406 |
+
$this->_Locale = 'root';
|
407 |
+
}
|
408 |
+
|
409 |
+
} else {
|
410 |
+
$this->_Locale = $locale;
|
411 |
+
}
|
412 |
+
}
|
413 |
+
|
414 |
+
|
415 |
+
/**
|
416 |
+
* Returns the language part of the locale
|
417 |
+
*
|
418 |
+
* @return language
|
419 |
+
*/
|
420 |
+
public function getLanguage()
|
421 |
+
{
|
422 |
+
$locale = explode('_', $this->_Locale);
|
423 |
+
return $locale[0];
|
424 |
+
}
|
425 |
+
|
426 |
+
|
427 |
+
/**
|
428 |
+
* Returns the region part of the locale if available
|
429 |
+
*
|
430 |
+
* @return string|false - Regionstring
|
431 |
+
*/
|
432 |
+
public function getRegion()
|
433 |
+
{
|
434 |
+
$locale = explode('_', $this->_Locale);
|
435 |
+
if (isset($locale[1])) {
|
436 |
+
return $locale[1];
|
437 |
+
}
|
438 |
+
|
439 |
+
return false;
|
440 |
+
}
|
441 |
+
|
442 |
+
|
443 |
+
/**
|
444 |
+
* Return the accepted charset of the client
|
445 |
+
*
|
446 |
+
* @return string
|
447 |
+
*/
|
448 |
+
public function getHttpCharset()
|
449 |
+
{
|
450 |
+
$httpcharsets = getenv("HTTP_ACCEPT_CHARSET");
|
451 |
+
|
452 |
+
$charsets = array();
|
453 |
+
if ($httpcharsets === false) {
|
454 |
+
return $charsets;
|
455 |
+
}
|
456 |
+
|
457 |
+
$accepted = preg_split('/,\s*/', $httpcharsets);
|
458 |
+
foreach ($accepted as $accept)
|
459 |
+
{
|
460 |
+
if (empty($accept)) {
|
461 |
+
continue;
|
462 |
+
}
|
463 |
+
|
464 |
+
if (strpos($accept, ';'))
|
465 |
+
{
|
466 |
+
$quality = (float) substr($accept, strpos($accept, '=') + 1);
|
467 |
+
$charsets[substr($accept, 0, strpos($accept, ';'))] = $quality;
|
468 |
+
} else {
|
469 |
+
$quality = 1.0;
|
470 |
+
$charsets[$accept] = $quality;
|
471 |
+
}
|
472 |
+
|
473 |
+
}
|
474 |
+
|
475 |
+
return $charsets;
|
476 |
+
}
|
477 |
+
|
478 |
+
|
479 |
+
/**
|
480 |
+
* Returns true if both locales are equal
|
481 |
+
*
|
482 |
+
* @return boolean
|
483 |
+
*/
|
484 |
+
public function equals($object)
|
485 |
+
{
|
486 |
+
if ($object->toString() == $this->toString()) {
|
487 |
+
return true;
|
488 |
+
}
|
489 |
+
|
490 |
+
return false;
|
491 |
+
}
|
492 |
+
|
493 |
+
|
494 |
+
/**
|
495 |
+
* Returns localized informations as array, supported are several
|
496 |
+
* types of informations.
|
497 |
+
* For detailed information about the types look into the documentation
|
498 |
+
*
|
499 |
+
* @param string $path OPTIONAL Type of information to return
|
500 |
+
* @param string|locale $locale OPTIONAL Locale|Language for which this informations should be returned
|
501 |
+
* @param string $value OPTIONAL Value for detail list
|
502 |
+
* @return array Array with the wished information in the given language
|
503 |
+
*/
|
504 |
+
public function getTranslationList($path = null, $locale = null, $value = null)
|
505 |
+
{
|
506 |
+
// load class within method for speed
|
507 |
+
require_once 'Zend/Locale/Data.php';
|
508 |
+
require_once 'Zend/Locale/Exception.php';
|
509 |
+
|
510 |
+
if ($locale === null) {
|
511 |
+
$locale = $this->_Locale;
|
512 |
+
}
|
513 |
+
|
514 |
+
if ($locale == 'auto') {
|
515 |
+
$locale = self::$_auto;
|
516 |
+
}
|
517 |
+
if ($locale == 'browser') {
|
518 |
+
$locale = self::$_browser;
|
519 |
+
}
|
520 |
+
if ($locale == 'environment') {
|
521 |
+
$locale = self::$_environment;
|
522 |
+
}
|
523 |
+
if (is_array($locale)) {
|
524 |
+
$locale = key($locale);
|
525 |
+
}
|
526 |
+
$result = Zend_Locale_Data::getList($locale, $path, $value);
|
527 |
+
if (empty($result)) {
|
528 |
+
return false;
|
529 |
+
}
|
530 |
+
return $result;
|
531 |
+
}
|
532 |
+
|
533 |
+
|
534 |
+
/**
|
535 |
+
* Returns an array with the name of all languages translated to the given language
|
536 |
+
*
|
537 |
+
* @param string $locale OPTIONAL locale for language translation
|
538 |
+
* @return array
|
539 |
+
*/
|
540 |
+
public function getLanguageTranslationList($locale = null)
|
541 |
+
{
|
542 |
+
return $this->getTranslationList('language', $locale);
|
543 |
+
}
|
544 |
+
|
545 |
+
|
546 |
+
/**
|
547 |
+
* Returns an array with the name of all scripts translated to the given language
|
548 |
+
*
|
549 |
+
* @param string $locale OPTIONAL locale for script translation
|
550 |
+
* @return array
|
551 |
+
*/
|
552 |
+
public function getScriptTranslationList($locale = null)
|
553 |
+
{
|
554 |
+
return $this->getTranslationList('script', $locale);
|
555 |
+
}
|
556 |
+
|
557 |
+
|
558 |
+
/**
|
559 |
+
* Returns an array with the name of all countries translated to the given language
|
560 |
+
*
|
561 |
+
* @param string $locale OPTIONAL locale for country translation
|
562 |
+
* @return array
|
563 |
+
*/
|
564 |
+
public function getCountryTranslationList($locale = null)
|
565 |
+
{
|
566 |
+
return $this->getTranslationList('territory', $locale, 2);
|
567 |
+
}
|
568 |
+
|
569 |
+
|
570 |
+
/**
|
571 |
+
* Returns an array with the name of all territories translated to the given language
|
572 |
+
* All territories contains other countries.
|
573 |
+
*
|
574 |
+
* @param string $locale OPTIONAL locale for territory translation
|
575 |
+
* @return array
|
576 |
+
*/
|
577 |
+
public function getTerritoryTranslationList($locale = null)
|
578 |
+
{
|
579 |
+
return $this->getTranslationList('territory', $locale, 1);
|
580 |
+
}
|
581 |
+
|
582 |
+
|
583 |
+
/**
|
584 |
+
* Returns a localized information string, supported are several types of informations.
|
585 |
+
* For detailed information about the types look into the documentation
|
586 |
+
*
|
587 |
+
* @param string $value Name to get detailed information about
|
588 |
+
* @param string $path OPTIONAL Type of information to return
|
589 |
+
* @param string|locale $locale OPTIONAL Locale|Language for which this informations should be returned
|
590 |
+
* @return string The wished information in the given language
|
591 |
+
*/
|
592 |
+
public function getTranslation($value = null, $path = null, $locale = null)
|
593 |
+
{
|
594 |
+
// load class within method for speed
|
595 |
+
require_once 'Zend/Locale/Data.php';
|
596 |
+
require_once 'Zend/Locale/Exception.php';
|
597 |
+
|
598 |
+
if ($locale === null) {
|
599 |
+
$locale = $this->_Locale;
|
600 |
+
}
|
601 |
+
|
602 |
+
if ($locale == 'auto') {
|
603 |
+
$locale = self::$_auto;
|
604 |
+
}
|
605 |
+
if ($locale == 'browser') {
|
606 |
+
$locale = self::$_browser;
|
607 |
+
}
|
608 |
+
if ($locale == 'environment') {
|
609 |
+
$locale = self::$_environment;
|
610 |
+
}
|
611 |
+
if (is_array($locale)) {
|
612 |
+
$locale = key($locale);
|
613 |
+
}
|
614 |
+
$result = Zend_Locale_Data::getContent($locale, $path, $value);
|
615 |
+
if (empty($result)) {
|
616 |
+
return false;
|
617 |
+
}
|
618 |
+
return $result;
|
619 |
+
}
|
620 |
+
|
621 |
+
|
622 |
+
/**
|
623 |
+
* Returns the localized language name
|
624 |
+
*
|
625 |
+
* @param string $value Name to get detailed information about
|
626 |
+
* @param string $locale OPTIONAL locale for language translation
|
627 |
+
* @return array
|
628 |
+
*/
|
629 |
+
public function getLanguageTranslation($value, $locale = null)
|
630 |
+
{
|
631 |
+
return $this->getTranslation($value, 'language', $locale);
|
632 |
+
}
|
633 |
+
|
634 |
+
|
635 |
+
/**
|
636 |
+
* Returns the localized script name
|
637 |
+
*
|
638 |
+
* @param string $what Name to get detailed information about
|
639 |
+
* @param string $locale OPTIONAL locale for script translation
|
640 |
+
* @return array
|
641 |
+
*/
|
642 |
+
public function getScriptTranslation($value, $locale = null)
|
643 |
+
{
|
644 |
+
return $this->getTranslation($value, 'script', $locale);
|
645 |
+
}
|
646 |
+
|
647 |
+
|
648 |
+
/**
|
649 |
+
* Returns the localized country name
|
650 |
+
*
|
651 |
+
* @param string $what Name to get detailed information about
|
652 |
+
* @param string $locale OPTIONAL locale for country translation
|
653 |
+
* @return array
|
654 |
+
*/
|
655 |
+
public function getCountryTranslation($value, $locale = null)
|
656 |
+
{
|
657 |
+
return $this->getTranslation($value, 'country', $locale);
|
658 |
+
}
|
659 |
+
|
660 |
+
|
661 |
+
/**
|
662 |
+
* Returns the localized territory name
|
663 |
+
* All territories contains other countries.
|
664 |
+
*
|
665 |
+
* @param string $what Name to get detailed information about
|
666 |
+
* @param string $locale OPTIONAL locale for territory translation
|
667 |
+
* @return array
|
668 |
+
*/
|
669 |
+
public function getTerritoryTranslation($value, $locale = null)
|
670 |
+
{
|
671 |
+
return $this->getTranslation($value, 'territory', $locale);
|
672 |
+
}
|
673 |
+
|
674 |
+
|
675 |
+
/**
|
676 |
+
* Returns an array with translated yes strings
|
677 |
+
*
|
678 |
+
* @param string $locale OPTIONAL locale for language translation (defaults to $this locale)
|
679 |
+
* @return array
|
680 |
+
*/
|
681 |
+
public function getQuestion($locale = null)
|
682 |
+
{
|
683 |
+
// load class within method for speed
|
684 |
+
require_once 'Zend/Locale/Data.php';
|
685 |
+
|
686 |
+
if ($locale === null) {
|
687 |
+
$locale = $this->_Locale;
|
688 |
+
}
|
689 |
+
|
690 |
+
if ($locale == 'auto') {
|
691 |
+
$locale = self::$_auto;
|
692 |
+
}
|
693 |
+
if ($locale == 'browser') {
|
694 |
+
$locale = self::$_browser;
|
695 |
+
}
|
696 |
+
if ($locale == 'environment') {
|
697 |
+
$locale = self::$_environment;
|
698 |
+
}
|
699 |
+
if (is_array($locale)) {
|
700 |
+
$locale = key($locale);
|
701 |
+
}
|
702 |
+
$quest = Zend_Locale_Data::getList($locale, 'question');
|
703 |
+
$yes = explode(':', $quest['yes']);
|
704 |
+
$no = explode(':', $quest['no']);
|
705 |
+
$quest['yes'] = $yes[0];
|
706 |
+
$quest['yesarray'] = $yes;
|
707 |
+
$quest['no'] = $no[0];
|
708 |
+
$quest['noarray'] = $no;
|
709 |
+
$quest['yesexpr'] = $this->_getRegex($yes);
|
710 |
+
$quest['noexpr'] = $this->_getRegex($no);
|
711 |
+
|
712 |
+
return $quest;
|
713 |
+
}
|
714 |
+
|
715 |
+
|
716 |
+
/**
|
717 |
+
* Internal function for creating a regex
|
718 |
+
*
|
719 |
+
* @param string $input
|
720 |
+
* @return string
|
721 |
+
*/
|
722 |
+
private function _getRegex($input)
|
723 |
+
{
|
724 |
+
$regex = "";
|
725 |
+
if (is_array($input)) {
|
726 |
+
$regex = "^";
|
727 |
+
$start = true;
|
728 |
+
foreach($input as $row) {
|
729 |
+
if ($start === false) {
|
730 |
+
$regex .= "|";
|
731 |
+
}
|
732 |
+
$start = false;
|
733 |
+
$regex .= "(";
|
734 |
+
$one = null;
|
735 |
+
if (strlen($row) > 2) {
|
736 |
+
$one = true;
|
737 |
+
}
|
738 |
+
foreach (str_split($row, 1) as $char) {
|
739 |
+
$regex .= "[" . $char;
|
740 |
+
$regex .= strtoupper($char) . "]";
|
741 |
+
if ($one === true) {
|
742 |
+
$one = false;
|
743 |
+
$regex .= "(";
|
744 |
+
}
|
745 |
+
}
|
746 |
+
if ($one === false) {
|
747 |
+
$regex .= ")";
|
748 |
+
}
|
749 |
+
$regex .= "?)";
|
750 |
+
}
|
751 |
+
}
|
752 |
+
return $regex;
|
753 |
+
}
|
754 |
+
|
755 |
+
|
756 |
+
/**
|
757 |
+
* Checks if a locale identifier is a real locale or not
|
758 |
+
* Examples:
|
759 |
+
* "en_XX" refers to "en", which returns true
|
760 |
+
* "XX_yy" refers to "root", which returns false
|
761 |
+
*
|
762 |
+
* @param string|Zend_Locale $locale Locale to check for
|
763 |
+
* @param boolean $create If true, create a default locale, if $locale is empty
|
764 |
+
* @return false|string false if given locale is not a locale, else the locale identifier is returned
|
765 |
+
*/
|
766 |
+
public static function isLocale($locale, $create = false)
|
767 |
+
{
|
768 |
+
if (empty($locale) and ($create === true)) {
|
769 |
+
$locale = new self();
|
770 |
+
}
|
771 |
+
if ($locale instanceof Zend_Locale) {
|
772 |
+
return $locale->toString();
|
773 |
+
}
|
774 |
+
if (!is_string($locale)) {
|
775 |
+
return false;
|
776 |
+
}
|
777 |
+
if (empty(self::$_auto)) {
|
778 |
+
$temp = new self($locale);
|
779 |
+
self::$_auto = $temp->getDefault(null, false);
|
780 |
+
self::$_browser = $temp->getDefault(self::BROWSER, false);
|
781 |
+
self::$_environment = $temp->getDefault(self::ENVIRONMENT, false);
|
782 |
+
}
|
783 |
+
if ($locale == 'auto') {
|
784 |
+
$locale = self::$_auto;
|
785 |
+
}
|
786 |
+
if ($locale == 'browser') {
|
787 |
+
$locale = self::$_browser;
|
788 |
+
}
|
789 |
+
if ($locale == 'environment') {
|
790 |
+
$locale = self::$_environment;
|
791 |
+
}
|
792 |
+
if (is_array($locale)) {
|
793 |
+
$locale = key($locale);
|
794 |
+
}
|
795 |
+
|
796 |
+
if (array_key_exists($locale, self::$_localeData)) {
|
797 |
+
return $locale;
|
798 |
+
} else {
|
799 |
+
$locale = explode('_', $locale);
|
800 |
+
if (array_key_exists($locale[0], self::$_localeData)) {
|
801 |
+
return $locale[0];
|
802 |
+
}
|
803 |
+
}
|
804 |
+
return false;
|
805 |
+
}
|
806 |
+
|
807 |
+
|
808 |
+
/**
|
809 |
+
* Returns a list of all known locales where the locale is the key
|
810 |
+
* Only real locales are returned, the internal locales 'root', 'auto', 'browser'
|
811 |
+
* and 'environment' are suppressed
|
812 |
+
*
|
813 |
+
* @return array
|
814 |
+
*/
|
815 |
+
public static function getLocaleList()
|
816 |
+
{
|
817 |
+
$list = self::$_localeData;
|
818 |
+
unset($list['root']);
|
819 |
+
unset($list['auto']);
|
820 |
+
unset($list['browser']);
|
821 |
+
unset($list['environment']);
|
822 |
+
return $list;
|
823 |
+
}
|
824 |
+
|
825 |
+
|
826 |
+
/**
|
827 |
+
* Sets a cache
|
828 |
+
*
|
829 |
+
* @param Zend_Cache_Core $cache
|
830 |
+
*/
|
831 |
+
public static function setCache(Zend_Cache_Core $cache)
|
832 |
+
{
|
833 |
+
// load class within method for speed
|
834 |
+
require_once 'Zend/Locale/Data.php';
|
835 |
+
Zend_Locale_Data::setCache($cache);
|
836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