summaryrefslogtreecommitdiffstats
path: root/textw/language_text.py
blob: 191a90d5d11376c811273e53d7c0f7c6117b57f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#
# language_text.py: text mode language selection dialog
#
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007  Red Hat, Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

from snack import *
from constants_text import *

from constants import *
import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)

import logging
log = logging.getLogger("anaconda")

class LanguageWindow:
    def __call__(self, screen, anaconda):
        id = anaconda.id
        languages = id.instLanguage.available ()
        languages.sort()

        current = id.instLanguage.instLang

        height = min((8, len(languages)))
	buttons = [TEXT_OK_BUTTON, TEXT_BACK_BUTTON]

        translated = []
        for lang in languages:
            translated.append ((_(lang), id.instLanguage.getLangByName(lang)))
        (button, choice) = \
            ListboxChoiceWindow(screen, _("Language Selection"),
			_("What language would you like to use during the "
			  "installation process?"), translated, 
			buttons, width = 30, default = _(current), scroll = 1,
                                height = height, help = "lang")

        if button == TEXT_BACK_CHECK:
            return INSTALL_BACK

        if id.instLanguage.getFontFile(choice) == "none":
            ButtonChoiceWindow(screen, "Language Unavailable",
                               "%s display is unavailable in text mode.  The "
                               "installation will continue in English." % (choice,),
                               buttons=[TEXT_OK_BUTTON])
            id.instLanguage.instLang = choice
            id.instLanguage.systemLang = choice
            id.timezone.setTimezoneInfo(id.instLanguage.getDefaultTimeZone(anaconda.rootPath))
            return INSTALL_OK

        id.instLanguage.instLang = choice
        id.instLanguage.systemLang = choice
        id.timezone.setTimezoneInfo(id.instLanguage.getDefaultTimeZone(anaconda.rootPath))

	anaconda.intf.drawFrame()

        return INSTALL_OK