Project

Profile

Help

Revision b54abeec

IDb54abeecc30243ccc3e2edc636a118c7e47f8a3a
Parent 9d5f9ca3
Child c861d8da

Added by Vincent Le Goff about 3 years ago

Translate the PreferencesDialog

View differences:

src/ui/dialogs/preferences.py
2 2

  
3 3
import wx
4 4

  
5
from ytranslate import t
6

  
5 7
class GeneralTab(wx.Panel):
6 8

  
7 9
    """General tab."""
......
18 20
        self.SetSizer(sizer)
19 21

  
20 22
        # Language selection
21
        l_languages = wx.StaticText(self, label="Language")
23
        l_languages = wx.StaticText(self, label=t("ui.dialog.general"))
22 24
        languages = wx.ListCtrl(self, style=wx.LC_REPORT | wx.LC_SINGLE_SEL)
23 25
        languages.InsertColumn(0, "Name")
24 26
        self.languages = languages
......
50 52
        return codes[index]
51 53

  
52 54

  
53
class TTSTab(wx.Panel):
55
class AccessibilityTab(wx.Panel):
54 56

  
55
    """TTS tab."""
57
    """Accessibility tab."""
56 58

  
57 59
    def __init__(self, parent, engine):
58
        super(TTSTab, self).__init__(parent)
60
        super(AccessibilityTab, self).__init__(parent)
59 61
        self.engine = engine
60 62

  
61 63
        self.InitUI()
......
63 65

  
64 66
    def InitUI(self):
65 67
        settings = self.engine.settings
66
        panel = wx.Panel(self)
67 68
        sizer = wx.GridBagSizer(15, 15)
68
        panel.SetSizer(sizer)
69
        self.SetSizer(sizer)
69 70

  
70 71
        # TTS preferendces
71
        self.TTS_on = wx.CheckBox(panel, label="Enable TTS (Text-To Speech)")
72
        self.TTS_on = wx.CheckBox(self, label=t("ui.dialog.TTS.on"))
72 73
        self.TTS_on.SetValue(settings["options.TTS.on"])
73
        self.TTS_outside = wx.CheckBox(panel, label="Enable TTS when on a different window")
74
        self.TTS_outside = wx.CheckBox(self, label=t("ui.dialog.TTS.outside"))
74 75
        self.TTS_outside.SetValue(settings["options.TTS.outside"])
75 76

  
76 77
        # Append to the sizer
......
86 87
        wx.Notebook.__init__(self, parent)
87 88

  
88 89
        general_tab = GeneralTab(self, engine)
89
        TTS_tab = TTSTab(self, engine)
90
        self.AddPage(general_tab, "General")
91
        self.AddPage(TTS_tab, "TTS")
90
        accessibility_tab = AccessibilityTab(self, engine)
91
        self.AddPage(general_tab, t("ui.dialog.general"))
92
        self.AddPage(accessibility_tab, t("ui.dialog.accessibility"))
92 93
        self.general = general_tab
93
        self.TTS = TTS_tab
94
        self.accessibility = accessibility_tab
94 95

  
95 96
class PreferencesDialog(wx.Dialog):
96 97

  
......
104 105
        self.Maximize()
105 106

  
106 107
    def InitUI(self):
107
        panel = wx.Panel(self)
108 108
        sizer = wx.GridBagSizer(15, 15)
109
        panel.SetSizer(sizer)
109
        self.SetSizer(sizer)
110 110

  
111 111
        # Add the tabs
112
        self.tabs = PreferencesTabs(panel, self.engine)
112
        self.tabs = PreferencesTabs(self, self.engine)
113 113
        buttons = self.CreateButtonSizer(wx.OK | wx.CANCEL)
114 114

  
115 115
        # Append to the sizer
......
127 127
        """Save the preferences."""
128 128
        settings = self.engine.settings
129 129
        general = self.tabs.general
130
        tts = self.tabs.TTS
130
        accessibility = self.tabs.accessibility
131 131
        new_language = general.get_selected_language()
132 132
        old_language = settings["options.general.language"]
133 133
        settings["options.general.language"] = new_language
134
        settings["options.TTS.on"] = tts.TTS_on.GetValue()
135
        settings["options.TTS.outside"] = tts.TTS_outside.GetValue()
134
        settings["options.TTS.on"] = accessibility.TTS_on.GetValue()
135
        settings["options.TTS.outside"] = accessibility.TTS_outside.GetValue()
136 136
        settings["options"].write()
137 137
        if old_language != new_language:
138
            wx.MessageBox("You have changed the CocoMUD anguage.  You " \
139
                    " to restart the application to see these changes.",
140
                    "Restart", wx.OK | wx.ICON_INFORMATION)
138
            wx.MessageBox(t("ui.dialog.message.update_language"),
139
                    t("ui.dialog.restart"), wx.OK | wx.ICON_INFORMATION)
141 140
        self.Destroy()
142 141

  
143 142
    def OnCancel(self, e):

Also available in: Unified diff