On Dec 13, 2006, at 4:46 PM, Ken Thomases wrote:
Wait, wait...
On Dec 12, 2006, at 6:55 AM, Pierre d'Herbemont wrote:
- all_locales = CFLocaleCopyAvailableLocaleIdentifiers();
- preferred_locales = CFBundleCopyLocalizationsForPreferences
( all_locales, NULL );
I thought I explained that exactly the above combination of calls produces unusable results. For example, for me it produces "en_ZW" -- English (Zimbabwe). In System Preferences, I have set "English" (no country) as my preferred language and U.S. for other locale settings.
In other words, it is picking a random country.
Ok, sorry for misreading, I though you get the random country with the previous 'opendir' code.
But it is weird: here on Mac OS X 10.4.8 CFLocaleCopyAvailableLocaleIdentifiers() returns [2], which contains 'en', and with "defaults read -g AppleLanguages" reporting [1], I get user_language_string_ref pointing 'en'. I don't understand if CFBundleCopyLocalizationsForPreferences does a bseach, why 'en' is not matched on your system.
If it is really picking a random country, I think we should directly get user_language_string_ref from the preferences.
Thanks,
Pierre.
[1] (en, fr, es, de, ja, it, nl, sv, nb, da, fi, pt, "zh-Hans", "zh- Hant", ko) [2] ( af, "af_ZA", am, "am_ET", ar, "ar_AE", "ar_BH", "ar_DZ", "ar_EG", "ar_IN", "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", be, "be_BY", bg, "bg_BG", bn, "bn_IN", ca, "ca_ES", cs, "cs_CZ", cy, "cy_GB", da, "da_DK", de, "de_AT", "de_BE", "de_CH", "de_DE", "de_LU", el, "el_GR", en, "en_AU", "en_BE", "en_BW", "en_CA", "en_GB", "en_HK", "en_IE", "en_IN", "en_MT", "en_NZ", "en_PH", "en_PK", "en_SG", "en_US", "en_US_POSIX", "en_VI", "en_ZA", "en_ZW", eo, es, "es_AR", "es_BO", "es_CL", "es_CO", "es_CR", "es_DO", "es_EC", "es_ES", "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", eu, "eu_ES", fa, "fa_AF", "fa_IR", fi, "fi_FI", fo, "fo_FO", fr, "fr_BE", "fr_CA", "fr_CH", "fr_FR", "fr_LU", ga, "ga_IE", gl, "gl_ES", gu, "gu_IN", gv, "gv_GB", haw, "haw_US", he, "he_IL", hi, "hi_IN", hr, "hr_HR", hu, "hu_HU", hy, "hy_AM", "hy_AM_REVISED", id, "id_ID", is, "is_IS", it, "it_CH", "it_IT", ja, "ja_JP", kk, "kk_KZ", kl, "kl_GL", kn, "kn_IN", ko, "ko_KR", kok, "kok_IN", kw, "kw_GB", lt, "lt_LT", lv, "lv_LV", mk, "mk_MK", ml, "ml_IN", mr, "mr_IN", ms, "ms_BN", "ms_MY", mt, "mt_MT", nb, "nb_NO", nl, "nl_BE", "nl_NL", nn, "nn_NO", om, "om_ET", "om_KE", or, "or_IN", pa, "pa_IN", pl, "pl_PL", ps, "ps_AF", pt, "pt_BR", "pt_PT", ro, "ro_RO", ru, "ru_RU", "ru_UA", sk, "sk_SK", sl, "sl_SI", so, "so_DJ", "so_ET", "so_KE", "so_SO", sq, "sq_AL", sr, "sr_Cyrl", "sr_Cyrl_YU", "sr_Latn", "sr_Latn_YU", "sr_YU", sv, "sv_FI", "sv_SE", sw, "sw_KE", "sw_TZ", ta, "ta_IN", te, "te_IN", th, "th_TH", ti, "ti_ER", "ti_ET", tr, "tr_TR", uk, "uk_UA", vi, "vi_VN", zh, "zh_Hans", "zh_Hans_CN", "zh_Hans_SG", "zh_Hant", "zh_Hant_HK", "zh_Hant_MO", "zh_Hant_TW" )