| 167 | # the other time for the n-parameter of the ngettext function. |
| 168 | |
| 169 | def __init__(self, environment): |
| 170 | Extension.__init__(self, environment) |
| 171 | environment.globals['_'] = _gettext_alias |
| 172 | environment.extend( |
| 173 | install_gettext_translations=self._install, |
| 174 | install_null_translations=self._install_null, |
| 175 | install_gettext_callables=self._install_callables, |
| 176 | uninstall_gettext_translations=self._uninstall, |
| 177 | extract_translations=self._extract, |
| 178 | newstyle_gettext=False |
| 179 | ) |
| 180 | |
| 181 | def _install(self, translations, newstyle=None): |
| 182 | gettext = getattr(translations, 'ugettext', None) |