2043 |
;; and Chinese are exceptions, which are listed in the |
;; and Chinese are exceptions, which are listed in the |
2044 |
;; non-standard section at the bottom of locale-language-names. |
;; non-standard section at the bottom of locale-language-names. |
2045 |
|
|
2046 |
; aa Afar |
("aa_DJ" . "Latin-1") ; Afar |
2047 |
; ab Abkhazian |
("aa" . "UTF-8") |
2048 |
|
;; ab Abkhazian |
2049 |
("af" . "Latin-1") ; Afrikaans |
("af" . "Latin-1") ; Afrikaans |
2050 |
("am" . "Ethiopic") ; Amharic |
("am" "Ethiopic" utf-8) ; Amharic |
2051 |
|
("an" . "Latin-9") ; Aragonese |
2052 |
; ar Arabic glibc uses 8859-6 |
; ar Arabic glibc uses 8859-6 |
2053 |
; as Assamese |
; as Assamese |
2054 |
; ay Aymara |
; ay Aymara |
2055 |
; az Azerbaijani |
("az" . "UTF-8") ; Azerbaijani |
2056 |
; ba Bashkir |
; ba Bashkir |
2057 |
("be" . "Belarusian") ; Belarusian [Byelorussian until early 1990s] |
("be" "Belarusian" cp1251) ; Belarusian [Byelorussian until early 1990s] |
2058 |
("bg" . "Bulgarian") ; Bulgarian |
("bg" "Bulgarian" cp1251) ; Bulgarian |
2059 |
; bh Bihari |
; bh Bihari |
2060 |
; bi Bislama |
; bi Bislama |
2061 |
; bn Bengali, Bangla |
("bn" . "UTF-8") ; Bengali, Bangla |
2062 |
("bo" . "Tibetan") |
("bo" . "Tibetan") |
2063 |
("br" . "Latin-1") ; Breton |
("br" . "Latin-1") ; Breton |
2064 |
("bs" . "Latin-2") ; Bosnian |
("bs" . "Latin-2") ; Bosnian |
2065 |
|
("byn" . "UTF-8") ; Bilin; Blin |
2066 |
("ca" . "Latin-1") ; Catalan |
("ca" . "Latin-1") ; Catalan |
2067 |
; co Corsican |
; co Corsican |
2068 |
("cs" . "Czech") |
("cs" "Czech" iso-8859-2) |
2069 |
("cy" . "Welsh") ; Welsh [glibc uses Latin-8. Did this change?] |
("cy" "Welsh" iso-8859-14) |
2070 |
("da" . "Latin-1") ; Danish |
("da" . "Latin-1") ; Danish |
2071 |
("de" . "German") |
("de" "German" iso-8859-1) |
2072 |
; dz Bhutani |
; dz Bhutani |
2073 |
("el" . "Greek") |
("el" "Greek" iso-8859-7) |
2074 |
;; Users who specify "en" explicitly typically want Latin-1, not ASCII. |
;; Users who specify "en" explicitly typically want Latin-1, not ASCII. |
2075 |
;; That's actually what the GNU locales define, modulo things like |
;; That's actually what the GNU locales define, modulo things like |
2076 |
;; en_IN -- fx. |
;; en_IN -- fx. |
2077 |
|
("en_IN" "English" utf-8) ; glibc uses utf-8 for English in India |
2078 |
("en" . "Latin-1") ; English |
("en" . "Latin-1") ; English |
2079 |
("eo" . "Latin-3") ; Esperanto |
("eo" . "Latin-3") ; Esperanto |
2080 |
("es" . "Spanish") |
("es" "Spanish" iso-8859-1) |
2081 |
("et" . "Latin-4") ; Estonian |
("et" . "Latin-1") ; Estonian |
2082 |
("eu" . "Latin-1") ; Basque |
("eu" . "Latin-1") ; Basque |
2083 |
; fa Persian glibc uses utf-8 |
("fa" . "UTF-8") ; Persian |
2084 |
("fi" . "Latin-1") ; Finnish |
("fi" . "Latin-1") ; Finnish |
2085 |
; fj Fiji |
("fj" . "Latin-1") ; Fiji |
2086 |
("fo" . "Latin-1") ; Faroese |
("fo" . "Latin-1") ; Faroese |
2087 |
("fr" . "French") ; French |
("fr" "French" iso-8859-1) ; French |
2088 |
("fy" . "Latin-1") ; Frisian |
("fy" . "Latin-1") ; Frisian |
2089 |
("ga" . "Latin-1") ; Irish Gaelic (new orthography) |
("ga" . "Latin-1") ; Irish Gaelic (new orthography) |
2090 |
("gd" . "Latin-1") ; Scots Gaelic |
("gd" . "Latin-9") ; Scots Gaelic |
2091 |
("gl" . "Latin-1") ; Galician |
("gez" "Ethiopic" utf-8) ; Geez |
2092 |
|
("gl" . "Latin-1") ; Gallegan; Galician |
2093 |
; gn Guarani |
; gn Guarani |
2094 |
; gu Gujarati |
("gu" . "UTF-8") ; Gujarati |
2095 |
("gv" . "Latin-8") ; Manx Gaelic glibc uses 8859-1 |
("gv" . "Latin-1") ; Manx Gaelic |
2096 |
; ha Hausa |
; ha Hausa |
2097 |
("he" . "Hebrew") |
("he" "Hebrew" iso-8859-8) |
2098 |
("hi" . "Devanagari") ; Hindi glibc uses utf-8 |
("hi" "Devanagari" utf-8) ; Hindi |
2099 |
("hr" . "Croatian") ; Croatian |
("hr" "Croatian" iso-8859-2) ; Croatian |
2100 |
("hu" . "Latin-2") ; Hungarian |
("hu" . "Latin-2") ; Hungarian |
2101 |
; hy Armenian |
; hy Armenian |
2102 |
; ia Interlingua |
; ia Interlingua |
2104 |
; ie Interlingue |
; ie Interlingue |
2105 |
; ik Inupiak |
; ik Inupiak |
2106 |
("is" . "Latin-1") ; Icelandic |
("is" . "Latin-1") ; Icelandic |
2107 |
("it" . "Italian") ; Italian |
("it" "Italian" iso-8859-1) ; Italian |
2108 |
; iu Inuktitut |
; iu Inuktitut |
2109 |
("ja" . "Japanese") |
("iw" "Hebrew" iso-8859-8) |
2110 |
|
("ja" "Japanese" euc-jp) |
2111 |
; jw Javanese |
; jw Javanese |
2112 |
("ka" . "Georgian") ; Georgian |
("ka" "Georgian" georgian-ps) ; Georgian |
2113 |
; kk Kazakh |
; kk Kazakh |
2114 |
("kl" . "Latin-1") ; Greenlandic |
("kl" . "Latin-1") ; Greenlandic |
2115 |
; km Cambodian |
; km Cambodian |
2116 |
; kn Kannada |
("kn" "Kannada" utf-8) |
2117 |
("ko" . "Korean") |
("ko" "Korean" euc-kr) |
2118 |
; ks Kashmiri |
; ks Kashmiri |
2119 |
; ku Kurdish |
; ku Kurdish |
2120 |
("kw" . "Latin-1") ; Cornish |
("kw" . "Latin-1") ; Cornish |
2121 |
; ky Kirghiz |
; ky Kirghiz |
2122 |
("la" . "Latin-1") ; Latin |
("la" . "Latin-1") ; Latin |
2123 |
("lb" . "Latin-1") ; Luxemburgish |
("lb" . "Latin-1") ; Luxemburgish |
2124 |
|
("lg" . "Laint-6") ; Ganda |
2125 |
; ln Lingala |
; ln Lingala |
2126 |
("lo" . "Lao") ; Laothian |
("lo" "Lao" utf-8) ; Laothian |
2127 |
("lt" . "Lithuanian") |
("lt" "Lithuanian" iso-8859-13) |
2128 |
("lv" . "Latvian") ; Latvian, Lettish |
("lv" . "Latvian") ; Latvian, Lettish |
2129 |
; mg Malagasy |
; mg Malagasy |
2130 |
("mi" . "Latin-7") ; Maori |
("mi" . "Latin-7") ; Maori |
2131 |
("mk" . "Cyrillic-ISO") ; Macedonian |
("mk" "Cyrillic-ISO" iso-8859-5) ; Macedonian |
2132 |
; ml Malayalam |
("ml" "Malayalam" utf-8) |
2133 |
; mn Mongolian |
("mn" . "UTF-8") ; Mongolian |
2134 |
; mo Moldavian |
; mo Moldavian |
2135 |
("mr" . "Devanagari") ; Marathi glibc uses utf-8 |
("mr" "Devanagari" utf-8) ; Marathi |
2136 |
("ms" . "Latin-1") ; Malay |
("ms" . "Latin-1") ; Malay |
2137 |
("mt" . "Latin-3") ; Maltese |
("mt" . "Latin-3") ; Maltese |
2138 |
; my Burmese |
; my Burmese |
2139 |
; na Nauru |
; na Nauru |
2140 |
("ne" . "Devanagari") ; Nepali |
("nb" . "Latin-1") ; Norwegian |
2141 |
("nl" . "Dutch") |
("ne" "Devanagari" utf-8) ; Nepali |
2142 |
|
("nl" "Dutch" iso-8859-1) |
2143 |
("no" . "Latin-1") ; Norwegian |
("no" . "Latin-1") ; Norwegian |
2144 |
("oc" . "Latin-1") ; Occitan |
("oc" . "Latin-1") ; Occitan |
2145 |
; om (Afan) Oromo |
("om_ET" . "UTF-8") ; (Afan) Oromo |
2146 |
|
("om" . "Latin-1") ; (Afan) Oromo |
2147 |
; or Oriya |
; or Oriya |
2148 |
; pa Punjabi |
("pa" . "UTF-8") ; Punjabi |
2149 |
("pl" . "Latin-2") ; Polish |
("pl" . "Latin-2") ; Polish |
2150 |
; ps Pashto, Pushto |
; ps Pashto, Pushto |
2151 |
("pt" . "Latin-1") ; Portuguese |
("pt" . "Latin-1") ; Portuguese |
2152 |
; qu Quechua |
; qu Quechua |
2153 |
("rm" . "Latin-1") ; Rhaeto-Romanic |
("rm" . "Latin-1") ; Rhaeto-Romanic |
2154 |
; rn Kirundi |
; rn Kirundi |
2155 |
("ro" . "Romanian") |
("ro" "Romanian" iso-8859-2) |
2156 |
("ru.*[_.]koi8" . "Russian") |
("ru_RU" "Russian" iso-8859-5) |
2157 |
("ru" . "Cyrillic-ISO") ; Russian |
("ru_UA" "Russian" koi8-u) |
2158 |
; rw Kinyarwanda |
; rw Kinyarwanda |
2159 |
("sa" . "Devanagari") ; Sanskrit |
("sa" . "Devanagari") ; Sanskrit |
2160 |
; sd Sindhi |
; sd Sindhi |
2161 |
; se Northern Sami |
("se" . "UTF-8") ; Northern Sami |
2162 |
; sg Sangho |
; sg Sangho |
2163 |
("sh" . "Latin-2") ; Serbo-Croatian |
("sh" . "Latin-2") ; Serbo-Croatian |
2164 |
; si Sinhalese |
; si Sinhalese |
2165 |
("sk" . "Slovak") |
("sid" . "UTF-8") ; Sidamo |
2166 |
("sl" . "Slovenian") |
("sk" "Slovak" iso-8859-2) |
2167 |
|
("sl" "Slovenian" iso-8859-2) |
2168 |
; sm Samoan |
; sm Samoan |
2169 |
; sn Shona |
; sn Shona |
2170 |
; so Somali |
("so_ET" "UTF-8") ; Somali |
2171 |
|
("so" "Latin-1") ; Somali |
2172 |
("sq" . "Latin-1") ; Albanian |
("sq" . "Latin-1") ; Albanian |
2173 |
|
("sr_YU@cyrillic" . "Cyrillic-ISO") ; Serbian (Cyrillic alphabet) |
2174 |
("sr" . "Latin-2") ; Serbian (Latin alphabet) |
("sr" . "Latin-2") ; Serbian (Latin alphabet) |
|
("sr_YU@cyrillic" . "Cyrillic-ISO") ; per glibc |
|
2175 |
; ss Siswati |
; ss Siswati |
2176 |
; st Sesotho |
("st" . "Latin-1") ; Sesotho |
2177 |
; su Sundanese |
; su Sundanese |
2178 |
("sv" . "Swedish") ; Swedish |
("sv" "Swedish" iso-8859-1) ; Swedish |
2179 |
("sw" . "Latin-1") ; Swahili |
("sw" . "Latin-1") ; Swahili |
2180 |
; ta Tamil glibc uses utf-8 |
("ta" "Tamil" utf-8) |
2181 |
; te Telugu glibc uses utf-8 |
("te" . "UTF-8") ; Telugu |
2182 |
("tg" . "Tajik") |
("tg" "Tajik" koi8-t) |
2183 |
("th" . "Thai") |
("th" "Thai" tis-620) |
2184 |
; ti Tigrinya |
("ti" "Ethiopic" utf-8) ; Tigrinya |
2185 |
|
("tig_ER" . "UTF-8") ; Tigre |
2186 |
; tk Turkmen |
; tk Turkmen |
2187 |
("tl" . "Latin-1") ; Tagalog |
("tl" . "Latin-1") ; Tagalog |
2188 |
; tn Setswana |
; tn Setswana |
2189 |
; to Tonga |
; to Tonga |
2190 |
("tr" . "Turkish") |
("tr" "Turkish" iso-8859-9) |
2191 |
; ts Tsonga |
; ts Tsonga |
2192 |
; tt Tatar |
("tt" . "UTF-8") ; Tatar |
2193 |
; tw Twi |
; tw Twi |
2194 |
; ug Uighur |
; ug Uighur |
2195 |
("uk" . "Ukrainian") ; Ukrainian |
("uk" "Ukrainian" koi8-u) |
2196 |
; ur Urdu glibc uses utf-8 |
("ur" . "UTF-8") ; Urdu |
2197 |
|
("uz_UZ@cyrillic" . "UTF-8"); Uzbek |
2198 |
("uz" . "Latin-1") ; Uzbek |
("uz" . "Latin-1") ; Uzbek |
2199 |
("vi" . "Vietnamese") ; glibc uses utf-8 |
("vi" "Vietnamese" utf-8) |
2200 |
; vo Volapuk |
; vo Volapuk |
2201 |
("wa" . "Latin-1") ; Walloon |
("wa" . "Latin-1") ; Walloon |
2202 |
; wo Wolof |
; wo Wolof |
2203 |
; xh Xhosa |
("xh" . "Latin-1") ; Xhosa |
2204 |
("yi" . "Windows-1255") ; Yiddish |
("yi" . "Windows-1255") ; Yiddish |
2205 |
; yo Yoruba |
; yo Yoruba |
2206 |
; za Zhuang |
; za Zhuang |
2207 |
|
("zh_HK" . "Chinese-Big5") |
2208 |
; glibc: |
("zh_TW" . "Chinese-Big5") |
2209 |
|
("zh_CN" . "Chinese-GB") |
2210 |
|
("zh" . "Chinese-GB") |
2211 |
; zh_CN.GB18030/GB18030 \ |
; zh_CN.GB18030/GB18030 \ |
2212 |
; zh_CN.GBK/GBK \ |
; zh_CN.GBK/GBK \ |
2213 |
; zh_HK/BIG5-HKSCS \ |
; zh_HK/BIG5-HKSCS \ |
2214 |
|
("zu" . "Latin-1") ; Zulu |
|
("zh.*[._]big5" . "Chinese-BIG5") |
|
|
("zh.*[._]gbk" . nil) ; Solaris 2.7; has gbk-0 as well as GB 2312.1980-0 |
|
|
("zh_tw" . "Chinese-CNS") ; glibc uses big5 |
|
|
("zh_tw[._]euc-tw" . "Chinese-EUC-TW") |
|
|
("zh" . "Chinese-GB") |
|
|
; zu Zulu |
|
2215 |
|
|
2216 |
;; ISO standard locales |
;; ISO standard locales |
2217 |
("c$" . "ASCII") |
("c$" . "ASCII") |
2231 |
("chs" . "Chinese-GB") ; MS Windows Chinese Simplified |
("chs" . "Chinese-GB") ; MS Windows Chinese Simplified |
2232 |
("cht" . "Chinese-BIG5") ; MS Windows Chinese Traditional |
("cht" . "Chinese-BIG5") ; MS Windows Chinese Traditional |
2233 |
)) |
)) |
2234 |
"List of pairs of locale regexps and language names. |
"Alist of locale regexps vs the corresponding languages and coding systems. |
2235 |
The first element whose locale regexp matches the start of a downcased locale |
Each element has these form: |
2236 |
specifies the language name corresponding to that locale. |
\(LOCALE-REGEXP LANG-ENV CODING-SYSTEM) |
2237 |
If the language name is nil, there is no corresponding language environment.") |
The first element whose LOCALE-REGEXP matches the start of a |
2238 |
|
downcased locale specifies the LANG-ENV \(language environtment) |
2239 |
|
and CODING-SYSTEM corresponding to that locale. If there is no |
2240 |
|
appropriate language environment, the element may have this form: |
2241 |
|
\(LOCALE-REGEXP . LANG-ENV) |
2242 |
|
In this case, LANG-ENV is one of generic language environments for an |
2243 |
|
specific encoding such as \"Latin-1\" and \"UTF-8\".") |
2244 |
|
|
2245 |
(defconst locale-charset-language-names |
(defconst locale-charset-language-names |
2246 |
(purecopy |
(purecopy |
2258 |
"List of pairs of locale regexps and charset language names. |
"List of pairs of locale regexps and charset language names. |
2259 |
The first element whose locale regexp matches the start of a downcased locale |
The first element whose locale regexp matches the start of a downcased locale |
2260 |
specifies the language name whose charset corresponds to that locale. |
specifies the language name whose charset corresponds to that locale. |
2261 |
This language name is used if its charsets disagree with the charsets of |
This language name is used if the locale is not listed in |
2262 |
the language name that would otherwise be used for this locale.") |
`locale-language-names'") |
2263 |
|
|
2264 |
(defconst locale-preferred-coding-systems |
(defconst locale-preferred-coding-systems |
2265 |
(purecopy |
(purecopy |
2266 |
'(("ja.*[._]euc" . japanese-iso-8bit) |
'((".*8859[-_]?1\\>" . iso-8859-1) |
2267 |
|
(".*8859[-_]?2\\>" . iso-8859-2) |
2268 |
|
(".*8859[-_]?3\\>" . iso-8859-3) |
2269 |
|
(".*8859[-_]?4\\>" . iso-8859-4) |
2270 |
|
(".*8859[-_]?9\\>" . iso-8859-9) |
2271 |
|
(".*8859[-_]?14\\>" . iso-8859-14) |
2272 |
|
(".*8859[-_]?15\\>" . iso-8859-15) |
2273 |
|
(".*utf\\(?:-?8\\)?" . utf-8) |
2274 |
|
;; utf-8@euro exists, so put this after utf-8. (@euro really |
2275 |
|
;; specifies the currency, rather than the charset.) |
2276 |
|
(".*@euro" . iso-8859-15) |
2277 |
|
("koi8-?r" . koi8-r) |
2278 |
|
("koi8-?u" . koi8-u) |
2279 |
|
("tcvn" . tcvn) |
2280 |
|
("big5" . big5) |
2281 |
|
("euc-?tw" . euc-tw) |
2282 |
|
;; We don't support GBK, but as it is upper compatible with |
2283 |
|
;; GB-2312, we setup the default coding system to gb2312. |
2284 |
|
("gbk" . gb2312) |
2285 |
|
;; We don't support BIG5-HKSCS, but as it is upper compatible with |
2286 |
|
;; BIG5, we setup the default coding system to big5. |
2287 |
|
("big5hkscs" . big5) |
2288 |
|
("ja.*[._]euc" . japanese-iso-8bit) |
2289 |
("ja.*[._]jis7" . iso-2022-jp) |
("ja.*[._]jis7" . iso-2022-jp) |
2290 |
("ja.*[._]pck" . japanese-shift-jis) |
("ja.*[._]pck" . japanese-shift-jis) |
2291 |
("ja.*[._]sjis" . japanese-shift-jis) |
("ja.*[._]sjis" . japanese-shift-jis) |
2292 |
("jpn" . japanese-shift-jis) ; MS-Windows uses this. |
("jpn" . japanese-shift-jis) ; MS-Windows uses this. |
2293 |
(".*[._]utf" . utf-8))) |
)) |
2294 |
"List of pairs of locale regexps and preferred coding systems. |
"List of pairs of locale regexps and preferred coding systems. |
2295 |
The first element whose locale regexp matches the start of a downcased locale |
The first element whose locale regexp matches the start of a downcased locale |
2296 |
specifies the coding system to prefer when using that locale.") |
specifies the coding system to prefer when using that locale. |
2297 |
|
This coding system is used if the locale specifies a specific charset.") |
2298 |
|
|
2299 |
(defun locale-name-match (key alist) |
(defun locale-name-match (key alist) |
2300 |
"Search for KEY in ALIST, which should be a list of regexp-value pairs. |
"Search for KEY in ALIST, which should be a list of regexp-value pairs. |
2424 |
(locale-charset-to-coding-system |
(locale-charset-to-coding-system |
2425 |
(match-string 1 locale))))))) |
(match-string 1 locale))))))) |
2426 |
|
|
2427 |
;; Give preference to charset-language-name over language-name. |
(if (consp language-name) |
2428 |
(if (and charset-language-name |
;; locale-language-names specify both lang-env and coding. |
2429 |
(not |
;; But, what specified in locale-preferred-coding-systems |
2430 |
(equal (get-language-info language-name 'charset) |
;; has higher priority. |
2431 |
(get-language-info charset-language-name 'charset)))) |
(setq coding-system (or coding-system |
2432 |
(setq language-name charset-language-name)) |
(nth 1 language-name)) |
2433 |
|
language-name (car language-name)) |
2434 |
|
;; Otherwise, if locale is not listed in locale-language-names, |
2435 |
|
;; use what listed in locale-charset-language-names. |
2436 |
|
(if (not language-name) |
2437 |
|
(setq language-name charset-language-name))) |
2438 |
|
|
2439 |
(when language-name |
(when language-name |
2440 |
|
|
2460 |
(setq locale-coding-system |
(setq locale-coding-system |
2461 |
(car (get-language-info language-name 'coding-priority)))) |
(car (get-language-info language-name 'coding-priority)))) |
2462 |
|
|
2463 |
(when coding-system |
(when (and coding-system |
2464 |
|
(not (coding-system-equal coding-system |
2465 |
|
locale-coding-system))) |
2466 |
(prefer-coding-system coding-system) |
(prefer-coding-system coding-system) |
2467 |
(setq locale-coding-system coding-system)))) |
(setq locale-coding-system coding-system)))) |
2468 |
|
|