It now means "is text mode supported for this language?". It used to store which font we'd use to display the language, where "none" meant that text mode didn't work in that language. However, we don't ever set the font based upon that column and we shouldn't really ever be setting the font ourselves anyway. --- data/lang-table | 122 ++++++++++++++++---------------- loader/lang.c | 12 ++-- loader/lang.h | 3 +- pyanaconda/language.py | 14 ++--- pyanaconda/localeinfo.py | 6 +- pyanaconda/text.py | 13 ++-- pyanaconda/textw/language_text.py | 2 +- tests/pyanaconda_test/language_test.py | 22 +----- 8 files changed, 89 insertions(+), 105 deletions(-) diff --git a/data/lang-table b/data/lang-table index 50f7be1..465c3df 100644 --- a/data/lang-table +++ b/data/lang-table @@ -1,61 +1,61 @@ -Afrikaans af latarcyrheb-sun16 af_ZA.UTF-8 us Africa/Johannesburg -Arabic ar none ar_SA.UTF-8 us Asia/Riyadh -Assamese as none as_IN.UTF-8 us Asia/Kolkata -Bengali bn none bn_BD.UTF-8 us Asia/Dhaka -Bengali(India) bn_IN none bn_IN.UTF-8 us Asia/Kolkata -Bulgarian bg latarcyrheb-sun16 bg_BG.UTF-8 bg_bds-utf8 Europe/Sofia -Catalan ca latarcyrheb-sun16 ca_ES.UTF-8 es Europe/Madrid -Chinese(Simplified) zh_CN none zh_CN.UTF-8 us Asia/Shanghai -Chinese(Traditional) zh_TW none zh_TW.UTF-8 us Asia/Taipei -Croatian hr latarcyrheb-sun16 hr_HR.UTF-8 croat Europe/Zagreb -Czech cs latarcyrheb-sun16 cs_CZ.UTF-8 cz-lat2 Europe/Prague -Danish da latarcyrheb-sun16 da_DK.UTF-8 dk Europe/Copenhagen -Dutch nl latarcyrheb-sun16 nl_NL.UTF-8 nl Europe/Amsterdam -English en latarcyrheb-sun16 en_US.UTF-8 us America/New_York -Estonian et latarcyrheb-sun16 et_EE.UTF-8 et Europe/Tallinn -Finnish fi latarcyrheb-sun16 fi_FI.UTF-8 fi Europe/Helsinki -French fr latarcyrheb-sun16 fr_FR.UTF-8 fr-latin9 Europe/Paris -German de latarcyrheb-sun16 de_DE.UTF-8 de-latin1-nodeadkeys Europe/Berlin -Greek el iso07u-16 el_GR.UTF-8 gr Europe/Athens -Gujarati gu none gu_IN.UTF-8 us Asia/Kolkata -Hebrew he none he_IL.UTF-8 us Asia/Jerusalem -Hindi hi none hi_IN.UTF-8 us Asia/Kolkata -Hungarian hu latarcyrheb-sun16 hu_HU.UTF-8 hu Europe/Budapest -Icelandic is latarcyrheb-sun16 is_IS.UTF-8 is-latin1 Atlantic/Reykjavik -Iloko ilo latarcyrheb-sun16 ilo_PH.UTF-8 us Asia/Manila -Indonesian id latarcyrheb-sun16 id_ID.UTF-8 us Asia/Jakarta -Italian it latarcyrheb-sun16 it_IT.UTF-8 it Europe/Rome -Japanese ja none ja_JP.UTF-8 jp106 Asia/Tokyo -Kannada kn none kn_IN.UTF-8 us Asia/Kolkata -Korean ko none ko_KR.UTF-8 us Asia/Seoul -Macedonian mk latarcyrheb-sun16 mk_MK.UTF-8 mk Europe/Skopje -Maithili mai none mai_IN.UTF-8 us Asia/Kolkata -Malay ms latarcyrheb-sun16 ms_MY.UTF-8 us Asia/Kuala_Lumpur -Malayalam ml none ml_IN.UTF-8 us Asia/Kolkata -Marathi mr none mr_IN.UTF-8 us Asia/Kolkata -Nepali ne none ne_NP.UTF-8 us Asia/Kathmandu -Norwegian(Bokmål) nb latarcyrheb-sun16 nb_NO.UTF-8 no Europe/Oslo -Northern Sotho nso latarcyrheb-sun16 nso_ZA.UTF-8 us Africa/Johannesburg -Oriya or none or_IN.UTF-8 us Asia/Kolkata -Persian fa none fa_IR.UTF-8 us Asia/Tehran -Polish pl latarcyrheb-sun16 pl_PL.UTF-8 pl2 Europe/Warsaw -Portuguese pt latarcyrheb-sun16 pt_PT.UTF-8 pt-latin1 Europe/Lisbon -Portuguese(Brazilian) pt_BR latarcyrheb-sun16 pt_BR.UTF-8 br-abnt2 America/Sao_Paulo -Punjabi pa none pa_IN.UTF-8 us Asia/Kolkata -Romanian ro Lat2-Terminus16 ro_RO.UTF-8 ro Europe/Bucharest -Russian ru none ru_RU.UTF-8 ru Europe/Moscow -Serbian sr latarcyrheb-sun16 sr_RS.UTF-8 sr-cy Europe/Belgrade -Serbian(Latin) sr@latin latarcyrheb-sun16 sr_RS.UTF-8@latin sr-latin Europe/Belgrade -Sinhala si none si_LK.UTF-8 us Asia/Colombo -Slovak sk latarcyrheb-sun16 sk_SK.UTF-8 sk-qwerty Europe/Bratislava -Slovenian sl latarcyrheb-sun16 sl_SI.UTF-8 slovene Europe/Ljubljana -Spanish es latarcyrheb-sun16 es_ES.UTF-8 es Europe/Madrid -Swedish sv latarcyrheb-sun16 sv_SE.UTF-8 sv-latin1 Europe/Stockholm -Tajik tg none tg_TG.UTF-8 tj Asia/Dushanbe -Tamil ta none ta_IN.UTF-8 us Asia/Kolkata -Telugu te none te_IN.UTF-8 us Asia/Kolkata -Turkish tr latarcyrheb-sun16 tr_TR.UTF-8 trq Europe/Istanbul -Ukrainian uk latarcyrheb-sun16 uk_UA.UTF-8 ua-utf Europe/Kiev -Vietnamese vi latarcyrheb-sun16 vi_VN.UTF-8 us Asia/Saigon -Welsh cy latarcyrheb-sun16 cy_GB.UTF-8 uk Europe/London -Zulu zu latarcyrheb-sun16 zu_ZA.UTF-8 us Africa/Johannesburg +Afrikaans af True af_ZA.UTF-8 us Africa/Johannesburg +Arabic ar False ar_SA.UTF-8 us Asia/Riyadh +Assamese as False as_IN.UTF-8 us Asia/Kolkata +Bengali bn False bn_BD.UTF-8 us Asia/Dhaka +Bengali(India) bn_IN False bn_IN.UTF-8 us Asia/Kolkata +Bulgarian bg True bg_BG.UTF-8 bg_bds-utf8 Europe/Sofia +Catalan ca True ca_ES.UTF-8 es Europe/Madrid +Chinese(Simplified) zh_CN False zh_CN.UTF-8 us Asia/Shanghai +Chinese(Traditional) zh_TW False zh_TW.UTF-8 us Asia/Taipei +Croatian hr True hr_HR.UTF-8 croat Europe/Zagreb +Czech cs True cs_CZ.UTF-8 cz-lat2 Europe/Prague +Danish da True da_DK.UTF-8 dk Europe/Copenhagen +Dutch nl True nl_NL.UTF-8 nl Europe/Amsterdam +English en True en_US.UTF-8 us America/New_York +Estonian et True et_EE.UTF-8 et Europe/Tallinn +Finnish fi True fi_FI.UTF-8 fi Europe/Helsinki +French fr True fr_FR.UTF-8 fr-latin9 Europe/Paris +German de True de_DE.UTF-8 de-latin1-nodeadkeys Europe/Berlin +Greek el False el_GR.UTF-8 gr Europe/Athens +Gujarati gu False gu_IN.UTF-8 us Asia/Kolkata +Hebrew he False he_IL.UTF-8 us Asia/Jerusalem +Hindi hi False hi_IN.UTF-8 us Asia/Kolkata +Hungarian hu True hu_HU.UTF-8 hu Europe/Budapest +Icelandic is True is_IS.UTF-8 is-latin1 Atlantic/Reykjavik +Iloko ilo True ilo_PH.UTF-8 us Asia/Manila +Indonesian id True id_ID.UTF-8 us Asia/Jakarta +Italian it True it_IT.UTF-8 it Europe/Rome +Japanese ja False ja_JP.UTF-8 jp106 Asia/Tokyo +Kannada kn False kn_IN.UTF-8 us Asia/Kolkata +Korean ko False ko_KR.UTF-8 us Asia/Seoul +Macedonian mk True mk_MK.UTF-8 mk Europe/Skopje +Maithili mai False mai_IN.UTF-8 us Asia/Kolkata +Malay ms True ms_MY.UTF-8 us Asia/Kuala_Lumpur +Malayalam ml False ml_IN.UTF-8 us Asia/Kolkata +Marathi mr False mr_IN.UTF-8 us Asia/Kolkata +Nepali ne False ne_NP.UTF-8 us Asia/Kathmandu +Norwegian(Bokmål) nb True nb_NO.UTF-8 no Europe/Oslo +Northern Sotho nso True nso_ZA.UTF-8 us Africa/Johannesburg +Oriya or False or_IN.UTF-8 us Asia/Kolkata +Persian fa False fa_IR.UTF-8 us Asia/Tehran +Polish pl True pl_PL.UTF-8 pl2 Europe/Warsaw +Portuguese pt True pt_PT.UTF-8 pt-latin1 Europe/Lisbon +Portuguese(Brazilian) pt_BR True pt_BR.UTF-8 br-abnt2 America/Sao_Paulo +Punjabi pa False pa_IN.UTF-8 us Asia/Kolkata +Romanian ro False ro_RO.UTF-8 ro Europe/Bucharest +Russian ru False ru_RU.UTF-8 ru Europe/Moscow +Serbian sr True sr_RS.UTF-8 sr-cy Europe/Belgrade +Serbian(Latin) sr@latin True sr_RS.UTF-8@latin sr-latin Europe/Belgrade +Sinhala si False si_LK.UTF-8 us Asia/Colombo +Slovak sk True sk_SK.UTF-8 sk-qwerty Europe/Bratislava +Slovenian sl True sl_SI.UTF-8 slovene Europe/Ljubljana +Spanish es True es_ES.UTF-8 es Europe/Madrid +Swedish sv True sv_SE.UTF-8 sv-latin1 Europe/Stockholm +Tajik tg False tg_TG.UTF-8 tj Asia/Dushanbe +Tamil ta False ta_IN.UTF-8 us Asia/Kolkata +Telugu te False te_IN.UTF-8 us Asia/Kolkata +Turkish tr True tr_TR.UTF-8 trq Europe/Istanbul +Ukrainian uk True uk_UA.UTF-8 ua-utf Europe/Kiev +Vietnamese vi True vi_VN.UTF-8 us Asia/Saigon +Welsh cy True cy_GB.UTF-8 uk Europe/London +Zulu zu True zu_ZA.UTF-8 us Africa/Johannesburg diff --git a/loader/lang.c b/loader/lang.c index 0c66d90..0b8a76f 100644 --- a/loader/lang.c +++ b/loader/lang.c @@ -116,7 +116,7 @@ static void loadLanguageList(void) { char * file = "/etc/lang-table"; FILE * f; char line[256]; - char name[256], key[256], font[256], code[256], + char name[256], key[256], text_supported[256], code[256], keyboard[256], timezone[256]; int lineNum = 0; @@ -131,13 +131,13 @@ static void loadLanguageList(void) { lineNum++; languages = realloc(languages, sizeof(*languages) * (numLanguages + 1)); if (sscanf(line, "%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\n", - name, key, font, code, keyboard, timezone) != 6) { + name, key, text_supported, code, keyboard, timezone) != 6) { printf("bad line %d in lang-table", lineNum); logMessage(WARNING, "bad line %d in lang-table", lineNum); } else { languages[numLanguages].lang = strdup(name); languages[numLanguages].key = strdup(key); - languages[numLanguages].font = strdup(font); + languages[numLanguages].text_supported = !strcmp(text_supported, "True"); languages[numLanguages].lc_all = strdup(code); languages[numLanguages++].keyboard = strdup(keyboard); } @@ -238,7 +238,7 @@ static void setLangEnv (int i) { if (i > numLanguages) return; - if (strcmp(languages[i].font, "latarcyrheb-sun16")) + if (!languages[i].text_supported) return; logMessage(INFO, "setting language to %s", languages[i].lc_all); @@ -327,8 +327,8 @@ static int setupLanguage(int choice, int forced) { /* load the language only if it is displayable. if they're using * a serial console or iSeries vioconsole, we hope it's smart enough */ - if ((strcmp(languages[choice].font, "latarcyrheb-sun16") && !FL_SERIAL(flags) && - !FL_VIRTPCONSOLE(flags) && !isVioConsole())) { + if (!languages[choice].text_supported && !FL_SERIAL(flags) && + !FL_VIRTPCONSOLE(flags) && !isVioConsole()) { if (forced == 1) return 0; newtWinMessage("Language Unavailable", "OK", diff --git a/loader/lang.h b/loader/lang.h index d2f2d98..6531381 100644 --- a/loader/lang.h +++ b/loader/lang.h @@ -26,7 +26,8 @@ #define N_(foo) (foo) struct langInfo { - char * lang, * key, * font, * lc_all, * keyboard; + char * lang, * key, * lc_all, * keyboard; + unsigned int text_supported; } ; diff --git a/pyanaconda/language.py b/pyanaconda/language.py index 8a0d7f6..cb90085 100644 --- a/pyanaconda/language.py +++ b/pyanaconda/language.py @@ -46,7 +46,7 @@ class Language(object): self._instLang = self._canonLang(value) except ValueError: # If the language isn't listed in lang-table, we won't know what - # keyboard/font/etc. to use. However, we can still set the $LANG + # keyboard/etc. to use. However, we can still set the $LANG # to that and make sure it works in the installed system. self._instLang = value @@ -54,8 +54,7 @@ class Language(object): # to display. We need to default to en_US.UTF-8 for now. if self.displayMode == 't': for (lang, info) in self.localeInfo.iteritems(): - # If there's no font, it's not a supported language. - if lang == self._instLang and info[2] == "none": + if lang == self._instLang and info[2] == "False": self._instLang = self._default break @@ -77,8 +76,7 @@ class Language(object): def _getInstLang(self): # If we were given a language that's not in lang-table, lie and say # we're using the default. This prevents us from having to check all - # over the place. Unfortunately, it also means anaconda will be - # running with the wrong font and keyboard in these cases. + # over the place. if self._instLang in self.localeInfo.keys(): return self._instLang else: @@ -93,7 +91,7 @@ class Language(object): self._systemLang = self._canonLang(value) except ValueError: # If the language isn't listed in lang-table, we won't know what - # keyboard/font/etc. to use. However, we can still set the $LANG + # keyboard/etc. to use. However, we can still set the $LANG # to that and make sure it works in the installed system. self._systemLang = value @@ -214,9 +212,7 @@ class Language(object): else: return self.localeInfo[self._default][4] - def getFontFile(self, lang): - # Note: in /etc/fonts.cgz fonts are named by the map - # name as that's unique, font names are not + def textSupported(self, lang): try: l = self._canonLang(lang) except ValueError: diff --git a/pyanaconda/localeinfo.py b/pyanaconda/localeinfo.py index eefdf2e..334cadf 100644 --- a/pyanaconda/localeinfo.py +++ b/pyanaconda/localeinfo.py @@ -30,7 +30,7 @@ import string def get(default): localeInfo = {} - # nick -> (name, short name, font, keyboard, timezone) mapping + # nick -> (name, short name, text mode supported, keyboard, timezone) mapping search = ('lang-table', '/tmp/updates/lang-table', '/etc/lang-table', '/usr/share/anaconda/lang-table') for path in search: @@ -44,7 +44,9 @@ def get(default): if len(l) < 6: continue - localeInfo[l[3]] = (l[0], l[1], l[2], l[4], string.strip(l[5])) + ts = l[2] == "True" + + localeInfo[l[3]] = (l[0], l[1], ts, l[4], string.strip(l[5])) f.close() break diff --git a/pyanaconda/text.py b/pyanaconda/text.py index cb85bb5..1b201c1 100644 --- a/pyanaconda/text.py +++ b/pyanaconda/text.py @@ -487,13 +487,12 @@ class InstallInterface(InstallInterfaceBase): self.anaconda = anaconda instLang = anaconda.instLanguage - if instLang.getFontFile(instLang.instLang) == "none": - if not anaconda.ksdata: - ButtonChoiceWindow(self.screen, "Language Unavailable", - "%s display is unavailable in text mode. " - "The installation will continue in " - "English." % (instLang.instLang,), - buttons=[TEXT_OK_BUTTON]) + if not instLang.textSupported(instLang.instLang) and not anaconda.ksdata: + ButtonChoiceWindow(self.screen, "Language Unavailable", + "%s display is unavailable in text mode. " + "The installation will continue in " + "English." % (instLang.instLang,), + buttons=[TEXT_OK_BUTTON]) if not self.isRealConsole(): self.screen.suspendCallback(spawnShell, self.screen) diff --git a/pyanaconda/textw/language_text.py b/pyanaconda/textw/language_text.py index 5875266..7bbdf1e 100644 --- a/pyanaconda/textw/language_text.py +++ b/pyanaconda/textw/language_text.py @@ -51,7 +51,7 @@ class LanguageWindow: if button == TEXT_BACK_CHECK: return INSTALL_BACK - if anaconda.instLanguage.getFontFile(choice) == "none": + if not anaconda.instLanguage.textSupported(choice): ButtonChoiceWindow(screen, "Language Unavailable", "%s display is unavailable in text mode. The " "installation will continue in English." % (choice,), diff --git a/tests/pyanaconda_test/language_test.py b/tests/pyanaconda_test/language_test.py index daf500b..09e9ce6 100644 --- a/tests/pyanaconda_test/language_test.py +++ b/tests/pyanaconda_test/language_test.py @@ -184,29 +184,15 @@ class LanguageTest(mock.TestCase): ret = lang.getDefaultTimeZone() self.assertEqual(ret, 'Europe/Prague') - def get_font_file_1_test(self): + def get_text_supported_1_test(self): import pyanaconda.language lang = pyanaconda.language.Language() - ret = lang.getFontFile('cs') - self.assertEqual(ret, 'latarcyrheb-sun16') + self.assertTrue(lang.textSupported('cs')) - def get_font_file__2_test(self): + def get_text_supported_2_test(self): import pyanaconda.language lang = pyanaconda.language.Language() - ret = lang.getFontFile('en') - self.assertEqual(ret, 'latarcyrheb-sun16') - - def get_font_file__3_test(self): - import pyanaconda.language - lang = pyanaconda.language.Language() - ret = lang.getFontFile('he') - self.assertEqual(ret, 'none') - - def get_font_file__4_test(self): - import pyanaconda.language - lang = pyanaconda.language.Language() - ret = lang.getFontFile('foo') - self.assertEqual(ret, 'latarcyrheb-sun16') + self.assertFalse(lang.textSupported('he')) def get_lang_name_1_test(self): import pyanaconda.language -- 1.7.6 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list