问题描述
我正在考虑在PHP中使用 collators (我不是PHP专家).有没有一种方法可以知道/列出PHP中可用的所有整理器?我正在寻找类似于Java的 Collator.getAvailableLocales().谢谢.
I am considering using collators in PHP (I am no expert in PHP). Is there a way to know/list all collators available in PHP? I am looking for something similar to Java's Collator.getAvailableLocales(). Thanks.
推荐答案
我认为Collator
正在使用CLDR存储库中的语言环境信息.
I think the Collator
is using the locale information from the CLDR repository.
我从它是当前主干中编译了一个列表:
I compiled a list from it's current trunk:
af af_NA af_ZA ar ar_001 ar_AE
ar_BH ar_DZ ar_EG ar_IQ ar_JO ar_KW
ar_LB ar_LY ar_MA ar_OM ar_QA ar_SA
ar_SD ar_SY ar_TN ar_YE as as_IN
az az_Latn az_Latn_AZ be be_BY bg
bg_BG bn bn_BD bn_IN bs bs_BA
ca ca_ES chr chr_US cs cs_CZ
cy cy_GB da da_DK de de_AT
de_BE de_CH de_DE de_LI de_LU dz
ee ee_GH ee_TG el el_CY el_GR
en en_AS en_AU en_BB en_BE en_BM
en_BW en_BZ en_CA en_GB en_GU en_HK
en_IE en_IN en_JM en_MH en_MP en_MT
en_MU en_NA en_NZ en_PH en_PK en_SG
en_TT en_UM en_US en_US_POSIX en_VI en_ZA
en_ZW eo es es_419 es_AR es_BO
es_CL es_CO es_CR es_DO es_EC es_ES
es_GQ es_GT es_HN es_MX es_NI es_PA
es_PE es_PR es_PY es_SV es_US es_UY
es_VE et et_EE fa fa_AF fa_IR
fi fi_FI fil fil_PH fo fo_FO
fr fr_BE fr_BF fr_BI fr_BJ fr_BL
fr_CA fr_CD fr_CF fr_CG fr_CH fr_CI
fr_CM fr_DJ fr_FR fr_GA fr_GN fr_GP
fr_GQ fr_KM fr_LU fr_MC fr_MF fr_MG
fr_ML fr_MQ fr_NE fr_RE fr_RW fr_SN
fr_TD fr_TG ga ga_IE gu gu_IN
ha ha_Latn ha_Latn_GH ha_Latn_NE ha_Latn_NG haw
haw_US he he_IL hi hi_IN hr
hr_HR hu hu_HU hy hy_AM id
id_ID ig ig_NG is is_IS it
it_CH it_IT ja ja_JP ka ka_GE
kk kk_KZ kl kl_GL km km_KH
kn kn_IN ko ko_KR kok kok_IN
ky ky_KG ln ln_CD ln_CG lt
lt_LT lv lv_LV mk mk_MK ml
ml_IN mr mr_IN ms ms_BN ms_MY
mt mt_MT my my_MM nb nb_NO
nl nl_AW nl_BE nl_CW nl_NL nl_SX
nn nn_NO nso nso_ZA om om_ET
om_KE or or_IN pa pa_Arab pa_Arab_PK
pa_Guru pa_Guru_IN pl pl_PL ps ps_AF
pt pt_AO pt_BR pt_GW pt_MZ pt_PT
pt_ST ro ro_MD ro_RO ru ru_MD
ru_RU ru_UA se se_FI se_NO si
si_LK sk sk_SK sl sl_SI sq
sq_AL sr sr_Cyrl sr_Cyrl_BA sr_Cyrl_ME sr_Cyrl_RS
sr_Latn sr_Latn_BA sr_Latn_ME sr_Latn_RS st st_LS
st_ZA sv sv_FI sv_SE sw sw_KE
sw_TZ ta ta_IN ta_LK te te_IN
th th_TH tn tn_ZA to to_TO
tr tr_TR uk uk_UA ur ur_IN
ur_PK vi vi_VN wae wae_CH xh
xh_ZA yo yo_NG zh zh_Hans zh_Hans_CN
zh_Hans_SG zh_Hant zh_Hant_HK zh_Hant_MO zh_Hant_TW zu
zu_ZA
或分组:
af (af_NA, af_ZA)
ar (ar_001, ar_AE, ar_BH, ar_DZ, ar_EG, ar_IQ, ar_JO, ar_KW, ar_LB, ar_LY, ar_MA, ar_OM, ar_QA, ar_SA, ar_SD, ar_SY, ar_TN, ar_YE)
as (as_IN)
az (az_Latn, az_Latn_AZ)
be (be_BY)
bg (bg_BG)
bn (bn_BD, bn_IN)
bs (bs_BA)
ca (ca_ES)
cs (cs_CZ)
cy (cy_GB)
da (da_DK)
de (de_AT, de_BE, de_CH, de_DE, de_LI, de_LU)
dz
ee (ee_GH, ee_TG)
el (el_CY, el_GR)
en (en_AS, en_AU, en_BB, en_BE, en_BM, en_BW, en_BZ, en_CA, en_GB, en_GU, en_HK, en_IE, en_IN, en_JM, en_MH, en_MP, en_MT, en_MU, en_NA, en_NZ, en_PH, en_PK, en_SG, en_TT, en_UM, en_VI, en_ZA, en_ZW)
en_US
en_US_POSIX
eo
es (es_419, es_AR, es_BO, es_CL, es_CO, es_CR, es_DO, es_EC, es_ES, es_GQ, es_GT, es_HN, es_MX, es_NI, es_PA, es_PE, es_PR, es_PY, es_SV, es_US, es_UY, es_VE)
et (et_EE)
fa (fa_IR)
fa_AF
fi (fi_FI)
fil (fil_PH)
fo (fo_FO)
fr (fr_BE, fr_BF, fr_BI, fr_BJ, fr_BL, fr_CD, fr_CF, fr_CG, fr_CH, fr_CI, fr_CM, fr_DJ, fr_FR, fr_GA, fr_GN, fr_GP, fr_GQ, fr_KM, fr_LU, fr_MC, fr_MF, fr_MG, fr_ML, fr_MQ, fr_NE, fr_RE, fr_RW, fr_SN, fr_TD, fr_TG)
fr_CA
gu (gu_IN)
ha (ha_Latn, ha_Latn_GH, ha_Latn_NE, ha_Latn_NG)
haw (haw_US)
he (he_IL)
hi (hi_IN)
hr (hr_HR)
hu (hu_HU)
hy (hy_AM)
ig (ig_NG)
is (is_IS)
ja (ja_JP)
kk (kk_KZ)
kl (kl_GL)
km (km_KH)
kn (kn_IN)
ko (ko_KR)
kok (kok_IN)
ln (ln_CD, ln_CG)
lt (lt_LT)
lv (lv_LV)
mk (mk_MK)
ml (ml_IN)
mr (mr_IN)
mt (mt_MT)
my (my_MM)
nb (nb_NO)
nn (nn_NO)
nso (nso_ZA)
om (om_ET, om_KE)
or (or_IN)
pa (pa_Arab, pa_Arab_PK, pa_Guru, pa_Guru_IN)
pl (pl_PL)
ps (ps_AF)
ro (ro_RO, ro_MD)
root (chr, chr_US, ga, ga_IE, id, id_ID, it, it_CH, it_IT, ka, ka_GE, ky, ky_KG, ms, ms_BN, ms_MY, nl, nl_AW, nl_BE, nl_CW, nl_NL, nl_SX, pt, pt_AO, pt_BR, pt_GW, pt_MZ, pt_PT, pt_ST, st, st_LS, st_ZA, sw, sw_KE, sw_TZ, xh, xh_ZA, zu, zu_ZA)
ru (ru_MD, ru_RU, ru_UA)
se (se_FI, se_NO)
si (si_LK)
sk (sk_SK)
sl (sl_SI)
sq (sq_AL)
sr (sr_Cyrl, sr_Cyrl_BA, sr_Cyrl_ME, sr_Cyrl_RS)
sr_Latn (sr_Latn_RS, sr_Latn_BA, sr_Latn_ME)
sv (sv_FI, sv_SE)
ta (ta_IN, ta_LK)
te (te_IN)
th (th_TH)
tn (tn_ZA)
to (to_TO)
tr (tr_TR)
uk (uk_UA)
ur (ur_PK, ur_IN)
vi (vi_VN)
wae (wae_CH)
yo (yo_NG)
zh (zh_Hans, zh_Hans_CN, zh_Hans_SG)
zh_Hant (zh_Hant_HK, zh_Hant_MO, zh_Hant_TW)
您可以在文件名中看到基本语言环境,例如de.xml
,当您进入文件内部时,对这样的元素进行了罚款:
You can see the base locale in the filename, e.g. de.xml
, when you go inside the file, you fined an element like this one:
<collations validSubLocales="de_AT de_BE de_CH de_DE de_LI de_LU">
列出了其他子语言环境.文件中还提供了脚本和区域.
which lists additional Sublocales. Script and Territory is available in the file as well.
CLDR数据进入Intl(C),然后绑定到PHP Intl扩展之前,需要花费一些时间.因此,请与系统上的Intl库版本/绑定进行交叉检查.以防万一它与您的安装有所不同.
It takes some time until the CLDR data comes into Intl (C) which then is bind against PHP Intl extension. So cross check with the Intl library version / binding on your system. Just in case it differs a bit from your installation.
这篇关于PHP中可用的收集器列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!