comparison src/plugins/plugin_misc_text_syntaxes.py @ 771:bfabeedbf32e

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)
author Goffi <goffi@goffi.org>
date Sun, 29 Dec 2013 17:06:01 +0100
parents 312a2842b2b8
children 1fe00f0c9a91
comparison
equal deleted inserted replaced
770:64dd7c0f4feb 771:bfabeedbf32e
15 # GNU Affero General Public License for more details. 15 # GNU Affero General Public License for more details.
16 16
17 # You should have received a copy of the GNU Affero General Public License 17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 from sat.core.i18n import _, D_
20 from logging import debug, info, error, warning 21 from logging import debug, info, error, warning
21 22
22 from wokkel import disco, pubsub 23 from wokkel import disco, pubsub
23 from twisted.internet import defer 24 from twisted.internet import defer
24 from twisted.internet.threads import deferToThread 25 from twisted.internet.threads import deferToThread
26 from lxml import html 27 from lxml import html
27 from lxml.html import clean 28 from lxml.html import clean
28 import re 29 import re
29 30
30 31
31 CATEGORY = "Composition" 32 CATEGORY = D_("Composition")
32 NAME = "Syntax" 33 NAME = "Syntax"
33 _SYNTAX_XHTML = "XHTML" 34 _SYNTAX_XHTML = "XHTML"
34 _SYNTAX_CURRENT = "@CURRENT@" 35 _SYNTAX_CURRENT = "@CURRENT@"
35 36
36 # TODO: check/adapt following list 37 # TODO: check/adapt following list
83 </params> 84 </params>
84 """ 85 """
85 86
86 params_data = { 87 params_data = {
87 'category_name': CATEGORY, 88 'category_name': CATEGORY,
88 'category_label': _(CATEGORY), #FIXME: check that gettext can handle this 89 'category_label': _(CATEGORY),
89 'name': NAME, 90 'name': NAME,
90 'label': _(NAME), 91 'label': _(NAME),
91 'default': _SYNTAX_XHTML, 92 'default': _SYNTAX_XHTML,
92 'syntaxes': {}, 93 'syntaxes': {},
93 } 94 }