core: i18n refactoring:

- _() is no more installed in __builtin__
    - instead, there is a new sat.core.i18n module
    - added D_() method for deferred translation
    - languageSwitch method allow to dynamically change translation language
    - import gettext is tested against ImportError, and dummy methods are used when not available (mainly useful for Libervia)
This commit is contained in:
Goffi 2013-12-29 17:06:01 +01:00
commit 5a00dc9503
75 changed files with 123 additions and 19 deletions

View file

@ -17,6 +17,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from sat.core.i18n import _, D_
from logging import debug, info, error, warning
from wokkel import disco, pubsub
@ -28,7 +29,7 @@ from lxml.html import clean
import re
CATEGORY = "Composition"
CATEGORY = D_("Composition")
NAME = "Syntax"
_SYNTAX_XHTML = "XHTML"
_SYNTAX_CURRENT = "@CURRENT@"
@ -85,7 +86,7 @@ class TextSyntaxes(object):
params_data = {
'category_name': CATEGORY,
'category_label': _(CATEGORY), #FIXME: check that gettext can handle this
'category_label': _(CATEGORY),
'name': NAME,
'label': _(NAME),
'default': _SYNTAX_XHTML,