equal
deleted
inserted
replaced
94 """install i18n configuration for `lang` translation. |
94 """install i18n configuration for `lang` translation. |
95 |
95 |
96 Raises :exc:`KeyError` if translation doesn't exist. |
96 Raises :exc:`KeyError` if translation doesn't exist. |
97 """ |
97 """ |
98 self.lang = lang |
98 self.lang = lang |
99 gettext, pgettext = self.vreg.config.translations[lang] |
99 try: |
|
100 gettext, pgettext = self.vreg.config.translations[lang] |
|
101 except KeyError: |
|
102 assert self.vreg.config.mode == 'test' |
|
103 gettext = text_type |
|
104 |
|
105 def pgettext(x, y): |
|
106 return text_type(y) |
|
107 |
100 # use _cw.__ to translate a message without registering it to the catalog |
108 # use _cw.__ to translate a message without registering it to the catalog |
101 self._ = self.__ = gettext |
109 self._ = self.__ = gettext |
102 self.pgettext = pgettext |
110 self.pgettext = pgettext |
103 |
111 |
104 def get_option_value(self, option): |
112 def get_option_value(self, option): |