1 /***************************************************************************
3 language options for kvoctrain
5 -----------------------------------------------------------------------
9 copyright :(C) 2005 Peter Hedlund
11 email : peter@peterandlinda.com
13 -----------------------------------------------------------------------
15 ***************************************************************************/
17 /***************************************************************************
19 * This program is free software; you can redistribute it and/or modify *
20 * it under the terms of the GNU General Public License as published by *
21 * the Free Software Foundation; either version 2 of the License, or *
22 * (at your option) any later version. *
24 ***************************************************************************/
26 //based on code copyright (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
28 #include <qpushbutton.h>
29 #include <qlineedit.h>
31 #include <qfileinfo.h>
33 #include <kapplication.h>
35 #include <kcombobox.h>
36 #include <dcopclient.h>
37 #include <kstandarddirs.h>
38 #include <kfiledialog.h>
39 #include <kmessagebox.h>
41 #include "languageoptions.h"
42 #include "kvoctraincore.h"
43 #include "languagesettings.h"
46 // automatically extracted from http://www.loc.gov/standards/iso639-2/englangn.html
47 // with .../tools/extractlang
49 struct KV_ISO639_Code
{
55 // german language names at:
56 // http://www.rn.inf.tu-dresden.de/scripts_lsrn/lehre/rnd/www/iso639.htm
58 KV_ISO639_Code kv_iso639_1
[] = {
59 {"aa", "aar", I18N_NOOP("Afar")},
60 {"ab", "abk", I18N_NOOP("Abkhazian")},
61 {"ae", "ave", I18N_NOOP("Avestan")},
62 {"af", "afr", I18N_NOOP("Afrikaans")},
63 {"am", "amh", I18N_NOOP("Amharic")},
64 {"ar", "ara", I18N_NOOP("Arabic")},
65 {"as", "asm", I18N_NOOP("Assamese")},
66 {"ay", "aym", I18N_NOOP("Aymara")},
67 {"az", "aze", I18N_NOOP("Azerbaijani")},
68 {"ba", "bak", I18N_NOOP("Bashkir")},
69 {"be", "bel", I18N_NOOP("Belarusian")},
70 {"bg", "bul", I18N_NOOP("Bulgarian")},
71 {"bh", "bih", I18N_NOOP("Bihari")},
72 {"bi", "bis", I18N_NOOP("Bislama")},
73 {"bn", "ben", I18N_NOOP("Bengali")},
74 {"bo", "tib", I18N_NOOP("Tibetan")},
75 {"br", "bre", I18N_NOOP("Breton")},
76 {"bs", "bos", I18N_NOOP("Bosnian")},
77 {"ca", "cat", I18N_NOOP("Catalan")},
78 {"ce", "che", I18N_NOOP("Chechen")},
79 {"ch", "cha", I18N_NOOP("Chamorro")},
80 {"co", "cos", I18N_NOOP("Corsican")},
81 {"cs", "cze", I18N_NOOP("Czech")},
82 {"cu", "chu", I18N_NOOP("Church Slavic")},
83 {"cv", "chv", I18N_NOOP("Chuvash")},
84 {"cy", "wel", I18N_NOOP("Welsh")},
85 {"da", "dan", I18N_NOOP("Danish")},
86 {"de", "ger", I18N_NOOP("German")},
87 {"dz", "dzo", I18N_NOOP("Dzongkha")},
88 {"el", "gre", I18N_NOOP("Greek")},
89 {"en", "eng", I18N_NOOP("English")},
90 {"eo", "epo", I18N_NOOP("Esperanto")},
91 {"es", "spa", I18N_NOOP("Spanish")},
92 {"et", "est", I18N_NOOP("Estonian")},
93 {"eu", "baq", I18N_NOOP("Basque")},
94 {"fa", "per", I18N_NOOP("Persian")},
95 {"fi", "fin", I18N_NOOP("Finnish")},
96 {"fj", "fij", I18N_NOOP("Fijian")},
97 {"fo", "fao", I18N_NOOP("Faroese")},
98 {"fr", "fre", I18N_NOOP("French")},
99 {"fy", "fry", I18N_NOOP("Frisian")},
100 {"ga", "gle", I18N_NOOP("Irish")},
101 {"gd", "gla", I18N_NOOP("Gaelic")},
102 {"gd", "gla", I18N_NOOP("Scottish Gaelic")},
103 {"gl", "glg", I18N_NOOP("Gallegan")},
104 {"gn", "grn", I18N_NOOP("Guarani")},
105 {"gu", "guj", I18N_NOOP("Gujarati")},
106 {"gv", "glv", I18N_NOOP("Manx")},
107 {"ha", "hau", I18N_NOOP("Hausa")},
108 {"he", "heb", I18N_NOOP("Hebrew")},
109 {"hi", "hin", I18N_NOOP("Hindi")},
110 {"ho", "hmo", I18N_NOOP("Hiri Motu")},
111 {"hr", "scr", I18N_NOOP("Croatian")},
112 {"hu", "hun", I18N_NOOP("Hungarian")},
113 {"hy", "arm", I18N_NOOP("Armenian")},
114 {"hz", "her", I18N_NOOP("Herero")},
115 {"id", "ind", I18N_NOOP("Indonesian")},
116 {"ie", "ile", I18N_NOOP("Interlingue")},
117 {"ik", "ipk", I18N_NOOP("Inupiaq")},
118 {"is", "ice", I18N_NOOP("Icelandic")},
119 {"it", "ita", I18N_NOOP("Italian")},
120 {"iu", "iku", I18N_NOOP("Inuktitut")},
121 {"ja", "jpn", I18N_NOOP("Japanese")},
122 {"jv", "jav", I18N_NOOP("Javanese")},
123 {"ka", "geo", I18N_NOOP("Georgian")},
124 {"ki", "kik", I18N_NOOP("Kikuyu")},
125 {"kj", "kua", I18N_NOOP("Kuanyama")},
126 {"kk", "kaz", I18N_NOOP("Kazakh")},
127 {"kl", "kal", I18N_NOOP("Kalaallisut")},
128 {"km", "khm", I18N_NOOP("Khmer")},
129 {"kn", "kan", I18N_NOOP("Kannada")},
130 {"ko", "kor", I18N_NOOP("Korean")},
131 {"ks", "kas", I18N_NOOP("Kashmiri")},
132 {"ku", "kur", I18N_NOOP("Kurdish")},
133 {"kv", "kom", I18N_NOOP("Komi")},
134 {"kw", "cor", I18N_NOOP("Cornish")},
135 {"ky", "kir", I18N_NOOP("Kirghiz")},
136 {"la", "lat", I18N_NOOP("Latin")},
137 {"lb", "ltz", I18N_NOOP("Letzeburgesch")},
138 {"ln", "lin", I18N_NOOP("Lingala")},
139 {"lo", "lao", I18N_NOOP("Lao")},
140 {"lt", "lit", I18N_NOOP("Lithuanian")},
141 {"lv", "lav", I18N_NOOP("Latvian")},
142 {"mg", "mlg", I18N_NOOP("Malagasy")},
143 {"mh", "mah", I18N_NOOP("Marshall")},
144 {"mi", "mao", I18N_NOOP("Maori")},
145 {"mk", "mac", I18N_NOOP("Macedonian")},
146 {"ml", "mal", I18N_NOOP("Malayalam")},
147 {"mn", "mon", I18N_NOOP("Mongolian")},
148 {"mo", "mol", I18N_NOOP("Moldavian")},
149 {"mr", "mar", I18N_NOOP("Marathi")},
150 {"ms", "may", I18N_NOOP("Malay")},
151 {"mt", "mlt", I18N_NOOP("Maltese")},
152 {"my", "bur", I18N_NOOP("Burmese")},
153 {"na", "nau", I18N_NOOP("Nauru")},
154 {"nb", "nob", I18N_NOOP("Bokmål")},
155 {"nd", "nde", I18N_NOOP("Ndebele, North")},
156 {"ne", "nep", I18N_NOOP("Nepali")},
157 {"ng", "ndo", I18N_NOOP("Ndonga")},
158 {"nl", "dut", I18N_NOOP("Dutch")},
159 {"nn", "nno", I18N_NOOP("Norwegian Nynorsk")},
160 {"no", "nor", I18N_NOOP("Norwegian")},
161 {"nr", "nbl", I18N_NOOP("Ndebele, South")},
162 {"nv", "nav", I18N_NOOP("Navajo")},
163 {"ny", "nya", I18N_NOOP("Chichewa")},
164 {"ny", "nya", I18N_NOOP("Nyanja")},
165 {"oc", "oci", I18N_NOOP("Occitan")},
166 {"oc", "oci", I18N_NOOP("Provencal")},
167 {"om", "orm", I18N_NOOP("Oromo")},
168 {"or", "ori", I18N_NOOP("Oriya")},
169 {"os", "oss", I18N_NOOP("Ossetic")},
170 {"pa", "pan", I18N_NOOP("Panjabi")},
171 {"pi", "pli", I18N_NOOP("Pali")},
172 {"pl", "pol", I18N_NOOP("Polish")},
173 {"ps", "pus", I18N_NOOP("Pushto")},
174 {"pt", "por", I18N_NOOP("Portuguese")},
175 {"qu", "que", I18N_NOOP("Quechua")},
176 {"rm", "roh", I18N_NOOP("Raeto-Romance")},
177 {"rn", "run", I18N_NOOP("Rundi")},
178 {"ro", "rum", I18N_NOOP("Romanian")},
179 {"ru", "rus", I18N_NOOP("Russian")},
180 {"rw", "kin", I18N_NOOP("Kinyarwanda")},
181 {"sa", "san", I18N_NOOP("Sanskrit")},
182 {"sc", "srd", I18N_NOOP("Sardinian")},
183 {"sd", "snd", I18N_NOOP("Sindhi")},
184 {"se", "sme", I18N_NOOP("Northern Sami")},
185 {"sg", "sag", I18N_NOOP("Sango")},
186 {"si", "sin", I18N_NOOP("Sinhalese")},
187 {"sk", "slo", I18N_NOOP("Slovak")},
188 {"sl", "slv", I18N_NOOP("Slovenian")},
189 {"sm", "smo", I18N_NOOP("Samoan")},
190 {"sn", "sna", I18N_NOOP("Shona")},
191 {"so", "som", I18N_NOOP("Somali")},
192 {"sq", "alb", I18N_NOOP("Albanian")},
193 {"sr", "scc", I18N_NOOP("Serbian")},
194 {"ss", "ssw", I18N_NOOP("Swati")},
195 {"st", "sot", I18N_NOOP("Sotho, Southern")},
196 {"su", "sun", I18N_NOOP("Sundanese")},
197 {"sv", "swe", I18N_NOOP("Swedish")},
198 {"sw", "swa", I18N_NOOP("Swahili")},
199 {"ta", "tam", I18N_NOOP("Tamil")},
200 {"te", "tel", I18N_NOOP("Telugu")},
201 {"tg", "tgk", I18N_NOOP("Tajik")},
202 {"th", "tha", I18N_NOOP("Thai")},
203 {"ti", "tir", I18N_NOOP("Tigrinya")},
204 {"tk", "tuk", I18N_NOOP("Turkmen")},
205 {"tl", "tgl", I18N_NOOP("Tagalog")},
206 {"tn", "tsn", I18N_NOOP("Tswana")},
207 {"to", "ton", I18N_NOOP("Tonga")},
208 {"tr", "tur", I18N_NOOP("Turkish")},
209 {"ts", "tso", I18N_NOOP("Tsonga")},
210 {"tt", "tat", I18N_NOOP("Tatar")},
211 {"tw", "twi", I18N_NOOP("Twi")},
212 {"ty", "tah", I18N_NOOP("Tahitian")},
213 {"ug", "uig", I18N_NOOP("Uighur")},
214 {"uk", "ukr", I18N_NOOP("Ukrainian")},
215 {"ur", "urd", I18N_NOOP("Urdu")},
216 {"uz", "uzb", I18N_NOOP("Uzbek")},
217 {"vi", "vie", I18N_NOOP("Vietnamese")},
218 {"vo", "vol", I18N_NOOP("Volapük")},
219 {"wo", "wol", I18N_NOOP("Wolof")},
220 {"xh", "xho", I18N_NOOP("Xhosa")},
221 {"yi", "yid", I18N_NOOP("Yiddish")},
222 {"yo", "yor", I18N_NOOP("Yoruba")},
223 {"za", "zha", I18N_NOOP("Zhuang")},
224 {"zh", "chi", I18N_NOOP("Chinese")},
225 {"zu", "zul", I18N_NOOP("Zulu")},
229 /* only when really needed
231 KV_ISO639_Code kv_iso639_2[] = {
232 {"ab", "abk", I18N_NOOP("Abkhazian")},
233 {"", "ace", I18N_NOOP("Achinese")},
234 {"", "ach", I18N_NOOP("Acoli")},
235 {"", "ada", I18N_NOOP("Adangme")},
236 {"aa", "aar", I18N_NOOP("Afar")},
237 {"", "afh", I18N_NOOP("Afrihili")},
238 {"af", "afr", I18N_NOOP("Afrikaans")},
239 {"", "afa", I18N_NOOP("Afro-Asiatic (Other)")},
240 {"", "aka", I18N_NOOP("Akan")},
241 {"", "akk", I18N_NOOP("Akkadian")},
242 {"sq", "alb", I18N_NOOP("Albanian")},
243 {"", "ale", I18N_NOOP("Aleut")},
244 {"", "alg", I18N_NOOP("Algonquian languages")},
245 {"", "tut", I18N_NOOP("Altaic (Other)")},
246 {"am", "amh", I18N_NOOP("Amharic")},
247 {"", "apa", I18N_NOOP("Apache languages")},
248 {"ar", "ara", I18N_NOOP("Arabic")},
249 {"", "arc", I18N_NOOP("Aramaic")},
250 {"", "arp", I18N_NOOP("Arapaho")},
251 {"", "arn", I18N_NOOP("Araucanian")},
252 {"", "arw", I18N_NOOP("Arawak")},
253 {"hy", "arm", I18N_NOOP("Armenian")},
254 {"", "art", I18N_NOOP("Artificial (Other)")},
255 {"as", "asm", I18N_NOOP("Assamese")},
256 {"", "ath", I18N_NOOP("Athapascan languages")},
257 {"", "aus", I18N_NOOP("Australian languages")},
258 {"", "map", I18N_NOOP("Austronesian (Other)")},
259 {"", "ava", I18N_NOOP("Avaric")},
260 {"ae", "ave", I18N_NOOP("Avestan")},
261 {"", "awa", I18N_NOOP("Awadhi")},
262 {"ay", "aym", I18N_NOOP("Aymara")},
263 {"az", "aze", I18N_NOOP("Azerbaijani")},
264 {"", "ban", I18N_NOOP("Balinese")},
265 {"", "bat", I18N_NOOP("Baltic (Other)")},
266 {"", "bal", I18N_NOOP("Baluchi")},
267 {"", "bam", I18N_NOOP("Bambara")},
268 {"", "bai", I18N_NOOP("Bamileke languages")},
269 {"", "bad", I18N_NOOP("Banda")},
270 {"", "bnt", I18N_NOOP("Bantu (Other)")},
271 {"", "bas", I18N_NOOP("Basa")},
272 {"ba", "bak", I18N_NOOP("Bashkir")},
273 {"eu", "baq", I18N_NOOP("Basque")},
274 {"", "btk", I18N_NOOP("Batak (Indonesia)")},
275 {"", "bej", I18N_NOOP("Beja")},
276 {"be", "bel", I18N_NOOP("Belarusian")},
277 {"", "bem", I18N_NOOP("Bemba")},
278 {"bn", "ben", I18N_NOOP("Bengali")},
279 {"", "ber", I18N_NOOP("Berber (Other)")},
280 {"", "bho", I18N_NOOP("Bhojpuri")},
281 {"bh", "bih", I18N_NOOP("Bihari")},
282 {"", "bik", I18N_NOOP("Bikol")},
283 {"", "bin", I18N_NOOP("Bini")},
284 {"bi", "bis", I18N_NOOP("Bislama")},
285 {"nb", "nob", I18N_NOOP("Bokmål, Norwegian; Norwegian Bokmål")},
286 {"bs", "bos", I18N_NOOP("Bosnian")},
287 {"", "bra", I18N_NOOP("Braj")},
288 {"br", "bre", I18N_NOOP("Breton")},
289 {"", "bug", I18N_NOOP("Buginese")},
290 {"bg", "bul", I18N_NOOP("Bulgarian")},
291 {"", "bua", I18N_NOOP("Buriat")},
292 {"my", "bur", I18N_NOOP("Burmese")},
293 {"", "cad", I18N_NOOP("Caddo")},
294 {"", "car", I18N_NOOP("Carib")},
295 {"es", "spa", I18N_NOOP("Castilian; Spanish")},
296 {"ca", "cat", I18N_NOOP("Catalan")},
297 {"", "cau", I18N_NOOP("Caucasian (Other)")},
298 {"", "ceb", I18N_NOOP("Cebuano")},
299 {"", "cel", I18N_NOOP("Celtic (Other)")},
300 {"", "chg", I18N_NOOP("Chagatai")},
301 {"", "cmc", I18N_NOOP("Chamic languages")},
302 {"ch", "cha", I18N_NOOP("Chamorro")},
303 {"ce", "che", I18N_NOOP("Chechen")},
304 {"", "chr", I18N_NOOP("Cherokee")},
305 {"", "chy", I18N_NOOP("Cheyenne")},
306 {"", "chb", I18N_NOOP("Chibcha")},
307 {"ny", "nya", I18N_NOOP("Chichewa; Nyanja")},
308 {"zh", "chi", I18N_NOOP("Chinese")},
309 {"", "chn", I18N_NOOP("Chinook jargon")},
310 {"", "chp", I18N_NOOP("Chipewyan")},
311 {"", "cho", I18N_NOOP("Choctaw")},
312 {"za", "zha", I18N_NOOP("Chuang; Zhuang")},
313 {"cu", "chu", I18N_NOOP("Church Slavic")},
314 {"", "chk", I18N_NOOP("Chuukese")},
315 {"cv", "chv", I18N_NOOP("Chuvash")},
316 {"", "cop", I18N_NOOP("Coptic")},
317 {"kw", "cor", I18N_NOOP("Cornish")},
318 {"co", "cos", I18N_NOOP("Corsican")},
319 {"", "cre", I18N_NOOP("Cree")},
320 {"", "mus", I18N_NOOP("Creek")},
321 {"", "crp", I18N_NOOP("Creoles and pidgins (Other)")},
322 {"hr", "scr", I18N_NOOP("Croatian")},
323 {"", "cus", I18N_NOOP("Cushitic (Other)")},
324 {"cs", "cze", I18N_NOOP("Czech")},
325 {"", "dak", I18N_NOOP("Dakota")},
326 {"da", "dan", I18N_NOOP("Danish")},
327 {"", "day", I18N_NOOP("Dayak")},
328 {"", "del", I18N_NOOP("Delaware")},
329 {"", "din", I18N_NOOP("Dinka")},
330 {"", "div", I18N_NOOP("Divehi")},
331 {"", "doi", I18N_NOOP("Dogri")},
332 {"", "dgr", I18N_NOOP("Dogrib")},
333 {"", "dra", I18N_NOOP("Dravidian (Other)")},
334 {"", "dua", I18N_NOOP("Duala")},
335 {"nl", "dut", I18N_NOOP("Dutch")},
336 {"", "dum", I18N_NOOP("Dutch, Middle (ca. 1050-1350)")},
337 {"", "dyu", I18N_NOOP("Dyula")},
338 {"dz", "dzo", I18N_NOOP("Dzongkha")},
339 {"", "efi", I18N_NOOP("Efik")},
340 {"", "egy", I18N_NOOP("Egyptian (Ancient)")},
341 {"", "eka", I18N_NOOP("Ekajuk")},
342 {"", "elx", I18N_NOOP("Elamite")},
343 {"en", "eng", I18N_NOOP("English")},
344 {"", "enm", I18N_NOOP("English, Middle (1100-1500)")},
345 {"", "ang", I18N_NOOP("English, Old (ca.450-1100)")},
346 {"eo", "epo", I18N_NOOP("Esperanto")},
347 {"et", "est", I18N_NOOP("Estonian")},
348 {"", "ewe", I18N_NOOP("Ewe")},
349 {"", "ewo", I18N_NOOP("Ewondo")},
350 {"", "fan", I18N_NOOP("Fang")},
351 {"", "fat", I18N_NOOP("Fanti")},
352 {"fo", "fao", I18N_NOOP("Faroese")},
353 {"fj", "fij", I18N_NOOP("Fijian")},
354 {"fi", "fin", I18N_NOOP("Finnish")},
355 {"", "fiu", I18N_NOOP("Finno-Ugrian (Other)")},
356 {"", "fon", I18N_NOOP("Fon")},
357 {"fr", "fre", I18N_NOOP("French")},
358 {"", "frm", I18N_NOOP("French, Middle (ca.1400-1600)")},
359 {"", "fro", I18N_NOOP("French, Old (842-ca.1400)")},
360 {"fy", "fry", I18N_NOOP("Frisian")},
361 {"", "fur", I18N_NOOP("Friulian")},
362 {"", "ful", I18N_NOOP("Fulah")},
363 {"", "gaa", I18N_NOOP("Ga")},
364 {"gd", "gla", I18N_NOOP("Gaelic; Scottish Gaelic")},
365 {"gl", "glg", I18N_NOOP("Gallegan")},
366 {"", "lug", I18N_NOOP("Ganda")},
367 {"", "gay", I18N_NOOP("Gayo")},
368 {"", "gba", I18N_NOOP("Gbaya")},
369 {"", "gez", I18N_NOOP("Geez")},
370 {"ka", "geo", I18N_NOOP("Georgian")},
371 {"de", "ger", I18N_NOOP("German")},
372 {"", "nds", I18N_NOOP("German, Low; Saxon, Low; Low German; Low Saxon")},
373 {"", "gmh", I18N_NOOP("German, Middle High (ca.1050-1500)")},
374 {"", "goh", I18N_NOOP("German, Old High (ca.750-1050)")},
375 {"", "gem", I18N_NOOP("Germanic (Other)")},
376 {"ki", "kik", I18N_NOOP("Gikuyu; Kikuyu")},
377 {"", "gil", I18N_NOOP("Gilbertese")},
378 {"", "gon", I18N_NOOP("Gondi")},
379 {"", "gor", I18N_NOOP("Gorontalo")},
380 {"", "got", I18N_NOOP("Gothic")},
381 {"", "grb", I18N_NOOP("Grebo")},
382 {"", "grc", I18N_NOOP("Greek, Ancient (to 1453)")},
383 {"el", "gre", I18N_NOOP("Greek, Modern (1453-)")},
384 {"gn", "grn", I18N_NOOP("Guarani")},
385 {"gu", "guj", I18N_NOOP("Gujarati")},
386 {"", "gwi", I18N_NOOP("Gwich´in")},
387 {"", "hai", I18N_NOOP("Haida")},
388 {"ha", "hau", I18N_NOOP("Hausa")},
389 {"", "haw", I18N_NOOP("Hawaiian")},
390 {"he", "heb", I18N_NOOP("Hebrew")},
391 {"hz", "her", I18N_NOOP("Herero")},
392 {"", "hil", I18N_NOOP("Hiligaynon")},
393 {"", "him", I18N_NOOP("Himachali")},
394 {"hi", "hin", I18N_NOOP("Hindi")},
395 {"ho", "hmo", I18N_NOOP("Hiri Motu")},
396 {"", "hit", I18N_NOOP("Hittite")},
397 {"", "hmn", I18N_NOOP("Hmong")},
398 {"hu", "hun", I18N_NOOP("Hungarian")},
399 {"", "hup", I18N_NOOP("Hupa")},
400 {"", "iba", I18N_NOOP("Iban")},
401 {"is", "ice", I18N_NOOP("Icelandic")},
402 {"", "ibo", I18N_NOOP("Igbo")},
403 {"", "ijo", I18N_NOOP("Ijo")},
404 {"", "ilo", I18N_NOOP("Iloko")},
405 {"", "inc", I18N_NOOP("Indic (Other)")},
406 {"", "ine", I18N_NOOP("Indo-European (Other)")},
407 {"id", "ind", I18N_NOOP("Indonesian")},
408 {"ie", "ile", I18N_NOOP("Interlingue")},
409 {"iu", "iku", I18N_NOOP("Inuktitut")},
410 {"ik", "ipk", I18N_NOOP("Inupiaq")},
411 {"", "ira", I18N_NOOP("Iranian (Other)")},
412 {"ga", "gle", I18N_NOOP("Irish")},
413 {"", "mga", I18N_NOOP("Irish, Middle (900-1200)")},
414 {"", "sga", I18N_NOOP("Irish, Old (to 900)")},
415 {"", "iro", I18N_NOOP("Iroquoian languages")},
416 {"it", "ita", I18N_NOOP("Italian")},
417 {"ja", "jpn", I18N_NOOP("Japanese")},
418 {"jv", "jav", I18N_NOOP("Javanese")},
419 {"", "jrb", I18N_NOOP("Judeo-Arabic")},
420 {"", "jpr", I18N_NOOP("Judeo-Persian")},
421 {"", "kab", I18N_NOOP("Kabyle")},
422 {"", "kac", I18N_NOOP("Kachin")},
423 {"kl", "kal", I18N_NOOP("Kalaallisut")},
424 {"", "kam", I18N_NOOP("Kamba")},
425 {"kn", "kan", I18N_NOOP("Kannada")},
426 {"", "kau", I18N_NOOP("Kanuri")},
427 {"", "kaa", I18N_NOOP("Kara-Kalpak")},
428 {"", "kar", I18N_NOOP("Karen")},
429 {"ks", "kas", I18N_NOOP("Kashmiri")},
430 {"", "kaw", I18N_NOOP("Kawi")},
431 {"kk", "kaz", I18N_NOOP("Kazakh")},
432 {"", "kha", I18N_NOOP("Khasi")},
433 {"km", "khm", I18N_NOOP("Khmer")},
434 {"", "khi", I18N_NOOP("Khoisan (Other)")},
435 {"", "kho", I18N_NOOP("Khotanese")},
436 {"ki", "kik", I18N_NOOP("Kikuyu; Gikuyu")},
437 {"", "kmb", I18N_NOOP("Kimbundu")},
438 {"rw", "kin", I18N_NOOP("Kinyarwanda")},
439 {"ky", "kir", I18N_NOOP("Kirghiz")},
440 {"kv", "kom", I18N_NOOP("Komi")},
441 {"", "kon", I18N_NOOP("Kongo")},
442 {"", "kok", I18N_NOOP("Konkani")},
443 {"ko", "kor", I18N_NOOP("Korean")},
444 {"", "kos", I18N_NOOP("Kosraean")},
445 {"", "kpe", I18N_NOOP("Kpelle")},
446 {"", "kro", I18N_NOOP("Kru")},
447 {"kj", "kua", I18N_NOOP("Kuanyama")},
448 {"", "kum", I18N_NOOP("Kumyk")},
449 {"ku", "kur", I18N_NOOP("Kurdish")},
450 {"", "kru", I18N_NOOP("Kurukh")},
451 {"", "kut", I18N_NOOP("Kutenai")},
452 {"", "lad", I18N_NOOP("Ladino")},
453 {"", "lah", I18N_NOOP("Lahnda")},
454 {"", "lam", I18N_NOOP("Lamba")},
455 {"lo", "lao", I18N_NOOP("Lao")},
456 {"la", "lat", I18N_NOOP("Latin")},
457 {"lv", "lav", I18N_NOOP("Latvian")},
458 {"lb", "ltz", I18N_NOOP("Letzeburgesch")},
459 {"", "lez", I18N_NOOP("Lezghian")},
460 {"ln", "lin", I18N_NOOP("Lingala")},
461 {"lt", "lit", I18N_NOOP("Lithuanian")},
462 {"", "nds", I18N_NOOP("Low German; Low Saxon; German, Low; Saxon, Low")},
463 {"", "nds", I18N_NOOP("Low Saxon; Low German; Saxon, Low; German, Low")},
464 {"", "loz", I18N_NOOP("Lozi")},
465 {"", "lub", I18N_NOOP("Luba-Katanga")},
466 {"", "lua", I18N_NOOP("Luba-Lulua")},
467 {"", "lui", I18N_NOOP("Luiseno")},
468 {"", "lun", I18N_NOOP("Lunda")},
469 {"", "luo", I18N_NOOP("Luo (Kenya and Tanzania)")},
470 {"", "lus", I18N_NOOP("Lushai")},
471 {"mk", "mac", I18N_NOOP("Macedonian")},
472 {"", "mad", I18N_NOOP("Madurese")},
473 {"", "mag", I18N_NOOP("Magahi")},
474 {"", "mai", I18N_NOOP("Maithili")},
475 {"", "mak", I18N_NOOP("Makasar")},
476 {"mg", "mlg", I18N_NOOP("Malagasy")},
477 {"ms", "may", I18N_NOOP("Malay")},
478 {"ml", "mal", I18N_NOOP("Malayalam")},
479 {"mt", "mlt", I18N_NOOP("Maltese")},
480 {"", "mnc", I18N_NOOP("Manchu")},
481 {"", "mdr", I18N_NOOP("Mandar")},
482 {"", "man", I18N_NOOP("Mandingo")},
483 {"", "mni", I18N_NOOP("Manipuri")},
484 {"", "mno", I18N_NOOP("Manobo languages")},
485 {"gv", "glv", I18N_NOOP("Manx")},
486 {"mi", "mao", I18N_NOOP("Maori")},
487 {"mr", "mar", I18N_NOOP("Marathi")},
488 {"", "chm", I18N_NOOP("Mari")},
489 {"mh", "mah", I18N_NOOP("Marshall")},
490 {"", "mwr", I18N_NOOP("Marwari")},
491 {"", "mas", I18N_NOOP("Masai")},
492 {"", "myn", I18N_NOOP("Mayan languages")},
493 {"", "men", I18N_NOOP("Mende")},
494 {"", "mic", I18N_NOOP("Micmac")},
495 {"", "min", I18N_NOOP("Minangkabau")},
496 {"", "mis", I18N_NOOP("Miscellaneous languages")},
497 {"", "moh", I18N_NOOP("Mohawk")},
498 {"mo", "mol", I18N_NOOP("Moldavian")},
499 {"", "mkh", I18N_NOOP("Mon-Khmer (Other)")},
500 {"", "lol", I18N_NOOP("Mongo")},
501 {"mn", "mon", I18N_NOOP("Mongolian")},
502 {"", "mos", I18N_NOOP("Mossi")},
503 {"", "mul", I18N_NOOP("Multiple languages")},
504 {"", "mun", I18N_NOOP("Munda languages")},
505 {"", "nah", I18N_NOOP("Nahuatl")},
506 {"na", "nau", I18N_NOOP("Nauru")},
507 {"nv", "nav", I18N_NOOP("Navajo")},
508 {"nd", "nde", I18N_NOOP("Ndebele, North")},
509 {"nr", "nbl", I18N_NOOP("Ndebele, South")},
510 {"ng", "ndo", I18N_NOOP("Ndonga")},
511 {"ne", "nep", I18N_NOOP("Nepali")},
512 {"", "new", I18N_NOOP("Newari")},
513 {"", "nia", I18N_NOOP("Nias")},
514 {"", "nic", I18N_NOOP("Niger-Kordofanian (Other)")},
515 {"", "ssa", I18N_NOOP("Nilo-Saharan (Other)")},
516 {"", "niu", I18N_NOOP("Niuean")},
517 {"", "non", I18N_NOOP("Norse, Old")},
518 {"", "nai", I18N_NOOP("North American Indian (Other)")},
519 {"se", "sme", I18N_NOOP("Northern Sami")},
520 {"no", "nor", I18N_NOOP("Norwegian")},
521 {"nb", "nob", I18N_NOOP("Norwegian Bokmål; Bokmål, Norwegian")},
522 {"nn", "nno", I18N_NOOP("Norwegian Nynorsk; Nynorsk, Norwegian")},
523 {"", "nub", I18N_NOOP("Nubian languages")},
524 {"", "nym", I18N_NOOP("Nyamwezi")},
525 {"ny", "nya", I18N_NOOP("Nyanja; Chichewa")},
526 {"", "nyn", I18N_NOOP("Nyankole")},
527 {"nn", "nno", I18N_NOOP("Nynorsk, Norwegian; Norwegian Nynorsk")},
528 {"", "nyo", I18N_NOOP("Nyoro")},
529 {"", "nzi", I18N_NOOP("Nzima")},
530 {"oc", "oci", I18N_NOOP("Occitan (post 1500); Provençal")},
531 {"", "oji", I18N_NOOP("Ojibwa")},
532 {"or", "ori", I18N_NOOP("Oriya")},
533 {"om", "orm", I18N_NOOP("Oromo")},
534 {"", "osa", I18N_NOOP("Osage")},
535 {"os", "oss", I18N_NOOP("Ossetian; Ossetic")},
536 {"os", "oss", I18N_NOOP("Ossetic; Ossetian")},
537 {"", "oto", I18N_NOOP("Otomian languages")},
538 {"", "pal", I18N_NOOP("Pahlavi")},
539 {"", "pau", I18N_NOOP("Palauan")},
540 {"pi", "pli", I18N_NOOP("Pali")},
541 {"", "pam", I18N_NOOP("Pampanga")},
542 {"", "pag", I18N_NOOP("Pangasinan")},
543 {"pa", "pan", I18N_NOOP("Panjabi")},
544 {"", "pap", I18N_NOOP("Papiamento")},
545 {"", "paa", I18N_NOOP("Papuan (Other)")},
546 {"fa", "per", I18N_NOOP("Persian")},
547 {"", "peo", I18N_NOOP("Persian, Old (ca.600-400 B.C.)")},
548 {"", "phi", I18N_NOOP("Philippine (Other)")},
549 {"", "phn", I18N_NOOP("Phoenician")},
550 {"", "pon", I18N_NOOP("Pohnpeian")},
551 {"pl", "pol", I18N_NOOP("Polish")},
552 {"pt", "por", I18N_NOOP("Portuguese")},
553 {"", "pra", I18N_NOOP("Prakrit languages")},
554 {"oc", "oci", I18N_NOOP("Provençal; Occitan (post 1500)")},
555 {"", "pro", I18N_NOOP("Provençal, Old (to 1500)")},
556 {"ps", "pus", I18N_NOOP("Pushto")},
557 {"qu", "que", I18N_NOOP("Quechua")},
558 {"rm", "roh", I18N_NOOP("Raeto-Romance")},
559 {"", "raj", I18N_NOOP("Rajasthani")},
560 {"", "rap", I18N_NOOP("Rapanui")},
561 {"", "rar", I18N_NOOP("Rarotongan")},
562 {"", "qaa-qtz", I18N_NOOP("Reserved for local use")},
563 {"", "roa", I18N_NOOP("Romance (Other)")},
564 {"ro", "rum", I18N_NOOP("Romanian")},
565 {"", "rom", I18N_NOOP("Romany")},
566 {"rn", "run", I18N_NOOP("Rundi")},
567 {"ru", "rus", I18N_NOOP("Russian")},
568 {"", "sal", I18N_NOOP("Salishan languages")},
569 {"", "sam", I18N_NOOP("Samaritan Aramaic")},
570 {"", "smi", I18N_NOOP("Sami languages (Other)")},
571 {"sm", "smo", I18N_NOOP("Samoan")},
572 {"", "sad", I18N_NOOP("Sandawe")},
573 {"sg", "sag", I18N_NOOP("Sango")},
574 {"sa", "san", I18N_NOOP("Sanskrit")},
575 {"", "sat", I18N_NOOP("Santali")},
576 {"sc", "srd", I18N_NOOP("Sardinian")},
577 {"", "sas", I18N_NOOP("Sasak")},
578 {"", "sco", I18N_NOOP("Scots")},
579 {"gd", "gla", I18N_NOOP("Scottish Gaelic; Gaelic")},
580 {"", "sel", I18N_NOOP("Selkup")},
581 {"", "sem", I18N_NOOP("Semitic (Other)")},
582 {"sr", "scc", I18N_NOOP("Serbian")},
583 {"", "srr", I18N_NOOP("Serer")},
584 {"", "shn", I18N_NOOP("Shan")},
585 {"sn", "sna", I18N_NOOP("Shona")},
586 {"", "sid", I18N_NOOP("Sidamo")},
587 {"", "sgn", I18N_NOOP("Sign languages")},
588 {"", "bla", I18N_NOOP("Siksika")},
589 {"sd", "snd", I18N_NOOP("Sindhi")},
590 {"si", "sin", I18N_NOOP("Sinhalese")},
591 {"", "sit", I18N_NOOP("Sino-Tibetan (Other)")},
592 {"", "sio", I18N_NOOP("Siouan languages")},
593 {"", "den", I18N_NOOP("Slave (Athapascan)")},
594 {"", "sla", I18N_NOOP("Slavic (Other)")},
595 {"sk", "slo", I18N_NOOP("Slovak")},
596 {"sl", "slv", I18N_NOOP("Slovenian")},
597 {"", "sog", I18N_NOOP("Sogdian")},
598 {"so", "som", I18N_NOOP("Somali")},
599 {"", "son", I18N_NOOP("Songhai")},
600 {"", "snk", I18N_NOOP("Soninke")},
601 {"", "wen", I18N_NOOP("Sorbian languages")},
602 {"", "nso", I18N_NOOP("Sotho, Northern")},
603 {"st", "sot", I18N_NOOP("Sotho, Southern")},
604 {"", "sai", I18N_NOOP("South American Indian (Other)")},
605 {"es", "spa", I18N_NOOP("Spanish; Castilian")},
606 {"", "suk", I18N_NOOP("Sukuma")},
607 {"", "sux", I18N_NOOP("Sumerian")},
608 {"su", "sun", I18N_NOOP("Sundanese")},
609 {"", "sus", I18N_NOOP("Susu")},
610 {"sw", "swa", I18N_NOOP("Swahili")},
611 {"ss", "ssw", I18N_NOOP("Swati")},
612 {"sv", "swe", I18N_NOOP("Swedish")},
613 {"", "syr", I18N_NOOP("Syriac")},
614 {"tl", "tgl", I18N_NOOP("Tagalog")},
615 {"ty", "tah", I18N_NOOP("Tahitian")},
616 {"", "tai", I18N_NOOP("Tai (Other)")},
617 {"tg", "tgk", I18N_NOOP("Tajik")},
618 {"", "tmh", I18N_NOOP("Tamashek")},
619 {"ta", "tam", I18N_NOOP("Tamil")},
620 {"tt", "tat", I18N_NOOP("Tatar")},
621 {"te", "tel", I18N_NOOP("Telugu")},
622 {"", "ter", I18N_NOOP("Tereno")},
623 {"", "tet", I18N_NOOP("Tetum")},
624 {"th", "tha", I18N_NOOP("Thai")},
625 {"bo", "tib", I18N_NOOP("Tibetan")},
626 {"", "tig", I18N_NOOP("Tigre")},
627 {"ti", "tir", I18N_NOOP("Tigrinya")},
628 {"", "tem", I18N_NOOP("Timne")},
629 {"", "tiv", I18N_NOOP("Tiv")},
630 {"", "tli", I18N_NOOP("Tlingit")},
631 {"", "tpi", I18N_NOOP("Tok Pisin")},
632 {"", "tkl", I18N_NOOP("Tokelau")},
633 {"", "tog", I18N_NOOP("Tonga (Nyasa)")},
634 {"to", "ton", I18N_NOOP("Tonga (Tonga Islands)")},
635 {"", "tsi", I18N_NOOP("Tsimshian")},
636 {"ts", "tso", I18N_NOOP("Tsonga")},
637 {"tn", "tsn", I18N_NOOP("Tswana")},
638 {"", "tum", I18N_NOOP("Tumbuka")},
639 {"tr", "tur", I18N_NOOP("Turkish")},
640 {"", "ota", I18N_NOOP("Turkish, Ottoman (1500-1928)")},
641 {"tk", "tuk", I18N_NOOP("Turkmen")},
642 {"", "tvl", I18N_NOOP("Tuvalu")},
643 {"", "tyv", I18N_NOOP("Tuvinian")},
644 {"tw", "twi", I18N_NOOP("Twi")},
645 {"", "uga", I18N_NOOP("Ugaritic")},
646 {"ug", "uig", I18N_NOOP("Uighur")},
647 {"uk", "ukr", I18N_NOOP("Ukrainian")},
648 {"", "umb", I18N_NOOP("Umbundu")},
649 {"", "und", I18N_NOOP("Undetermined")},
650 {"ur", "urd", I18N_NOOP("Urdu")},
651 {"uz", "uzb", I18N_NOOP("Uzbek")},
652 {"", "vai", I18N_NOOP("Vai")},
653 {"", "ven", I18N_NOOP("Venda")},
654 {"vi", "vie", I18N_NOOP("Vietnamese")},
655 {"vo", "vol", I18N_NOOP("Volapük")},
656 {"", "vot", I18N_NOOP("Votic")},
657 {"", "wak", I18N_NOOP("Wakashan languages")},
658 {"", "wal", I18N_NOOP("Walamo")},
659 {"", "war", I18N_NOOP("Waray")},
660 {"", "was", I18N_NOOP("Washo")},
661 {"cy", "wel", I18N_NOOP("Welsh")},
662 {"wo", "wol", I18N_NOOP("Wolof")},
663 {"xh", "xho", I18N_NOOP("Xhosa")},
664 {"", "sah", I18N_NOOP("Yakut")},
665 {"", "yao", I18N_NOOP("Yao")},
666 {"", "yap", I18N_NOOP("Yapese")},
667 {"yi", "yid", I18N_NOOP("Yiddish")},
668 {"yo", "yor", I18N_NOOP("Yoruba")},
669 {"", "ypk", I18N_NOOP("Yupik languages")},
670 {"", "znd", I18N_NOOP("Zande")},
671 {"", "zap", I18N_NOOP("Zapotec")},
672 {"", "zen", I18N_NOOP("Zenaga")},
673 {"za", "zha", I18N_NOOP("Zhuang; Chuang")},
674 {"zu", "zul", I18N_NOOP("Zulu")},
675 {"", "zun", I18N_NOOP("Zuni")},
680 LanguageOptions::LanguageOptions(LangSet
& langset
, QWidget
* parent
, const char* name
, WFlags fl
)
681 : LanguageOptionsBase(parent
, name
, fl
), m_langSet(langset
)
685 connect(b_langDel
, SIGNAL(clicked()), this, SLOT(slotDeleteClicked()));
686 connect(b_langNew
, SIGNAL(clicked()), this, SLOT(slotNewClicked()));
687 connect(b_langPixmap
, SIGNAL(clicked()), SLOT(slotPixmapClicked()));
688 connect(e_newName
, SIGNAL(textChanged(const QString
&)), this, SLOT(slotNewNameChanged(const QString
&)));
689 connect(d_shortName
, SIGNAL(activated(const QString
&)), this, SLOT(slotShortActivated(const QString
&)));
690 connect(e_langLong
, SIGNAL(textChanged(const QString
&)), this, SLOT(slotLangChanged(const QString
&)));
691 connect(e_shortName2
, SIGNAL(textChanged(const QString
&)), this, SLOT(slotShort2Changed(const QString
&)));
692 connect(d_kblayout
, SIGNAL(activated(const QString
&)), this, SLOT(slotKeyboardLayoutChanged(const QString
&)));
694 // Load the languages first, then the countries and create the
695 // menus for the languages last, so they will have flags
699 b_lang_kde
->setPopup(langset_popup
);
701 createISO6391Menus();
702 b_lang_iso1
->setPopup(iso6391_popup
);
704 b_langNew
->setEnabled(false); // activate after data is entered
706 for (int i
= 0; i
< (int) m_langSet
.size() && i
< MAX_LANGSET
; i
++)
707 d_shortName
->insertItem (m_langSet
.shortId(i
));
711 if (d_shortName
->count() )
713 d_shortName
->setCurrentItem(0);
714 e_langLong
->setText(m_langSet
.longId(0));
715 e_shortName2
->setText(m_langSet
.shortId2(0));
716 if (!m_langSet
.PixMapFile(0).isEmpty() )
718 QPixmap
pix(m_langSet
.PixMapFile(0));
721 m_lastPix
= m_langSet
.PixMapFile(0);
722 b_langPixmap
->setPixmap (pix
);
725 b_langPixmap
->setText (i18n("Picture is Invalid"));
728 b_langPixmap
->setText (i18n("No Picture Selected"));
732 b_langPixmap
->setText (i18n("No Picture Selected..."));
733 b_langPixmap
->setEnabled(false);
735 m_hasChanged
= false;
739 LanguageOptions::~LanguageOptions ()
741 delete langset_popup
;
744 void LanguageOptions::slotDeleteClicked()
746 if (d_shortName
->count() != 0)
748 m_langSet
.erase(d_shortName
->currentItem());
749 emit
widgetModified();
751 d_shortName
->removeItem(d_shortName
->currentItem());
752 if (d_shortName
->count() != 0)
753 d_shortName
->setCurrentItem (0);
756 if (d_shortName
->count() != 0)
758 setPixmap(m_langSet
.PixMapFile(d_shortName
->currentItem()));
759 e_langLong
->setText(m_langSet
.longId(d_shortName
->currentItem()));
760 e_shortName2
->setText(m_langSet
.shortId2(d_shortName
->currentItem()));
763 b_langPixmap
->setText (i18n("No picture selected"));
764 e_langLong
->setText("");
765 e_shortName2
->setText("");
766 b_langPixmap
->setEnabled(false);
771 if (d_shortName
->count() != 0 && d_kblayout
->isEnabled())
773 for (int i
= 0; i
< d_kblayout
->count(); i
++)
775 if (d_kblayout
->text(i
) == m_langSet
.keyboardLayout(d_shortName
->currentItem()))
777 d_kblayout
->setCurrentItem(i
);
785 void LanguageOptions::slotKeyboardLayoutChanged(const QString
& layout
)
787 m_langSet
.setKeyboardLayout(layout
, d_shortName
->currentItem());
788 emit
widgetModified();
792 void LanguageOptions::enableLangWidgets()
794 bool enabled
= d_shortName
->count() != 0;
795 b_langDel
->setEnabled(enabled
);
796 b_langPixmap
->setEnabled(enabled
);
797 d_shortName
->setEnabled(enabled
);
798 e_langLong
->setEnabled(enabled
);
799 e_shortName2
->setEnabled(enabled
);
801 //kdDebug() << "enabled? " << enabled << endl;
803 if (enabled
&& KApplication::dcopClient()->isApplicationRegistered("kxkb"))
807 QByteArray replyData
;
809 if (!KApplication::dcopClient()->call("kxkb", "kxkb", "getLayoutsList()", data
, replyType
, replyData
))
811 //kdDebug() << "kxkb dcop error" << endl;
815 if (replyType
== "QStringList")
818 QDataStream
stream(replyData
, IO_ReadOnly
);
820 layouts
.prepend(QString::null
);
822 d_kblayout
->insertStringList(layouts
);
828 //kdDebug() << "kxkb not enabled" << endl;
830 d_kblayout
->setEnabled(false);
835 void LanguageOptions::slotNewNameChanged(const QString
& _s
)
838 b_langNew
->setEnabled(s
.stripWhiteSpace().length() >= 2);
842 void LanguageOptions::slotNewClicked()
844 QString s
= e_newName
->text();
845 d_shortName
->insertItem(s
.stripWhiteSpace());
846 d_shortName
->setCurrentItem(d_shortName
->count()-1);
848 slotShortActivated(s
);
849 e_newName
->setText("");
850 e_langLong
->setFocus();
854 void LanguageOptions::slotShortActivated(const QString
& _id
)
857 QString id
= _id
.stripWhiteSpace();
858 if (d_shortName
->count() > (int) m_langSet
.size() )
860 // avoid duplicates in language code
861 for (i
= 0; i
< d_shortName
->count(); i
++)
862 if (d_shortName
->text(i
).isNull())
864 d_shortName
->removeItem(d_shortName
->currentItem());
865 d_shortName
->setCurrentItem(0);
868 for (i
= 0; i
< d_shortName
->count()-1; i
++) // omit last
869 if (id
== d_shortName
->text(i
))
871 d_shortName
->removeItem(d_shortName
->currentItem());
872 d_shortName
->setCurrentItem(i
);
876 if (d_shortName
->count() > (int) m_langSet
.size() && m_langSet
.size() < MAX_LANGSET
)
878 m_langSet
.addSet(id
, "", "");
879 emit
widgetModified();
884 if (d_shortName
->count() != 0)
886 b_langPixmap
->setEnabled(true);
887 e_langLong
->setText(m_langSet
.longId(d_shortName
->currentItem()));
888 e_shortName2
->setText(m_langSet
.shortId2(d_shortName
->currentItem()));
890 if (!m_langSet
.PixMapFile(d_shortName
->currentItem()).isEmpty())
892 QPixmap
pix(m_langSet
.PixMapFile(d_shortName
->currentItem()));
894 b_langPixmap
->setPixmap(pix
);
896 b_langPixmap
->setText(i18n("Picture is Invalid"));
899 b_langPixmap
->setText (i18n("No Picture Selected"));
901 QString layout
= m_langSet
.keyboardLayout(d_shortName
->currentItem());
903 //kdDebug() << "layout to select " << layout << endl;
905 for (int i
= 0; i
< d_kblayout
->count(); i
++)
907 if (d_kblayout
->text(i
) == layout
)
909 d_kblayout
->setCurrentItem(i
);
914 if (d_kblayout
->currentText() != layout
)
916 d_kblayout
->setCurrentItem(0);
922 void LanguageOptions::slotLangChanged(const QString
& s
)
924 if (d_shortName
->count() != 0 && d_shortName
->currentItem() < (int) m_langSet
.size())
926 m_langSet
.setLongId(s
, d_shortName
->currentItem());
927 emit
widgetModified();
933 void LanguageOptions::slotShort2Changed(const QString
& s
)
935 if (d_shortName
->count() != 0 && d_shortName
->currentItem() < (int) m_langSet
.size())
937 m_langSet
.setShortId2(s
, d_shortName
->currentItem());
938 emit
widgetModified();
944 bool LanguageOptions::setPixmap(QString pm
)
946 if (d_shortName
->count() )
949 if (!pix
.isNull() ) {
950 m_langSet
.setPixMapFile(pm
, d_shortName
->currentItem());
951 b_langPixmap
->setPixmap (pix
);
952 emit
widgetModified();
962 void LanguageOptions::slotPixmapClicked()
964 if (m_langSet
.size() > 0 )
966 if (m_lastPix
.isNull() || QPixmap(m_lastPix
).isNull())
969 if (!m_langSet
.shortId(d_shortName
->currentItem()).isNull())
971 s
= m_langSet
.shortId(d_shortName
->currentItem());
972 m_lastPix
= locate ("locale", "l10n/"+s
+"/flag.png");
973 if (m_lastPix
.isNull()) {
974 m_lastPix
= locate ("locale", "l10n/");
979 m_lastPix
= locate ("locale", "l10n/");
984 QFileInfo
fi (m_lastPix
);
985 m_lastPix
= fi
.dirPath()+"/flag.png";
988 QString s
= KFileDialog::getOpenFileName (m_lastPix
, "*.png *.xpm *.gif *.xbm");
994 b_langPixmap
->setText (i18n("Picture is invalid"));
995 KMessageBox::sorry(this, i18n("File does not contain a valid graphics format\n"));
1001 LangSet
LanguageOptions::getLangSet () const
1007 void LanguageOptions::loadCountryData()
1009 // temperary use of our locale as the global locale
1010 KLocale
*lsave
= KGlobal::_locale
;
1011 QString curr_lang
= lsave
->language();
1013 // KLocale locale("kvoctrain");
1014 KLocale
locale(QString::null
);
1015 locale
.setLanguage(curr_lang
);
1016 KGlobal::_locale
= &locale
;
1018 QString sub
= QString::fromLatin1("l10n/");
1019 QStringList regionlist
= KGlobal::dirs()->findAllResources("locale", sub
+ QString::fromLatin1("*.desktop"));
1022 QMap
<QString
, Region
> regions
;
1024 for (QStringList::ConstIterator it
= regionlist
.begin(); it
!= regionlist
.end(); ++it
)
1029 index
= tag
.findRev('/');
1030 if (index
!= -1) tag
= tag
.mid(index
+ 1);
1032 index
= tag
.findRev('.');
1033 if (index
!= -1) tag
.truncate(index
);
1035 KSimpleConfig
entry(*it
);
1036 entry
.setGroup(QString::fromLatin1("KCM Locale"));
1037 QString name
= entry
.readEntry(QString::fromLatin1("Name"), i18n("without name"));
1039 regions
.insert(tag
, Region(name
));
1042 // add all languages to the list
1043 QStringList countrylist
= KGlobal::dirs()->findAllResources("locale", sub
+ QString::fromLatin1("*/entry.desktop"));
1046 for (QStringList::ConstIterator sit
= countrylist
.begin(); sit
!= countrylist
.end(); ++sit
)
1048 KSimpleConfig
entry(*sit
);
1049 entry
.setGroup(QString::fromLatin1("KCM Locale"));
1050 QString name
= entry
.readEntry(QString::fromLatin1("Name"), i18n("without name"));
1051 QString submenu
= entry
.readEntry(QString::fromLatin1("Region"));
1054 int index
= tag
.findRev('/');
1055 tag
.truncate(index
);
1056 index
= tag
.findRev('/');
1057 tag
= tag
.mid(index
+1);
1062 QStringList all_langs
= QStringList::split(",", entry
.readEntry(QString::fromLatin1("Languages")));
1063 QValueList
<int> langs
;
1065 QString pixmap
= *sit
;
1066 index
= pixmap
.findRev('/');
1067 pixmap
.truncate(index
);
1068 pixmap
+= "/flag.png";
1070 for (QStringList::Iterator it
= all_langs
.begin(); it
!= all_langs
.end(); ++it
)
1072 // Treat ie "en_GB" and "en_USE" as "en" because the language list
1073 // only contains the first letters
1074 if ((*it
).find("_"))
1075 *it
= (*it
).left((*it
).find("_"));
1077 int id
= global_langset
.indexShortId(*it
);
1081 // Set the pixmap of the language to the flag of the first contry that
1082 // has the language as official language
1083 if (global_langset
.PixMapFile(id
).isEmpty())
1084 global_langset
.setPixMapFile(pixmap
, id
);
1087 //kdDebug() << "Couldn't find the language for: " << *it << endl;
1091 countryIdMap
.insert(id
, Country(name
, langs
, pixmap
, id
));
1092 regions
[submenu
].countries
.append(countryIdMap
[id
]);
1095 langset_popup
= new QPopupMenu();
1097 // To have it sorted by name
1098 QMap
<QString
, Region
> regmap
;
1099 for (QMap
<QString
, Region
>::Iterator it
= regions
.begin(); it
!= regions
.end(); ++it
)
1100 regmap
.insert(it
.data().region
, it
.data());
1102 connect(langset_popup
, SIGNAL(activated(int)), this, SLOT(slotLangFromGlobalActivated(int)));
1103 for (QMap
<QString
, Region
>::Iterator it
= regmap
.begin(); it
!= regmap
.end(); ++it
)
1105 QPopupMenu
*regpop
= new QPopupMenu();
1106 connect(regpop
, SIGNAL(activated(int)), this, SLOT(slotLangFromGlobalActivated(int)));
1107 langset_popup
->insertItem(it
.key(), regpop
);
1108 Region r
= it
.data();
1110 // To have it sorted by name
1111 QMap
<QString
, Country
> countrymap
;
1112 for (QValueList
<Country
>::Iterator it
= r
.countries
.begin(); it
!= r
.countries
.end(); ++it
)
1114 countrymap
.insert((*it
).country
, *it
);
1116 for (QMap
<QString
, Country
>::Iterator it
= countrymap
.begin(); it
!= countrymap
.end(); ++it
)
1118 regpop
->insertItem(QPixmap(it
.data().pixmap
), it
.key(), it
.data().id
);
1122 // restore the old global locale
1123 KGlobal::_locale
= lsave
;
1127 void LanguageOptions::slotLangFromGlobalActivated(int i
)
1129 if (countryIdMap
.contains(i
))
1131 Country c
= countryIdMap
[i
];
1133 for (QValueList
<int>::Iterator it
= c
.langs
.begin(); it
!= c
.langs
.end(); ++it
)
1135 QString s
= global_langset
.shortId(*it
);
1137 if (d_shortName
->contains(s
.stripWhiteSpace()))
1141 d_shortName
->setCurrentItem(s
);
1142 slotShortActivated(s
);
1148 d_shortName
->insertItem(s
.stripWhiteSpace());
1149 m_langSet
.addSet(s
, global_langset
.longId(*it
), global_langset
.PixMapFile(*it
), global_langset
.shortId2(*it
));
1150 emit
widgetModified();
1151 m_hasChanged
= true;
1155 d_shortName
->setCurrentItem(d_shortName
->count()-1);
1156 slotShortActivated(s
);
1157 enableLangWidgets();
1159 e_shortName2
->setText(global_langset
.shortId2(*it
));
1160 slotShort2Changed(e_shortName2
->text());
1162 e_langLong
->setText(global_langset
.longId(*it
));
1163 slotLangChanged(global_langset
.longId(*it
));
1165 setPixmap(c
.pixmap
);
1166 e_newName
->setText("");
1167 e_langLong
->setFocus();
1168 e_langLong
->selectAll();
1176 void LanguageOptions::loadISO6391Data()
1178 for (unsigned id
= 0; id
< (int)(sizeof(kv_iso639_1
) / sizeof(kv_iso639_1
[0])) && kv_iso639_1
[id
].iso1code
!= 0; ++id
)
1180 QString s
= i18n(kv_iso639_1
[id
].langname
);
1181 global_langset
.addSet(kv_iso639_1
[id
].iso1code
, s
, QString::null
, kv_iso639_1
[id
].iso2code
);
1185 void LanguageOptions::createISO6391Menus()
1187 // To have it sorted by name
1188 QMap
<QString
, int> languages
;
1189 for (unsigned id
= 0; id
< global_langset
.size(); ++id
)
1191 QString s
= global_langset
.longId(id
);
1192 languages
.insert(s
, id
);
1195 iso6391_popup
= new QPopupMenu();
1197 QPopupMenu
*pop
= 0;
1199 for (QMap
<QString
, int>::Iterator it
= languages
.begin(); it
!= languages
.end(); ++it
)
1201 if (it
.key()[0].upper() != lang
[0].upper())
1203 pop
= new QPopupMenu();
1204 connect(pop
, SIGNAL(activated(int)), this, SLOT(slotLangFromISO6391Activated(int)));
1205 iso6391_popup
->insertItem(it
.key()[0].upper(), pop
, 1);
1209 QString shortid
= global_langset
.shortId(it
.data());
1210 QString short2id
= global_langset
.shortId2(it
.data());
1211 lang
+= "\t("+shortid
+")";
1212 QString pixmap
= global_langset
.PixMapFile(it
.data());
1213 if (pixmap
.isEmpty())
1214 pop
->insertItem(lang
, it
.data());
1216 pop
->insertItem(QPixmap(pixmap
), lang
, it
.data());
1220 void LanguageOptions::slotLangFromISO6391Activated(int id
)
1222 if (id
< (int)global_langset
.size())
1224 QString shortid
= global_langset
.shortId(id
);
1226 if (d_shortName
->contains(shortid
.stripWhiteSpace()))
1228 d_shortName
->setCurrentItem(shortid
);
1229 slotShortActivated(shortid
);
1233 d_shortName
->insertItem(shortid
.stripWhiteSpace());
1234 d_shortName
->setCurrentItem(d_shortName
->count()-1);
1235 slotShortActivated(shortid
);
1236 enableLangWidgets();
1238 e_shortName2
->setText(global_langset
.shortId2(id
));
1239 slotShort2Changed(global_langset
.shortId2(id
));
1241 e_langLong
->setText(global_langset
.longId(id
));
1242 slotLangChanged(e_langLong
->text());
1244 setPixmap(global_langset
.PixMapFile(id
));
1245 e_newName
->setText("");
1246 e_langLong
->setFocus();
1247 e_langLong
->selectAll();
1251 void LanguageOptions::updateWidgets()
1256 bool LanguageOptions::hasChanged()
1258 return m_hasChanged
;
1261 bool LanguageOptions::isDefault()
1266 void LanguageOptions::updateSettings()
1268 Prefs::setNumLangSet(m_langSet
.size());
1270 for (int i
= 0 ; i
< (int) m_langSet
.size(); i
++)
1272 LanguageSettings
languageSettings(QString::number(i
));
1273 languageSettings
.setShortId(m_langSet
.shortId(i
));
1274 languageSettings
.setShort2Id(m_langSet
.shortId2(i
));
1275 languageSettings
.setLongId(m_langSet
.longId(i
));
1276 languageSettings
.setPixmapFile(m_langSet
.PixMapFile(i
));
1277 languageSettings
.setKeyboardLayout(m_langSet
.keyboardLayout(i
));
1278 languageSettings
.writeConfig();
1280 m_hasChanged
= false;
1284 #include "languageoptions.moc"