Lib_ZF_Locale - Version 1.7.2

Version Notes

1.7.2

Download this release

Release Info

Developer Magento Core Team
Extension Lib_ZF_Locale
Version 1.7.2
Comparing to
See all releases


Code changes from version 1.1.1 to 1.7.2

Files changed (480) hide show
  1. lib/Zend/Locale.php +538 -409
  2. lib/Zend/Locale/Data.php +73 -34
  3. lib/Zend/Locale/Data/Translation.php +15 -12
  4. lib/Zend/Locale/Data/aa.xml +5 -6
  5. lib/Zend/Locale/Data/aa_DJ.xml +3 -4
  6. lib/Zend/Locale/Data/aa_ER.xml +3 -4
  7. lib/Zend/Locale/Data/aa_ER_SAAHO.xml +0 -40
  8. lib/Zend/Locale/Data/aa_ET.xml +3 -4
  9. lib/Zend/Locale/Data/af.xml +101 -6
  10. lib/Zend/Locale/Data/af_NA.xml +4 -4
  11. lib/Zend/Locale/Data/af_ZA.xml +3 -4
  12. lib/Zend/Locale/Data/ak.xml +3 -3
  13. lib/Zend/Locale/Data/ak_GH.xml +3 -4
  14. lib/Zend/Locale/Data/am.xml +89 -17
  15. lib/Zend/Locale/Data/am_ET.xml +3 -4
  16. lib/Zend/Locale/Data/ar.xml +230 -67
  17. lib/Zend/Locale/Data/ar_AE.xml +3 -4
  18. lib/Zend/Locale/Data/ar_BH.xml +3 -4
  19. lib/Zend/Locale/Data/ar_DZ.xml +3 -4
  20. lib/Zend/Locale/Data/ar_EG.xml +3 -4
  21. lib/Zend/Locale/Data/ar_IQ.xml +3 -4
  22. lib/Zend/Locale/Data/ar_JO.xml +3 -4
  23. lib/Zend/Locale/Data/ar_KW.xml +3 -4
  24. lib/Zend/Locale/Data/ar_LB.xml +3 -3
  25. lib/Zend/Locale/Data/ar_LY.xml +3 -4
  26. lib/Zend/Locale/Data/ar_MA.xml +3 -4
  27. lib/Zend/Locale/Data/ar_OM.xml +3 -4
  28. lib/Zend/Locale/Data/ar_QA.xml +3 -4
  29. lib/Zend/Locale/Data/ar_SA.xml +3 -4
  30. lib/Zend/Locale/Data/ar_SD.xml +3 -4
  31. lib/Zend/Locale/Data/ar_SY.xml +3 -4
  32. lib/Zend/Locale/Data/ar_TN.xml +3 -4
  33. lib/Zend/Locale/Data/ar_YE.xml +3 -4
  34. lib/Zend/Locale/Data/as.xml +47 -4
  35. lib/Zend/Locale/Data/as_IN.xml +3 -4
  36. lib/Zend/Locale/Data/az.xml +2522 -99
  37. lib/Zend/Locale/Data/az_AZ.xml +3 -3
  38. lib/Zend/Locale/Data/az_Cyrl.xml +3 -4
  39. lib/Zend/Locale/Data/az_Cyrl_AZ.xml +3 -4
  40. lib/Zend/Locale/Data/az_Latn.xml +3 -4
  41. lib/Zend/Locale/Data/az_Latn_AZ.xml +3 -4
  42. lib/Zend/Locale/Data/be.xml +397 -115
  43. lib/Zend/Locale/Data/be_BY.xml +3 -4
  44. lib/Zend/Locale/Data/bg.xml +115 -87
  45. lib/Zend/Locale/Data/bg_BG.xml +3 -4
  46. lib/Zend/Locale/Data/bn.xml +2394 -241
  47. lib/Zend/Locale/Data/bn_BD.xml +3 -4
  48. lib/Zend/Locale/Data/bn_IN.xml +19 -3
  49. lib/Zend/Locale/Data/bo.xml +0 -506
  50. lib/Zend/Locale/Data/bo_CN.xml +0 -10
  51. lib/Zend/Locale/Data/bo_IN.xml +0 -11
  52. lib/Zend/Locale/Data/bs.xml +3 -4
  53. lib/Zend/Locale/Data/bs_BA.xml +3 -4
  54. lib/Zend/Locale/Data/byn.xml +3 -4
  55. lib/Zend/Locale/Data/byn_ER.xml +3 -4
  56. lib/Zend/Locale/Data/ca.xml +672 -40
  57. lib/Zend/Locale/Data/ca_ES.xml +3 -4
  58. lib/Zend/Locale/Data/cch.xml +3 -4
  59. lib/Zend/Locale/Data/cch_NG.xml +3 -4
  60. lib/Zend/Locale/Data/characters.xml +1888 -0
  61. lib/Zend/Locale/Data/cop.xml +3 -3
  62. lib/Zend/Locale/Data/cop_Arab.xml +0 -23
  63. lib/Zend/Locale/Data/cop_Arab_EG.xml +0 -12
  64. lib/Zend/Locale/Data/cop_Arab_US.xml +0 -12
  65. lib/Zend/Locale/Data/cop_EG.xml +0 -11
  66. lib/Zend/Locale/Data/cop_US.xml +0 -11
  67. lib/Zend/Locale/Data/cs.xml +194 -86
  68. lib/Zend/Locale/Data/cs_CZ.xml +3 -4
  69. lib/Zend/Locale/Data/cy.xml +200 -45
  70. lib/Zend/Locale/Data/cy_GB.xml +3 -4
  71. lib/Zend/Locale/Data/da.xml +737 -70
  72. lib/Zend/Locale/Data/da_DK.xml +3 -4
  73. lib/Zend/Locale/Data/de.xml +764 -108
  74. lib/Zend/Locale/Data/de_AT.xml +27 -4
  75. lib/Zend/Locale/Data/de_BE.xml +51 -3
  76. lib/Zend/Locale/Data/de_CH.xml +4 -4
  77. lib/Zend/Locale/Data/de_DE.xml +3 -4
  78. lib/Zend/Locale/Data/de_LI.xml +4 -4
  79. lib/Zend/Locale/Data/de_LU.xml +3 -4
  80. lib/Zend/Locale/Data/dv.xml +7 -4
  81. lib/Zend/Locale/Data/dv_MV.xml +3 -4
  82. lib/Zend/Locale/Data/dz.xml +4 -5
  83. lib/Zend/Locale/Data/dz_BT.xml +3 -4
  84. lib/Zend/Locale/Data/ee.xml +3 -3
  85. lib/Zend/Locale/Data/ee_GH.xml +3 -4
  86. lib/Zend/Locale/Data/ee_TG.xml +3 -4
  87. lib/Zend/Locale/Data/el.xml +178 -70
  88. lib/Zend/Locale/Data/el_CY.xml +3 -4
  89. lib/Zend/Locale/Data/el_GR.xml +3 -4
  90. lib/Zend/Locale/Data/el_POLYTON.xml +3 -3
  91. lib/Zend/Locale/Data/el_POLYTONI.xml +0 -559
  92. lib/Zend/Locale/Data/en.xml +825 -620
  93. lib/Zend/Locale/Data/en_AS.xml +3 -4
  94. lib/Zend/Locale/Data/en_AU.xml +80 -3
  95. lib/Zend/Locale/Data/en_BE.xml +77 -4
  96. lib/Zend/Locale/Data/en_BW.xml +80 -4
  97. lib/Zend/Locale/Data/en_BZ.xml +88 -4
  98. lib/Zend/Locale/Data/en_CA.xml +81 -4
  99. lib/Zend/Locale/Data/en_GB.xml +75 -3
  100. lib/Zend/Locale/Data/en_GU.xml +3 -4
  101. lib/Zend/Locale/Data/en_HK.xml +80 -4
  102. lib/Zend/Locale/Data/en_IE.xml +73 -3
  103. lib/Zend/Locale/Data/en_IN.xml +81 -4
  104. lib/Zend/Locale/Data/en_JM.xml +3 -4
  105. lib/Zend/Locale/Data/en_MH.xml +3 -4
  106. lib/Zend/Locale/Data/en_MP.xml +3 -4
  107. lib/Zend/Locale/Data/en_MT.xml +76 -3
  108. lib/Zend/Locale/Data/en_NA.xml +3 -4
  109. lib/Zend/Locale/Data/en_NZ.xml +81 -4
  110. lib/Zend/Locale/Data/en_PH.xml +3 -4
  111. lib/Zend/Locale/Data/en_PK.xml +81 -4
  112. lib/Zend/Locale/Data/en_SG.xml +80 -3
  113. lib/Zend/Locale/Data/en_Shaw.xml +186 -0
  114. lib/Zend/Locale/Data/en_TT.xml +3 -4
  115. lib/Zend/Locale/Data/en_UM.xml +3 -4
  116. lib/Zend/Locale/Data/en_US.xml +3 -4
  117. lib/Zend/Locale/Data/en_US_POSIX.xml +4 -4
  118. lib/Zend/Locale/Data/en_VI.xml +3 -4
  119. lib/Zend/Locale/Data/en_ZA.xml +83 -3
  120. lib/Zend/Locale/Data/en_ZW.xml +80 -4
  121. lib/Zend/Locale/Data/eo.xml +82 -9
  122. lib/Zend/Locale/Data/es.xml +641 -117
  123. lib/Zend/Locale/Data/es_AR.xml +100 -3
  124. lib/Zend/Locale/Data/es_BO.xml +3 -4
  125. lib/Zend/Locale/Data/es_CL.xml +78 -6
  126. lib/Zend/Locale/Data/es_CO.xml +78 -4
  127. lib/Zend/Locale/Data/es_CR.xml +10 -4
  128. lib/Zend/Locale/Data/es_DO.xml +3 -4
  129. lib/Zend/Locale/Data/es_EC.xml +78 -4
  130. lib/Zend/Locale/Data/es_ES.xml +3 -98
  131. lib/Zend/Locale/Data/es_GT.xml +78 -4
  132. lib/Zend/Locale/Data/es_HN.xml +78 -4
  133. lib/Zend/Locale/Data/es_MX.xml +3 -4
  134. lib/Zend/Locale/Data/es_NI.xml +3 -4
  135. lib/Zend/Locale/Data/es_PA.xml +76 -4
  136. lib/Zend/Locale/Data/es_PE.xml +78 -3
  137. lib/Zend/Locale/Data/es_PR.xml +77 -5
  138. lib/Zend/Locale/Data/es_PY.xml +4 -4
  139. lib/Zend/Locale/Data/es_SV.xml +3 -4
  140. lib/Zend/Locale/Data/es_US.xml +81 -3
  141. lib/Zend/Locale/Data/es_UY.xml +4 -4
  142. lib/Zend/Locale/Data/es_VE.xml +4 -4
  143. lib/Zend/Locale/Data/et.xml +84 -6
  144. lib/Zend/Locale/Data/et_EE.xml +3 -4
  145. lib/Zend/Locale/Data/eu.xml +4 -4
  146. lib/Zend/Locale/Data/eu_ES.xml +3 -4
  147. lib/Zend/Locale/Data/fa.xml +1799 -241
  148. lib/Zend/Locale/Data/fa_AF.xml +29 -4
  149. lib/Zend/Locale/Data/fa_IR.xml +3 -3
  150. lib/Zend/Locale/Data/fi.xml +525 -96
  151. lib/Zend/Locale/Data/fi_FI.xml +3 -4
  152. lib/Zend/Locale/Data/fil.xml +369 -69
  153. lib/Zend/Locale/Data/fil_PH.xml +10 -0
  154. lib/Zend/Locale/Data/fo.xml +284 -98
  155. lib/Zend/Locale/Data/fo_FO.xml +3 -4
  156. lib/Zend/Locale/Data/fr.xml +2825 -327
  157. lib/Zend/Locale/Data/fr_BE.xml +71 -3
  158. lib/Zend/Locale/Data/fr_CA.xml +73 -6
  159. lib/Zend/Locale/Data/fr_CH.xml +70 -4
  160. lib/Zend/Locale/Data/fr_FR.xml +3 -4
  161. lib/Zend/Locale/Data/fr_LU.xml +3 -3
  162. lib/Zend/Locale/Data/fr_MC.xml +3 -4
  163. lib/Zend/Locale/Data/fr_SN.xml +10 -0
  164. lib/Zend/Locale/Data/fur.xml +236 -45
  165. lib/Zend/Locale/Data/fur_IT.xml +3 -4
  166. lib/Zend/Locale/Data/ga.xml +9 -16
  167. lib/Zend/Locale/Data/ga_IE.xml +3 -4
  168. lib/Zend/Locale/Data/gaa.xml +3 -4
  169. lib/Zend/Locale/Data/gaa_GH.xml +3 -4
  170. lib/Zend/Locale/Data/gez.xml +4 -4
  171. lib/Zend/Locale/Data/gez_ER.xml +3 -4
  172. lib/Zend/Locale/Data/gez_ET.xml +3 -4
  173. lib/Zend/Locale/Data/gl.xml +822 -50
  174. lib/Zend/Locale/Data/gl_ES.xml +3 -4
  175. lib/Zend/Locale/Data/gu.xml +17 -5
  176. lib/Zend/Locale/Data/gu_IN.xml +3 -4
  177. lib/Zend/Locale/Data/gv.xml +3 -3
  178. lib/Zend/Locale/Data/gv_GB.xml +3 -4
  179. lib/Zend/Locale/Data/ha.xml +95 -29
  180. lib/Zend/Locale/Data/ha_Arab.xml +6 -4
  181. lib/Zend/Locale/Data/ha_Arab_NG.xml +3 -4
  182. lib/Zend/Locale/Data/ha_Arab_SD.xml +11 -0
  183. lib/Zend/Locale/Data/ha_GH.xml +3 -4
  184. lib/Zend/Locale/Data/ha_Latn.xml +3 -4
  185. lib/Zend/Locale/Data/ha_Latn_GH.xml +3 -4
  186. lib/Zend/Locale/Data/ha_Latn_NE.xml +3 -4
  187. lib/Zend/Locale/Data/ha_Latn_NG.xml +3 -4
  188. lib/Zend/Locale/Data/ha_NE.xml +3 -4
  189. lib/Zend/Locale/Data/ha_NG.xml +3 -4
  190. lib/Zend/Locale/Data/ha_SD.xml +11 -0
  191. lib/Zend/Locale/Data/haw.xml +3 -4
  192. lib/Zend/Locale/Data/haw_US.xml +3 -4
  193. lib/Zend/Locale/Data/he.xml +355 -108
  194. lib/Zend/Locale/Data/he_IL.xml +3 -4
  195. lib/Zend/Locale/Data/hi.xml +1471 -103
  196. lib/Zend/Locale/Data/hi_IN.xml +3 -4
  197. lib/Zend/Locale/Data/hr.xml +124 -71
  198. lib/Zend/Locale/Data/hr_HR.xml +3 -3
  199. lib/Zend/Locale/Data/hu.xml +636 -937
  200. lib/Zend/Locale/Data/hu_HU.xml +3 -4
  201. lib/Zend/Locale/Data/hy.xml +82 -4
  202. lib/Zend/Locale/Data/hy_AM.xml +3 -4
  203. lib/Zend/Locale/Data/hy_AM_REVISED.xml +3 -3
  204. lib/Zend/Locale/Data/ia.xml +3 -4
  205. lib/Zend/Locale/Data/id.xml +3 -3
  206. lib/Zend/Locale/Data/id_ID.xml +3 -4
  207. lib/Zend/Locale/Data/ig.xml +6 -3
  208. lib/Zend/Locale/Data/ig_NG.xml +3 -4
  209. lib/Zend/Locale/Data/ii.xml +3 -4
  210. lib/Zend/Locale/Data/ii_CN.xml +3 -4
  211. lib/Zend/Locale/Data/in.xml +10 -0
  212. lib/Zend/Locale/Data/is.xml +343 -71
  213. lib/Zend/Locale/Data/is_IS.xml +3 -4
  214. lib/Zend/Locale/Data/it.xml +296 -450
  215. lib/Zend/Locale/Data/it_CH.xml +46 -5
  216. lib/Zend/Locale/Data/it_IT.xml +3 -4
  217. lib/Zend/Locale/Data/iu.xml +3 -4
  218. lib/Zend/Locale/Data/iw.xml +10 -0
  219. lib/Zend/Locale/Data/ja.xml +512 -331
  220. lib/Zend/Locale/Data/ja_JP.xml +3 -4
  221. lib/Zend/Locale/Data/ka.xml +578 -16
  222. lib/Zend/Locale/Data/ka_GE.xml +3 -4
  223. lib/Zend/Locale/Data/kaj.xml +3 -4
  224. lib/Zend/Locale/Data/kaj_NG.xml +3 -4
  225. lib/Zend/Locale/Data/kam.xml +3 -4
  226. lib/Zend/Locale/Data/kam_KE.xml +3 -4
  227. lib/Zend/Locale/Data/kcg.xml +3 -4
  228. lib/Zend/Locale/Data/kcg_NG.xml +3 -4
  229. lib/Zend/Locale/Data/kfo.xml +3 -4
  230. lib/Zend/Locale/Data/kfo_CI.xml +10 -0
  231. lib/Zend/Locale/Data/kfo_NG.xml +0 -11
  232. lib/Zend/Locale/Data/kk.xml +77 -8
  233. lib/Zend/Locale/Data/kk_Cyrl.xml +10 -0
  234. lib/Zend/Locale/Data/kk_Cyrl_KZ.xml +11 -0
  235. lib/Zend/Locale/Data/kk_KZ.xml +4 -4
  236. lib/Zend/Locale/Data/kl.xml +4 -4
  237. lib/Zend/Locale/Data/kl_GL.xml +3 -4
  238. lib/Zend/Locale/Data/km.xml +78 -5
  239. lib/Zend/Locale/Data/km_KH.xml +3 -4
  240. lib/Zend/Locale/Data/kn.xml +134 -19
  241. lib/Zend/Locale/Data/kn_IN.xml +3 -4
  242. lib/Zend/Locale/Data/ko.xml +1293 -78
  243. lib/Zend/Locale/Data/ko_KR.xml +3 -4
  244. lib/Zend/Locale/Data/kok.xml +4 -7
  245. lib/Zend/Locale/Data/kok_IN.xml +3 -4
  246. lib/Zend/Locale/Data/kpe.xml +3 -3
  247. lib/Zend/Locale/Data/kpe_GN.xml +3 -4
  248. lib/Zend/Locale/Data/kpe_LR.xml +3 -4
  249. lib/Zend/Locale/Data/ku.xml +111 -231
  250. lib/Zend/Locale/Data/ku_Arab.xml +3 -115
  251. lib/Zend/Locale/Data/ku_IQ.xml +0 -12
  252. lib/Zend/Locale/Data/ku_IR.xml +0 -12
  253. lib/Zend/Locale/Data/ku_Latn.xml +179 -3
  254. lib/Zend/Locale/Data/ku_Latn_IQ.xml +0 -12
  255. lib/Zend/Locale/Data/ku_Latn_IR.xml +0 -12
  256. lib/Zend/Locale/Data/ku_Latn_SY.xml +0 -12
  257. lib/Zend/Locale/Data/ku_Latn_TR.xml +3 -4
  258. lib/Zend/Locale/Data/ku_SY.xml +0 -12
  259. lib/Zend/Locale/Data/ku_TR.xml +3 -4
  260. lib/Zend/Locale/Data/kw.xml +3 -3
  261. lib/Zend/Locale/Data/kw_GB.xml +3 -4
  262. lib/Zend/Locale/Data/ky.xml +3 -4
  263. lib/Zend/Locale/Data/ky_KG.xml +3 -4
  264. lib/Zend/Locale/Data/ln.xml +86 -7
  265. lib/Zend/Locale/Data/ln_CD.xml +3 -4
  266. lib/Zend/Locale/Data/ln_CG.xml +3 -4
  267. lib/Zend/Locale/Data/lo.xml +3 -3
  268. lib/Zend/Locale/Data/lo_LA.xml +3 -4
  269. lib/Zend/Locale/Data/lt.xml +1157 -125
  270. lib/Zend/Locale/Data/lt_LT.xml +3 -4
  271. lib/Zend/Locale/Data/lv.xml +2414 -1530
  272. lib/Zend/Locale/Data/lv_LV.xml +3 -4
  273. lib/Zend/Locale/Data/mk.xml +78 -5
  274. lib/Zend/Locale/Data/mk_MK.xml +3 -4
  275. lib/Zend/Locale/Data/ml.xml +3846 -95
  276. lib/Zend/Locale/Data/ml_IN.xml +3 -4
  277. lib/Zend/Locale/Data/mn.xml +3 -3
  278. lib/Zend/Locale/Data/mn_CN.xml +11 -0
  279. lib/Zend/Locale/Data/mn_Cyrl.xml +10 -0
  280. lib/Zend/Locale/Data/mn_Cyrl_MN.xml +11 -0
  281. lib/Zend/Locale/Data/mn_MN.xml +4 -4
  282. lib/Zend/Locale/Data/mn_Mong.xml +17 -0
  283. lib/Zend/Locale/Data/mn_Mong_CN.xml +11 -0
  284. lib/Zend/Locale/Data/mo.xml +10 -0
  285. lib/Zend/Locale/Data/mr.xml +6 -9
  286. lib/Zend/Locale/Data/mr_IN.xml +3 -4
  287. lib/Zend/Locale/Data/ms.xml +55 -55
  288. lib/Zend/Locale/Data/ms_BN.xml +70 -4
  289. lib/Zend/Locale/Data/ms_MY.xml +3 -4
  290. lib/Zend/Locale/Data/mt.xml +77 -7
  291. lib/Zend/Locale/Data/mt_MT.xml +3 -3
  292. lib/Zend/Locale/Data/my.xml +1488 -73
  293. lib/Zend/Locale/Data/my_MM.xml +3 -3
  294. lib/Zend/Locale/Data/nb.xml +431 -60
  295. lib/Zend/Locale/Data/nb_NO.xml +3 -3
  296. lib/Zend/Locale/Data/ne.xml +1123 -37
  297. lib/Zend/Locale/Data/ne_IN.xml +10 -0
  298. lib/Zend/Locale/Data/ne_NP.xml +3 -3
  299. lib/Zend/Locale/Data/nl.xml +1496 -152
  300. lib/Zend/Locale/Data/nl_BE.xml +32 -5
  301. lib/Zend/Locale/Data/nl_NL.xml +3 -3
  302. lib/Zend/Locale/Data/nn.xml +237 -51
  303. lib/Zend/Locale/Data/nn_NO.xml +3 -3
  304. lib/Zend/Locale/Data/no.xml +10 -0
  305. lib/Zend/Locale/Data/nr.xml +35 -3
  306. lib/Zend/Locale/Data/nr_ZA.xml +3 -3
  307. lib/Zend/Locale/Data/nso.xml +38 -5
  308. lib/Zend/Locale/Data/nso_ZA.xml +3 -3
  309. lib/Zend/Locale/Data/ny.xml +3 -3
  310. lib/Zend/Locale/Data/ny_MW.xml +3 -3
  311. lib/Zend/Locale/Data/om.xml +3 -3
  312. lib/Zend/Locale/Data/om_ET.xml +3 -3
  313. lib/Zend/Locale/Data/om_KE.xml +3 -3
  314. lib/Zend/Locale/Data/or.xml +32 -19
  315. lib/Zend/Locale/Data/or_IN.xml +3 -3
  316. lib/Zend/Locale/Data/pa.xml +17 -10
  317. lib/Zend/Locale/Data/pa_Arab.xml +12 -4
  318. lib/Zend/Locale/Data/pa_Arab_PK.xml +3 -3
  319. lib/Zend/Locale/Data/pa_Guru.xml +3 -3
  320. lib/Zend/Locale/Data/pa_Guru_IN.xml +3 -3
  321. lib/Zend/Locale/Data/pa_IN.xml +3 -3
  322. lib/Zend/Locale/Data/pa_PK.xml +3 -3
  323. lib/Zend/Locale/Data/pl.xml +688 -467
  324. lib/Zend/Locale/Data/pl_PL.xml +3 -3
  325. lib/Zend/Locale/Data/plurals.xml +76 -0
  326. lib/Zend/Locale/Data/ps.xml +5 -4
  327. lib/Zend/Locale/Data/ps_AF.xml +3 -3
  328. lib/Zend/Locale/Data/pt.xml +1295 -468
  329. lib/Zend/Locale/Data/pt_BR.xml +3 -3
  330. lib/Zend/Locale/Data/pt_PT.xml +1425 -126
  331. lib/Zend/Locale/Data/ro.xml +131 -39
  332. lib/Zend/Locale/Data/ro_MD.xml +10 -0
  333. lib/Zend/Locale/Data/ro_RO.xml +3 -3
  334. lib/Zend/Locale/Data/root.xml +1329 -15
  335. lib/Zend/Locale/Data/ru.xml +730 -139
  336. lib/Zend/Locale/Data/ru_RU.xml +3 -3
  337. lib/Zend/Locale/Data/ru_UA.xml +44 -11
  338. lib/Zend/Locale/Data/rw.xml +3 -4
  339. lib/Zend/Locale/Data/rw_RW.xml +3 -3
  340. lib/Zend/Locale/Data/sa.xml +36 -4
  341. lib/Zend/Locale/Data/sa_IN.xml +3 -3
  342. lib/Zend/Locale/Data/se.xml +69 -38
  343. lib/Zend/Locale/Data/se_FI.xml +6 -10
  344. lib/Zend/Locale/Data/se_NO.xml +3 -3
  345. lib/Zend/Locale/Data/sh.xml +3 -3
  346. lib/Zend/Locale/Data/sh_BA.xml +3 -3
  347. lib/Zend/Locale/Data/sh_CS.xml +3 -3
  348. lib/Zend/Locale/Data/sh_YU.xml +3 -3
  349. lib/Zend/Locale/Data/si.xml +239 -0
  350. lib/Zend/Locale/Data/si_LK.xml +10 -0
  351. lib/Zend/Locale/Data/sid.xml +3 -4
  352. lib/Zend/Locale/Data/sid_ET.xml +3 -3
  353. lib/Zend/Locale/Data/sk.xml +259 -46
  354. lib/Zend/Locale/Data/sk_SK.xml +3 -3
  355. lib/Zend/Locale/Data/sl.xml +190 -41
  356. lib/Zend/Locale/Data/sl_SI.xml +3 -3
  357. lib/Zend/Locale/Data/so.xml +80 -3
  358. lib/Zend/Locale/Data/so_DJ.xml +3 -3
  359. lib/Zend/Locale/Data/so_ET.xml +3 -3
  360. lib/Zend/Locale/Data/so_KE.xml +3 -3
  361. lib/Zend/Locale/Data/so_SO.xml +3 -3
  362. lib/Zend/Locale/Data/sq.xml +152 -8
  363. lib/Zend/Locale/Data/sq_AL.xml +3 -3
  364. lib/Zend/Locale/Data/sr.xml +540 -38
  365. lib/Zend/Locale/Data/sr_BA.xml +3 -3
  366. lib/Zend/Locale/Data/sr_CS.xml +3 -3
  367. lib/Zend/Locale/Data/sr_Cyrl.xml +3 -4
  368. lib/Zend/Locale/Data/sr_Cyrl_BA.xml +29 -3
  369. lib/Zend/Locale/Data/sr_Cyrl_CS.xml +3 -3
  370. lib/Zend/Locale/Data/sr_Cyrl_ME.xml +3 -3
  371. lib/Zend/Locale/Data/sr_Cyrl_RS.xml +3 -3
  372. lib/Zend/Locale/Data/sr_Cyrl_YU.xml +3 -3
  373. lib/Zend/Locale/Data/sr_Latn.xml +27 -29
  374. lib/Zend/Locale/Data/sr_Latn_BA.xml +3 -3
  375. lib/Zend/Locale/Data/sr_Latn_CS.xml +3 -3
  376. lib/Zend/Locale/Data/sr_Latn_ME.xml +32 -4
  377. lib/Zend/Locale/Data/sr_Latn_RS.xml +3 -32
  378. lib/Zend/Locale/Data/sr_Latn_YU.xml +3 -3
  379. lib/Zend/Locale/Data/sr_ME.xml +3 -3
  380. lib/Zend/Locale/Data/sr_RS.xml +3 -3
  381. lib/Zend/Locale/Data/sr_YU.xml +3 -3
  382. lib/Zend/Locale/Data/ss.xml +35 -3
  383. lib/Zend/Locale/Data/ss_SZ.xml +10 -0
  384. lib/Zend/Locale/Data/ss_ZA.xml +3 -3
  385. lib/Zend/Locale/Data/ssy.xml +0 -38
  386. lib/Zend/Locale/Data/st.xml +38 -4
  387. lib/Zend/Locale/Data/st_LS.xml +10 -0
  388. lib/Zend/Locale/Data/st_ZA.xml +3 -3
  389. lib/Zend/Locale/Data/supplementalData.xml +640 -590
  390. lib/Zend/Locale/Data/sv.xml +1515 -98
  391. lib/Zend/Locale/Data/sv_FI.xml +30 -93
  392. lib/Zend/Locale/Data/sv_SE.xml +3 -3
  393. lib/Zend/Locale/Data/sw.xml +6 -7
  394. lib/Zend/Locale/Data/sw_KE.xml +3 -3
  395. lib/Zend/Locale/Data/sw_TZ.xml +3 -3
  396. lib/Zend/Locale/Data/syr.xml +20 -17
  397. lib/Zend/Locale/Data/syr_SY.xml +3 -3
  398. lib/Zend/Locale/Data/ta.xml +75 -17
  399. lib/Zend/Locale/Data/ta_IN.xml +3 -3
  400. lib/Zend/Locale/Data/te.xml +6 -5
  401. lib/Zend/Locale/Data/te_IN.xml +3 -3
  402. lib/Zend/Locale/Data/telephoneCodeData.xml +747 -0
  403. lib/Zend/Locale/Data/tg.xml +3 -3
  404. lib/Zend/Locale/Data/tg_Cyrl.xml +10 -0
  405. lib/Zend/Locale/Data/tg_Cyrl_TJ.xml +11 -0
  406. lib/Zend/Locale/Data/tg_TJ.xml +4 -3
  407. lib/Zend/Locale/Data/th.xml +342 -180
  408. lib/Zend/Locale/Data/th_TH.xml +3 -3
  409. lib/Zend/Locale/Data/ti.xml +4 -3
  410. lib/Zend/Locale/Data/ti_ER.xml +55 -3
  411. lib/Zend/Locale/Data/ti_ET.xml +3 -3
  412. lib/Zend/Locale/Data/tig.xml +3 -4
  413. lib/Zend/Locale/Data/tig_ER.xml +3 -3
  414. lib/Zend/Locale/Data/tl.xml +10 -0
  415. lib/Zend/Locale/Data/tn.xml +36 -3
  416. lib/Zend/Locale/Data/tn_ZA.xml +3 -3
  417. lib/Zend/Locale/Data/to.xml +195 -51
  418. lib/Zend/Locale/Data/to_TO.xml +3 -3
  419. lib/Zend/Locale/Data/tr.xml +250 -627
  420. lib/Zend/Locale/Data/tr_TR.xml +3 -3
  421. lib/Zend/Locale/Data/ts.xml +35 -3
  422. lib/Zend/Locale/Data/ts_ZA.xml +3 -3
  423. lib/Zend/Locale/Data/tt.xml +3 -4
  424. lib/Zend/Locale/Data/tt_RU.xml +3 -3
  425. lib/Zend/Locale/Data/ug.xml +6 -3
  426. lib/Zend/Locale/Data/ug_Arab.xml +11 -0
  427. lib/Zend/Locale/Data/ug_Arab_CN.xml +11 -0
  428. lib/Zend/Locale/Data/ug_CN.xml +11 -0
  429. lib/Zend/Locale/Data/uk.xml +543 -121
  430. lib/Zend/Locale/Data/uk_UA.xml +3 -3
  431. lib/Zend/Locale/Data/und.xml +0 -9
  432. lib/Zend/Locale/Data/und_ZZ.xml +0 -10
  433. lib/Zend/Locale/Data/ur.xml +278 -29
  434. lib/Zend/Locale/Data/ur_IN.xml +27 -3
  435. lib/Zend/Locale/Data/ur_PK.xml +3 -3
  436. lib/Zend/Locale/Data/uz.xml +3 -7
  437. lib/Zend/Locale/Data/uz_AF.xml +3 -3
  438. lib/Zend/Locale/Data/uz_Arab.xml +7 -4
  439. lib/Zend/Locale/Data/uz_Arab_AF.xml +3 -3
  440. lib/Zend/Locale/Data/uz_Cyrl.xml +3 -3
  441. lib/Zend/Locale/Data/uz_Cyrl_UZ.xml +3 -3
  442. lib/Zend/Locale/Data/uz_Latn.xml +3 -3
  443. lib/Zend/Locale/Data/uz_Latn_UZ.xml +3 -3
  444. lib/Zend/Locale/Data/uz_UZ.xml +3 -3
  445. lib/Zend/Locale/Data/ve.xml +35 -3
  446. lib/Zend/Locale/Data/ve_ZA.xml +3 -3
  447. lib/Zend/Locale/Data/vi.xml +279 -73
  448. lib/Zend/Locale/Data/vi_VN.xml +3 -3
  449. lib/Zend/Locale/Data/wal.xml +3 -4
  450. lib/Zend/Locale/Data/wal_ET.xml +3 -3
  451. lib/Zend/Locale/Data/wo.xml +4 -3
  452. lib/Zend/Locale/Data/wo_Arab.xml +0 -10
  453. lib/Zend/Locale/Data/wo_Arab_SN.xml +0 -11
  454. lib/Zend/Locale/Data/wo_Latn.xml +3 -3
  455. lib/Zend/Locale/Data/wo_Latn_SN.xml +3 -3
  456. lib/Zend/Locale/Data/wo_SN.xml +3 -3
  457. lib/Zend/Locale/Data/xh.xml +34 -3
  458. lib/Zend/Locale/Data/xh_ZA.xml +3 -3
  459. lib/Zend/Locale/Data/yo.xml +70 -47
  460. lib/Zend/Locale/Data/yo_NG.xml +3 -3
  461. lib/Zend/Locale/Data/zh.xml +486 -493
  462. lib/Zend/Locale/Data/zh_CN.xml +3 -3
  463. lib/Zend/Locale/Data/zh_HK.xml +3 -3
  464. lib/Zend/Locale/Data/zh_Hans.xml +3 -4
  465. lib/Zend/Locale/Data/zh_Hans_CN.xml +3 -3
  466. lib/Zend/Locale/Data/zh_Hans_HK.xml +11 -0
  467. lib/Zend/Locale/Data/zh_Hans_MO.xml +11 -0
  468. lib/Zend/Locale/Data/zh_Hans_SG.xml +68 -11
  469. lib/Zend/Locale/Data/zh_Hant.xml +422 -384
  470. lib/Zend/Locale/Data/zh_Hant_HK.xml +130 -9
  471. lib/Zend/Locale/Data/zh_Hant_MO.xml +62 -9
  472. lib/Zend/Locale/Data/zh_Hant_TW.xml +3 -3
  473. lib/Zend/Locale/Data/zh_MO.xml +3 -3
  474. lib/Zend/Locale/Data/zh_SG.xml +3 -3
  475. lib/Zend/Locale/Data/zh_TW.xml +3 -3
  476. lib/Zend/Locale/Data/zu.xml +92 -41
  477. lib/Zend/Locale/Data/zu_ZA.xml +3 -3
  478. lib/Zend/Locale/Format.php +111 -120
  479. lib/Zend/Locale/Math/PhpMath.php +74 -74
  480. package.xml +5 -5
lib/Zend/Locale.php CHANGED
@@ -12,94 +12,164 @@
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
@@ -111,28 +181,15 @@ class Zend_Locale {
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
*
@@ -143,7 +200,6 @@ class Zend_Locale {
143
return serialize($this);
144
}
145
146
-
147
/**
148
* Returns a string representation of the object
149
*
@@ -151,10 +207,9 @@ class Zend_Locale {
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
@@ -166,92 +221,73 @@ class Zend_Locale {
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
*
@@ -261,46 +297,54 @@ class Zend_Locale {
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
@@ -313,105 +357,86 @@ class Zend_Locale {
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})?))?#x2F;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
*
@@ -419,11 +444,10 @@ class Zend_Locale {
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
*
@@ -431,23 +455,22 @@ class Zend_Locale {
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) {
@@ -455,362 +478,332 @@ class Zend_Locale {
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
{
@@ -822,16 +815,152 @@ class Zend_Locale {
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
}
837
}
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
+ * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Locale.php 13368 2008-12-19 10:48:07Z thomas $
20
*/
21
22
/**
23
+ * Base class for localization
24
+ *
25
+ * @category Zend
26
+ * @package Zend_Locale
27
+ * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
28
+ * @license http://framework.zend.com/license/new-bsd New BSD License
29
*/
30
+ class Zend_Locale
31
+ {
32
+ /**
33
+ * Class wide Locale Constants
34
+ *
35
+ * @var array $_localeData
36
+ */
37
private static $_localeData = array(
38
+ 'root' => true, 'aa_DJ' => true, 'aa_ER' => true, 'aa_ET' => true, 'aa' => true,
39
+ 'af_NA' => true, 'af_ZA' => true, 'af' => true, 'ak_GH' => true, 'ak' => true,
40
+ 'am_ET' => true, 'am' => true, 'ar_AE' => true, 'ar_BH' => true, 'ar_DZ' => true,
41
+ 'ar_EG' => true, 'ar_IQ' => true, 'ar_JO' => true, 'ar_KW' => true, 'ar_LB' => true,
42
+ 'ar_LY' => true, 'ar_MA' => true, 'ar_OM' => true, 'ar_QA' => true, 'ar_SA' => true,
43
+ 'ar_SD' => true, 'ar_SY' => true, 'ar_TN' => true, 'ar_YE' => true, 'ar' => true,
44
+ 'as_IN' => true, 'as' => true, 'az_AZ' => true, 'az' => true, 'be_BY' => true,
45
+ 'be' => true, 'bg_BG' => true, 'bg' => true, 'bn_BD' => true, 'bn_IN' => true,
46
+ 'bn' => true, 'bo_CN' => true, 'bo_IN' => true, 'bo' => true, 'bs_BA' => true,
47
+ 'bs' => true, 'byn_ER'=> true, 'byn' => true, 'ca_ES' => true, 'ca' => true,
48
+ 'cch_NG'=> true, 'cch' => true, 'cop_EG'=> true, 'cop_US'=> true, 'cop' => true,
49
+ 'cs_CZ' => true, 'cs' => true, 'cy_GB' => true, 'cy' => true, 'da_DK' => true,
50
+ 'da' => true, 'de_AT' => true, 'de_BE' => true, 'de_CH' => true, 'de_DE' => true,
51
+ 'de_LI' => true, 'de_LU' => true, 'de' => true, 'dv_MV' => true, 'dv' => true,
52
+ 'dz_BT' => true, 'dz' => true, 'ee_GH' => true, 'ee_TG' => true, 'ee' => true,
53
+ 'el_CY' => true, 'el_GR' => true, 'el' => true, 'en_AS' => true, 'en_AU' => true,
54
+ 'en_BE' => true, 'en_BW' => true, 'en_BZ' => true, 'en_CA' => true, 'en_GB' => true,
55
+ 'en_GU' => true, 'en_HK' => true, 'en_IE' => true, 'en_IN' => true, 'en_JM' => true,
56
+ 'en_MH' => true, 'en_MP' => true, 'en_MT' => true, 'en_NZ' => true, 'en_PH' => true,
57
+ 'en_PK' => true, 'en_SG' => true, 'en_TT' => true, 'en_UM' => true, 'en_US' => true,
58
+ 'en_VI' => true, 'en_ZA' => true, 'en_ZW' => true, 'en' => true, 'eo' => true,
59
+ 'es_AR' => true, 'es_BO' => true, 'es_CL' => true, 'es_CO' => true, 'es_CR' => true,
60
+ 'es_DO' => true, 'es_EC' => true, 'es_ES' => true, 'es_GT' => true, 'es_HN' => true,
61
+ 'es_MX' => true, 'es_NI' => true, 'es_PA' => true, 'es_PE' => true, 'es_PR' => true,
62
+ 'es_PY' => true, 'es_SV' => true, 'es_US' => true, 'es_UY' => true, 'es_VE' => true,
63
+ 'es' => true, 'et_EE' => true, 'et' => true, 'eu_ES' => true, 'eu' => true,
64
+ 'fa_AF' => true, 'fa_IR' => true, 'fa' => true, 'fi_FI' => true, 'fi' => true,
65
+ 'fil' => true, 'fo_FO' => true, 'fo' => true, 'fr_BE' => true, 'fr_CA' => true,
66
+ 'fr_CH' => true, 'fr_FR' => true, 'fr_LU' => true, 'fr_MC' => true, 'fr' => true,
67
+ 'fur_IT'=> true, 'fur' => true, 'ga_IE' => true, 'ga' => true, 'gaa_GH'=> true,
68
+ 'gaa' => true, 'gez_ER'=> true, 'gez_ET'=> true, 'gez' => true, 'gl_ES' => true,
69
+ 'gl' => true, 'gu_IN' => true, 'gu' => true, 'gv_GB' => true, 'gv' => true,
70
+ 'ha_GH' => true, 'ha_NE' => true, 'ha_NG' => true, 'ha' => true, 'haw_US'=> true,
71
+ 'haw' => true, 'he_IL' => true, 'he' => true, 'hi_IN' => true, 'hi' => true,
72
+ 'hr_HR' => true, 'hr' => true, 'hu_HU' => true, 'hu' => true, 'hy_AM' => true,
73
+ 'hy' => true, 'ia' => true, 'id_ID' => true, 'id' => true, 'ig_NG' => true,
74
+ 'ig' => true, 'ii_CN' => true, 'ii' => true, 'is_IS' => true, 'is' => true,
75
+ 'it_CH' => true, 'it_IT' => true, 'it' => true, 'iu' => true, 'ja_JP' => true,
76
+ 'ja' => true, 'ka_GE' => true, 'ka' => true, 'kaj_NG'=> true, 'kaj' => true,
77
+ 'kam_KE'=> true, 'kam' => true, 'kcg_NG'=> true, 'kcg' => true, 'kfo_NG'=> true,
78
+ 'kfo' => true, 'kk_KZ' => true, 'kk' => true, 'kl_GL' => true, 'kl' => true,
79
+ 'km_KH' => true, 'km' => true, 'kn_IN' => true, 'kn' => true, 'ko_KR' => true,
80
+ 'ko' => true, 'kok_IN'=> true, 'kok' => true, 'kpe_GN'=> true, 'kpe_LR'=> true,
81
+ 'kpe' => true, 'ku_IQ' => true, 'ku_IR' => true, 'ku_SY' => true, 'ku_TR' => true,
82
+ 'ku' => true, 'kw_GB' => true, 'kw' => true, 'ky_KG' => true, 'ky' => true,
83
+ 'ln_CD' => true, 'ln_CG' => true, 'ln' => true, 'lo_LA' => true, 'lo' => true,
84
+ 'lt_LT' => true, 'lt' => true, 'lv_LV' => true, 'lv' => true, 'mk_MK' => true,
85
+ 'mk' => true, 'ml_IN' => true, 'ml' => true, 'mn_MN' => true, 'mn' => true,
86
+ 'mr_IN' => true, 'mr' => true, 'ms_BN' => true, 'ms_MY' => true, 'ms' => true,
87
+ 'mt_MT' => true, 'mt' => true, 'my_MM' => true, 'my' => true, 'nb_NO' => true,
88
+ 'nb' => true, 'ne_NP' => true, 'ne' => true, 'nl_BE' => true, 'nl_NL' => true,
89
+ 'nl' => true, 'nn_NO' => true, 'nn' => true, 'nr_ZA' => true, 'nr' => true,
90
+ 'nso_ZA'=> true, 'nso' => true, 'ny_MW' => true, 'ny' => true, 'om_ET' => true,
91
+ 'om_KE' => true, 'om' => true, 'or_IN' => true, 'or' => true, 'pa_IN' => true,
92
+ 'pa_PK' => true, 'pa' => true, 'pl_PL' => true, 'pl' => true, 'ps_AF' => true,
93
+ 'ps' => true, 'pt_BR' => true, 'pt_PT' => true, 'pt' => true, 'ro_RO' => true,
94
+ 'ro' => true, 'ru_RU' => true, 'ru_UA' => true, 'ru' => true, 'rw_RW' => true,
95
+ 'rw' => true, 'sa_IN' => true, 'sa' => true, 'se_FI' => true, 'se_NO' => true,
96
+ 'se' => true, 'sh_BA' => true, 'sh_CS' => true, 'sh_YU' => true, 'sh' => true,
97
+ 'sid_ET'=> true, 'sid' => true, 'sk_SK' => true, 'sk' => true, 'sl_SI' => true,
98
+ 'sl' => true, 'so_DJ' => true, 'so_ET' => true, 'so_KE' => true, 'so_SO' => true,
99
+ 'so' => true, 'sq_AL' => true, 'sq' => true, 'sr_BA' => true, 'sr_CS' => true,
100
+ 'sr_ME' => true, 'sr_RS' => true, 'sr_YU' => true, 'sr' => true, 'ss_ZA' => true,
101
+ 'ss' => true, 'ssy' => true, 'st_ZA' => true, 'st' => true, 'sv_FI' => true,
102
+ 'sv_SE' => true, 'sv' => true, 'sw_KE' => true, 'sw_TZ' => true, 'sw' => true,
103
+ 'syr_SY'=> true, 'syr' => true, 'ta_IN' => true, 'ta' => true, 'te_IN' => true,
104
+ 'te' => true, 'tg_TJ' => true, 'tg' => true, 'th_TH' => true, 'th' => true,
105
+ 'ti_ER' => true, 'ti_ET' => true, 'ti' => true, 'tig_ER'=> true, 'tig' => true,
106
+ 'tn_ZA' => true, 'tn' => true, 'to_TO' => true, 'to' => true, 'tr_TR' => true,
107
+ 'tr' => true, 'ts_ZA' => true, 'ts' => true, 'tt_RU' => true, 'tt' => true,
108
+ 'ug' => true, 'uk_UA' => true, 'uk' => true, 'und_ZZ'=> true, 'und' => true,
109
+ 'ur_IN' => true, 'ur_PK' => true, 'ur' => true, 'uz_AF' => true, 'uz_UZ' => true,
110
+ 'uz' => true, 've_ZA' => true, 've' => true, 'vi_VN' => true, 'vi' => true,
111
+ 'wal_ET'=> true, 'wal' => true, 'wo_SN' => true, 'wo' => true, 'xh_ZA' => true,
112
+ 'xh' => true, 'yo_NG' => true, 'yo' => true, 'zh_CN' => true, 'zh_HK' => true,
113
+ 'zh_MO' => true, 'zh_SG' => true, 'zh_TW' => true, 'zh' => true, 'zu_ZA' => true,
114
+ 'zu' => true
115
);
116
117
/**
118
* Autosearch constants
119
*/
120
+ const BROWSER = 'browser';
121
+ const ENVIRONMENT = 'environment';
122
+ const ZFDEFAULT = 'default';
123
124
+ /**
125
+ * Defines if old behaviour should be supported
126
+ * Old behaviour throws notices and will be deleted in future releases
127
+ *
128
+ * @var boolean
129
+ */
130
+ public static $compatibilityMode = true;
131
+
132
+ /**
133
+ * Internal variable
134
+ *
135
+ * @var boolean
136
+ */
137
+ private static $_breakChain = false;
138
139
/**
140
* Actual set locale
141
+ *
142
+ * @var string Locale
143
*/
144
+ protected $_locale;
145
146
+ /**
147
+ * Automatic detected locale
148
+ *
149
+ * @var string Locales
150
+ */
151
+ protected static $_auto;
152
153
/**
154
+ * Browser detected locale
155
+ *
156
+ * @var string Locales
157
*/
158
+ protected static $_browser;
159
160
/**
161
+ * Environment detected locale
162
+ *
163
+ * @var string Locales
164
*/
165
+ protected static $_environment;
166
167
+ /**
168
+ * Default locale
169
+ *
170
+ * @var string Locales
171
+ */
172
+ protected static $_default = array('en' => true);
173
174
/**
175
* Generates a locale object
181
* 3. Server Environment
182
* 4. Framework Standard
183
*
184
+ * @param string|Zend_Locale $locale (Optional) Locale for parsing input
185
+ * @throws Zend_Locale_Exception When autodetection has been failed
186
*/
187
public function __construct($locale = null)
188
{
189
+ $locale = self::_prepareLocale($locale);
190
+ $this->setLocale((string) $locale);
191
}
192
193
/**
194
* Serialization Interface
195
*
200
return serialize($this);
201
}
202
203
/**
204
* Returns a string representation of the object
205
*
207
*/
208
public function toString()
209
{
210
+ return (string) $this->_locale;
211
}
212
213
/**
214
* Returns a string representation of the object
215
* Alias for toString
221
return $this->toString();
222
}
223
224
/**
225
+ * Return the default locale
226
*
227
+ * @return array Returns an array of all locale string
228
*/
229
+ public static function getDefault()
230
{
231
+ if ((self::$compatibilityMode === true) or (func_num_args() > 0)) {
232
+ if (!self::$_breakChain) {
233
+ self::$_breakChain = true;
234
+ trigger_error('You are running Zend_Locale in compatibility mode... please migrate your scripts', E_USER_NOTICE);
235
+ $params = func_get_args();
236
+ $param = null;
237
+ if (isset($params[0])) {
238
+ $param = $params[0];
239
+ }
240
+ return self::getOrder($param);
241
}
242
243
+ self::$_breakChain = false;
244
}
245
246
+ return self::$_default;
247
}
248
249
/**
250
* Sets a new default locale
251
+ * If provided you can set a quality between 0 and 1 (or 2 and 100)
252
+ * which represents the percent of quality the browser
253
+ * requested within HTTP
254
*
255
+ * @param string|Zend_Locale $locale Locale to set
256
+ * @param float $quality The quality to set from 0 to 1
257
+ * @throws Zend_Locale_Exception When a autolocale was given
258
+ * @throws Zend_Locale_Exception When a unknown locale was given
259
+ * @return void
260
*/
261
+ public static function setDefault($locale, $quality = 1)
262
{
263
+ if (($locale === 'auto') or ($locale === 'root') or ($locale === 'default') or
264
+ ($locale === 'environment') or ($locale === 'browser')) {
265
#require_once 'Zend/Locale/Exception.php';
266
throw new Zend_Locale_Exception('Only full qualified locales can be used as default!');
267
}
268
+
269
+ if (($quality < 0.1) or ($quality > 100)) {
270
+ #require_once 'Zend/Locale/Exception.php';
271
+ throw new Zend_Locale_Exception("Quality must be between 0.1 and 100");
272
+ }
273
+
274
+ if ($quality > 1) {
275
+ $quality /= 100;
276
+ }
277
+
278
+ if (isset(self::$_localeData[(string) $locale]) === true) {
279
+ self::$_default = array((string) $locale => $quality);
280
} else {
281
+ $locale = explode('_', (string) $locale);
282
+ if (isset(self::$_localeData[$locale[0]]) === true) {
283
+ self::$_default = array($locale[0] => $quality);
284
+ } else {
285
+ #require_once 'Zend/Locale/Exception.php';
286
+ throw new Zend_Locale_Exception("Unknown locale '" . (string) $locale . "' can not be set as default!");
287
}
288
}
289
}
290
291
/**
292
* Expects the Systems standard locale
293
*
297
*
298
* @return array
299
*/
300
+ public static function getEnvironment()
301
{
302
+ if (self::$_environment !== null) {
303
+ return self::$_environment;
304
+ }
305
306
+ #require_once 'Zend/Locale/Data/Translation.php';
307
308
+ $language = setlocale(LC_ALL, 0);
309
+ $languages = explode(';', $language);
310
$languagearray = array();
311
312
foreach ($languages as $locale) {
313
if (strpos($locale, '=') !== false) {
314
$language = substr($locale, strpos($locale, '='));
315
$language = substr($language, 1);
316
}
317
318
+ if ($language !== 'C') {
319
if (strpos($language, '.') !== false) {
320
+ $language = substr($language, 0, (strpos($language, '.') - 1));
321
} else if (strpos($language, '@') !== false) {
322
+ $language = substr($language, 0, (strpos($language, '@') - 1));
323
}
324
+
325
$splitted = explode('_', $language);
326
+ $language = (string) $language;
327
+ if (isset(self::$_localeData[$language]) === true) {
328
$languagearray[$language] = 1;
329
if (strlen($language) > 4) {
330
$languagearray[substr($language, 0, 2)] = 1;
331
}
332
+
333
continue;
334
}
335
336
+ if (empty(Zend_Locale_Data_Translation::$localeTranslation[$splitted[0]]) === false) {
337
+ if (empty(Zend_Locale_Data_Translation::$localeTranslation[$splitted[1]]) === false) {
338
+ $languagearray[Zend_Locale_Data_Translation::$localeTranslation[$splitted[0]] . '_' .
339
+ Zend_Locale_Data_Translation::$localeTranslation[$splitted[1]]] = 1;
340
}
341
+
342
$languagearray[Zend_Locale_Data_Translation::$localeTranslation[$splitted[0]]] = 1;
343
}
344
}
345
}
346
+
347
+ self::$_environment = $languagearray;
348
return $languagearray;
349
}
350
357
*
358
* @return array - list of accepted languages including quality
359
*/
360
+ public static function getBrowser()
361
{
362
+ if (self::$_browser !== null) {
363
+ return self::$_browser;
364
+ }
365
366
+ $httplanguages = getenv('HTTP_ACCEPT_LANGUAGE');
367
+ $languages = array();
368
+ if (empty($httplanguages) === true) {
369
return $languages;
370
}
371
372
$accepted = preg_split('/,\s*/', $httplanguages);
373
374
foreach ($accepted as $accept) {
375
+ $match = null;
376
$result = preg_match('/^([a-z]{1,8}(?:[-_][a-z]{1,8})*)(?:;\s*q=(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3})?))?#x2F;i',
377
$accept, $match);
378
379
+ if ($result < 1) {
380
continue;
381
}
382
383
+ if (isset($match[2]) === true) {
384
$quality = (float) $match[2];
385
} else {
386
$quality = 1.0;
387
}
388
389
$countrys = explode('-', $match[1]);
390
+ $region = array_shift($countrys);
391
392
$country2 = explode('_', $region);
393
+ $region = array_shift($country2);
394
395
+ foreach ($countrys as $country) {
396
$languages[$region . '_' . strtoupper($country)] = $quality;
397
}
398
+
399
+ foreach ($country2 as $country) {
400
$languages[$region . '_' . strtoupper($country)] = $quality;
401
}
402
+
403
+ if ((isset($languages[$region]) === false) || ($languages[$region] < $quality)) {
404
$languages[$region] = $quality;
405
}
406
}
407
408
+ self::$_browser = $languages;
409
return $languages;
410
}
411
412
/**
413
* Sets a new locale
414
*
415
+ * @param string|Zend_Locale $locale (Optional) New locale to set
416
+ * @return void
417
*/
418
public function setLocale($locale = null)
419
{
420
+ $locale = self::_prepareLocale($locale);
421
422
+ if (isset(self::$_localeData[(string) $locale]) === false) {
423
+ $region = substr((string) $locale, 0, 3);
424
+ if (isset($region[2]) === true) {
425
+ if (($region[2] === '_') or ($region[2] === '-')) {
426
$region = substr($region, 0, 2);
427
}
428
}
429
+
430
+ if (isset(self::$_localeData[(string) $region]) === true) {
431
+ $this->_locale = $region;
432
} else {
433
+ $this->_locale = 'root';
434
}
435
} else {
436
+ $this->_locale = $locale;
437
}
438
}
439
440
/**
441
* Returns the language part of the locale
442
*
444
*/
445
public function getLanguage()
446
{
447
+ $locale = explode('_', $this->_locale);
448
return $locale[0];
449
}
450
451
/**
452
* Returns the region part of the locale if available
453
*
455
*/
456
public function getRegion()
457
{
458
+ $locale = explode('_', $this->_locale);
459
+ if (isset($locale[1]) === true) {
460
return $locale[1];
461
}
462
463
return false;
464
}
465
466
/**
467
* Return the accepted charset of the client
468
+ *
469
* @return string
470
*/
471
+ public static function getHttpCharset()
472
{
473
+ $httpcharsets = getenv('HTTP_ACCEPT_CHARSET');
474
475
$charsets = array();
476
if ($httpcharsets === false) {
478
}
479
480
$accepted = preg_split('/,\s*/', $httpcharsets);
481
+ foreach ($accepted as $accept) {
482
+ if (empty($accept) === true) {
483
continue;
484
}
485
486
+ if (strpos($accept, ';') !== false) {
487
+ $quality = (float) substr($accept, (strpos($accept, '=') + 1));
488
+ $pos = substr($accept, 0, strpos($accept, ';'));
489
+ $charsets[$pos] = $quality;
490
} else {
491
+ $quality = 1.0;
492
$charsets[$accept] = $quality;
493
}
494
}
495
496
return $charsets;
497
}
498
499
/**
500
* Returns true if both locales are equal
501
*
502
+ * @param Zend_Locale $object Locale to check for equality
503
* @return boolean
504
*/
505
+ public function equals(Zend_Locale $object)
506
{
507
+ if ($object->toString() === $this->toString()) {
508
return true;
509
}
510
511
return false;
512
}
513
514
/**
515
* Returns localized informations as array, supported are several
516
* types of informations.
517
* For detailed information about the types look into the documentation
518
*
519
+ * @param string $path (Optional) Type of information to return
520
+ * @param string|Zend_Locale $locale (Optional) Locale|Language for which this informations should be returned
521
+ * @param string $value (Optional) Value for detail list
522
+ * @return array Array with the wished information in the given language
523
*/
524
+ public static function getTranslationList($path = null, $locale = null, $value = null)
525
{
526
#require_once 'Zend/Locale/Data.php';
527
+ $locale = self::_prepareLocale($locale);
528
$result = Zend_Locale_Data::getList($locale, $path, $value);
529
+ if (empty($result) === true) {
530
return false;
531
}
532
+
533
return $result;
534
}
535
536
/**
537
* Returns an array with the name of all languages translated to the given language
538
*
539
+ * @param string|Zend_Locale $locale (Optional) Locale for language translation
540
+ * @return array
541
*/
542
+ public static function getLanguageTranslationList($locale = null)
543
{
544
+ return self::getTranslationList('language', $locale);
545
}
546
547
/**
548
* Returns an array with the name of all scripts translated to the given language
549
*
550
+ * @param string|Zend_Locale $locale (Optional) Locale for script translation
551
+ * @return array
552
*/
553
+ public static function getScriptTranslationList($locale = null)
554
{
555
+ return self::getTranslationList('script', $locale);
556
}
557
558
/**
559
* Returns an array with the name of all countries translated to the given language
560
*
561
+ * @param string|Zend_Locale $locale (Optional) Locale for country translation
562
+ * @return array
563
*/
564
+ public static function getCountryTranslationList($locale = null)
565
{
566
+ return self::getTranslationList('territory', $locale, 2);
567
}
568
569
/**
570
* Returns an array with the name of all territories translated to the given language
571
* All territories contains other countries.
572
*
573
+ * @param string|Zend_Locale $locale (Optional) Locale for territory translation
574
+ * @return array
575
*/
576
+ public static function getTerritoryTranslationList($locale = null)
577
{
578
+ return self::getTranslationList('territory', $locale, 1);
579
}
580
581
/**
582
* Returns a localized information string, supported are several types of informations.
583
* For detailed information about the types look into the documentation
584
*
585
+ * @param string $value Name to get detailed information about
586
+ * @param string $path (Optional) Type of information to return
587
+ * @param string|Zend_Locale $locale (Optional) Locale|Language for which this informations should be returned
588
+ * @return string|false The wished information in the given language
589
*/
590
+ public static function getTranslation($value = null, $path = null, $locale = null)
591
{
592
#require_once 'Zend/Locale/Data.php';
593
+ $locale = self::_prepareLocale($locale);
594
$result = Zend_Locale_Data::getContent($locale, $path, $value);
595
+ if (empty($result) === true) {
596
return false;
597
}
598
+
599
return $result;
600
}
601
602
/**
603
* Returns the localized language name
604
*
605
+ * @param string $value Name to get detailed information about
606
+ * @param string $locale (Optional) Locale for language translation
607
+ * @return array
608
*/
609
+ public static function getLanguageTranslation($value, $locale = null)
610
{
611
+ return self::getTranslation($value, 'language', $locale);
612
}
613
614
/**
615
* Returns the localized script name
616
*
617
+ * @param string $value Name to get detailed information about
618
+ * @param string $locale (Optional) locale for script translation
619
+ * @return array
620
*/
621
+ public static function getScriptTranslation($value, $locale = null)
622
{
623
+ return self::getTranslation($value, 'script', $locale);
624
}
625
626
/**
627
* Returns the localized country name
628
*
629
+ * @param string $value Name to get detailed information about
630
+ * @param string|Zend_Locale $locale (Optional) Locale for country translation
631
+ * @return array
632
*/
633
+ public static function getCountryTranslation($value, $locale = null)
634
{
635
+ return self::getTranslation($value, 'country', $locale);
636
}
637
638
/**
639
* Returns the localized territory name
640
* All territories contains other countries.
641
*
642
+ * @param string $value Name to get detailed information about
643
+ * @param string|Zend_Locale $locale (Optional) Locale for territory translation
644
+ * @return array
645
*/
646
+ public static function getTerritoryTranslation($value, $locale = null)
647
{
648
+ return self::getTranslation($value, 'territory', $locale);
649
}
650
651
/**
652
* Returns an array with translated yes strings
653
*
654
+ * @param string|Zend_Locale $locale (Optional) Locale for language translation (defaults to $this locale)
655
* @return array
656
*/
657
+ public static function getQuestion($locale = null)
658
{
659
#require_once 'Zend/Locale/Data.php';
660
+ $locale = self::_prepareLocale($locale);
661
+ $quest = Zend_Locale_Data::getList($locale, 'question');
662
+ $yes = explode(':', $quest['yes']);
663
+ $no = explode(':', $quest['no']);
664
$quest['yes'] = $yes[0];
665
$quest['yesarray'] = $yes;
666
$quest['no'] = $no[0];
667
$quest['noarray'] = $no;
668
+ $quest['yesexpr'] = self::_prepareQuestionString($yes);
669
+ $quest['noexpr'] = self::_prepareQuestionString($no);
670
671
return $quest;
672
}
673
674
/**
675
+ * Internal function for preparing the returned question regex string
676
*
677
+ * @param string $input Regex to parse
678
* @return string
679
*/
680
+ private static function _prepareQuestionString($input)
681
{
682
+ $regex = '';
683
+ if (is_array($input) === true) {
684
+ $regex = '^';
685
$start = true;
686
+ foreach ($input as $row) {
687
if ($start === false) {
688
+ $regex .= '|';
689
}
690
+
691
+ $start = false;
692
+ $regex .= '(';
693
+ $one = null;
694
if (strlen($row) > 2) {
695
$one = true;
696
}
697
+
698
foreach (str_split($row, 1) as $char) {
699
+ $regex .= '[' . $char;
700
+ $regex .= strtoupper($char) . ']';
701
if ($one === true) {
702
+ $one = false;
703
+ $regex .= '(';
704
}
705
}
706
+
707
if ($one === false) {
708
+ $regex .= ')';
709
}
710
+
711
+ $regex .= '?)';
712
}
713
}
714
+
715
return $regex;
716
}
717
718
/**
719
* Checks if a locale identifier is a real locale or not
720
* Examples:
721
* "en_XX" refers to "en", which returns true
722
* "XX_yy" refers to "root", which returns false
723
*
724
+ * @param string|Zend_Locale $locale Locale to check for
725
+ * @param boolean $strict (Optional) If true, no rerouting will be done when checking
726
+ * @param boolean $compatible (DEPRECIATED) Only for internal usage, brakes compatibility mode
727
+ * @return boolean If the locale is known dependend on the settings
728
*/
729
+ public static function isLocale($locale, $strict = false, $compatible = true)
730
{
731
+ try {
732
+ $locale = self::_prepareLocale($locale, $strict);
733
+ } catch (Zend_Locale_Exception $e) {
734
return false;
735
}
736
737
+ if (($compatible === true) and (self::$compatibilityMode === true)) {
738
+ trigger_error('You are running Zend_Locale in compatibility mode... please migrate your scripts', E_USER_NOTICE);
739
+ if (isset(self::$_localeData[$locale]) === true) {
740
+ return $locale;
741
+ } else if (!$strict) {
742
+ $locale = explode('_', $locale);
743
+ if (isset(self::$_localeData[$locale[0]]) === true) {
744
+ return $locale[0];
745
+ }
746
+ }
747
} else {
748
+ if (isset(self::$_localeData[$locale]) === true) {
749
+ return true;
750
+ } else if (!$strict) {
751
+ $locale = explode('_', $locale);
752
+ if (isset(self::$_localeData[$locale[0]]) === true) {
753
+ return true;
754
+ }
755
}
756
}
757
+
758
return false;
759
}
760
761
+ /**
762
+ * Finds the proper locale based on the input
763
+ * Checks if it exists, degrades it when necessary
764
+ * Detects registry locale and when all fails tries to detect a automatic locale
765
+ * Returns the found locale as string
766
+ *
767
+ * @param string $locale
768
+ * @throws Zend_Locale_Exception When the given locale is no locale or the autodetection fails
769
+ * @return string
770
+ */
771
+ public static function findLocale($locale = null)
772
+ {
773
+ if ($locale === null) {
774
+ #require_once 'Zend/Registry.php';
775
+ if (Zend_Registry::isRegistered('Zend_Locale')) {
776
+ $locale = Zend_Registry::get('Zend_Locale');
777
+ }
778
+ }
779
+
780
+ #require_once 'Zend/Locale.php';
781
+ if ($locale === null) {
782
+ $locale = new Zend_Locale();
783
+ }
784
+
785
+ if (!Zend_Locale::isLocale($locale, true, false)) {
786
+ if (!Zend_Locale::isLocale($locale, false, false)) {
787
+ #require_once 'Zend/Locale/Exception.php';
788
+ throw new Zend_Locale_Exception("The locale '$locale' is no known locale");
789
+ }
790
+
791
+ $locale = new Zend_Locale($locale);
792
+ }
793
+
794
+ if ($locale instanceof Zend_Locale) {
795
+ $locale = $locale->toString();
796
+ }
797
+
798
+ return $locale;
799
+ }
800
801
/**
802
* Returns a list of all known locales where the locale is the key
803
* Only real locales are returned, the internal locales 'root', 'auto', 'browser'
804
* and 'environment' are suppressed
805
+ *
806
+ * @return array List of all Locales
807
*/
808
public static function getLocaleList()
809
{
815
return $list;
816
}
817
818
+ /**
819
+ * Returns the set cache
820
+ *
821
+ * @return Zend_Cache_Core The set cache
822
+ */
823
+ public static function getCache()
824
+ {
825
+ #require_once 'Zend/Locale/Data.php';
826
+ $cache = Zend_Locale_Data::getCache();
827
+
828
+ return $cache;
829
+ }
830
831
/**
832
* Sets a cache
833
*
834
+ * @param Zend_Cache_Core $cache Cache to set
835
+ * @return void
836
*/
837
public static function setCache(Zend_Cache_Core $cache)
838
{
839
#require_once 'Zend/Locale/Data.php';
840
Zend_Locale_Data::setCache($cache);
841
}
842
+
843
+ /**
844
+ * Returns true when a cache is set
845
+ *
846
+ * @return boolean
847
+ */
848
+ public static function hasCache()
849
+ {
850
+ #require_once 'Zend/Locale/Data.php';
851
+ return Zend_Locale_Data::hasCache();
852
+ }
853
+
854
+ /**
855
+ * Removes any set cache
856
+ *
857
+ * @return void
858
+ */
859
+ public static function removeCache()
860
+ {
861
+ #require_once 'Zend/Locale/Data.php';
862
+ Zend_Locale_Data::removeCache();
863
+ }
864
+
865
+ /**
866
+ * Clears all set cache data
867
+ *
868
+ * @return void
869
+ */
870
+ public static function clearCache()
871
+ {
872
+ #require_once 'Zend/Locale/Data.php';
873
+ Zend_Locale_Data::clearCache();
874
+ }
875
+
876
+ /**
877
+ * Internal function, returns a single locale on detection
878
+ *
879
+ * @param string|Zend_Locale $locale (Optional) Locale to work on
880
+ * @param boolean $strict (Optional) Strict preparation
881
+ * @throws Zend_Locale_Exception When no locale is set which is only possible when the class was wrong extended
882
+ * @return string
883
+ */
884
+ private static function _prepareLocale($locale, $strict = false)
885
+ {
886
+ if ($locale instanceof Zend_Locale) {
887
+ $locale = $locale->toString();
888
+ }
889
+
890
+ if (is_array($locale)) {
891
+ return '';
892
+ }
893
+
894
+ if (empty(self::$_auto) === true) {
895
+ self::$_browser = self::getBrowser();
896
+ self::$_environment = self::getEnvironment();
897
+ self::$_breakChain = true;
898
+ self::$_auto = self::getBrowser() + self::getEnvironment() + self::getDefault();
899
+ }
900
+
901
+ if (!$strict) {
902
+ if ($locale === 'browser') {
903
+ $locale = self::$_browser;
904
+ }
905
+
906
+ if ($locale === 'environment') {
907
+ $locale = self::$_environment;
908
+ }
909
+
910
+ if ($locale === 'default') {
911
+ $locale = self::$_default;
912
+ }
913
+
914
+ if (($locale === 'auto') or ($locale === null)) {
915
+ $locale = self::$_auto;
916
+ }
917
+
918
+ if (is_array($locale) === true) {
919
+ $locale = key($locale);
920
+ }
921
+ }
922
+
923
+ // This can only happen when someone extends Zend_Locale and erases the default
924
+ if ($locale === null) {
925
+ #require_once 'Zend/Locale/Exception.php';
926
+ throw new Zend_Locale_Exception('Autodetection of Locale has been failed!');
927
+ }
928
+
929
+ if (strpos($locale, '-') !== false) {
930
+ $locale = strtr($locale, '-', '_');
931
+ }
932
+
933
+ return (string) $locale;
934
+ }
935
+
936
+ /**
937
+ * Search the locale automatically and return all used locales
938
+ * ordered by quality
939
+ *
940
+ * Standard Searchorder is Browser, Environment, Default
941
+ *
942
+ * @param string $searchorder (Optional) Searchorder
943
+ * @return array Returns an array of all detected locales
944
+ */
945
+ public static function getOrder($order = null)
946
+ {
947
+ switch ($order) {
948
+ case self::ENVIRONMENT:
949
+ self::$_breakChain = true;
950
+ $languages = self::getEnvironment() + self::getBrowser() + self::getDefault();
951
+ break;
952
+
953
+ case self::ZFDEFAULT:
954
+ self::$_breakChain = true;
955
+ $languages = self::getDefault() + self::getEnvironment() + self::getBrowser();
956
+ break;
957
+
958
+ default:
959
+ self::$_breakChain = true;
960
+ $languages = self::getBrowser() + self::getEnvironment() + self::getDefault();
961
+ break;
962
+ }
963
+
964
+ return $languages;
965
+ }
966
}
lib/Zend/Locale/Data.php CHANGED
@@ -16,18 +16,18 @@
16
* @package Zend_Locale
17
* @subpackage Data
18
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @version $Id: Data.php 8064 2008-02-16 10:58:39Z thomas $
20
* @license http://framework.zend.com/license/new-bsd New BSD License
21
*/
22
23
-
24
/**
25
* include needed classes
26
*/
27
#require_once 'Zend/Locale.php';
28
29
-
30
/**
31
* @category Zend
32
* @package Zend_Locale
33
* @subpackage Data
@@ -37,32 +37,29 @@
37
class Zend_Locale_Data
38
{
39
/**
40
- * locale files
41
*
42
* @var ressource
43
* @access private
44
*/
45
private static $_ldml = array();
46
47
-
48
/**
49
- * list of values which are collected
50
*
51
* @var array
52
* @access private
53
*/
54
private static $_list = array();
55
56
-
57
/**
58
- * internal cache for ldml values
59
*
60
* @var Zend_Cache_Core
61
* @access private
62
*/
63
private static $_cache = null;
64
65
-
66
/**
67
* Read the content from locale
68
*
@@ -274,15 +271,12 @@ class Zend_Locale_Data
274
$locale = new Zend_Locale();
275
}
276
277
- if ($locale instanceof Zend_Locale) {
278
- $locale = $locale->toString();
279
- }
280
-
281
- if (!($locale = Zend_Locale::isLocale($locale))) {
282
#require_once 'Zend/Locale/Exception.php';
283
- throw new Zend_Locale_Exception("Locale ($locale) is a unknown locale");
284
}
285
- return $locale;
286
}
287
288
/**
@@ -297,12 +291,12 @@ class Zend_Locale_Data
297
public static function getList($locale, $path, $value = false)
298
{
299
$locale = self::_checkLocale($locale);
300
-
301
if (isset(self::$_cache)) {
302
$val = $value;
303
if (is_array($value)) {
304
$val = implode('_' , $value);
305
}
306
$val = urlencode($val);
307
$id = strtr('Zend_LocaleL_' . $locale . '_' . $path . '_' . $val, array('-' => '_', '%' => '_', '+' => '_'));
308
if ($result = self::$_cache->load($id)) {
@@ -324,13 +318,13 @@ class Zend_Locale_Data
324
$temp = self::_getFile($locale, '/ldml/localeDisplayNames/territories/territory', 'type');
325
if ($value === 1) {
326
foreach($temp as $key => $value) {
327
- if (!is_numeric($key)) {
328
unset($temp[$key]);
329
}
330
}
331
} else if ($value === 2) {
332
foreach($temp as $key => $value) {
333
- if (is_numeric($key)) {
334
unset($temp[$key]);
335
}
336
}
@@ -558,8 +552,9 @@ class Zend_Locale_Data
558
foreach ($_temp as $key => $keyvalue) {
559
$val = self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $key . '\']/displayName', '', $key);
560
if (!isset($val[$key])) {
561
- $temp[$key] = " " . $key;
562
- } elseif (!array_key_exists($val[$key], $temp)) {
563
$temp[$val[$key]] = $key;
564
} else {
565
$temp[$val[$key]] .= " " . $key;
@@ -605,8 +600,9 @@ class Zend_Locale_Data
605
foreach ($_temp as $key => $keyvalue) {
606
$val = self::_getFile('supplementalData', '/supplementalData/currencyData/region[@iso3166=\'' . $key . '\']/currency', 'iso4217', $key);
607
if (!isset($val[$key])) {
608
- $temp[$key] = " " . $key;
609
- } elseif (!array_key_exists($val[$key], $temp)) {
610
$temp[$val[$key]] = $key;
611
} else {
612
$temp[$val[$key]] .= " " . $key;
@@ -630,7 +626,7 @@ class Zend_Locale_Data
630
foreach($_temp as $key => $found) {
631
$_temp3 = explode(" ", $found);
632
foreach($_temp3 as $found3) {
633
- if (!array_key_exists($found3, $temp)) {
634
$temp[$found3] = (string) $key;
635