Fixes for use gettext in paramecio, deprecating old language system
This commit is contained in:
parent
fc15bd74bb
commit
2ba2ac6d37
11 changed files with 66 additions and 34 deletions
|
|
@ -1,9 +1,11 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from importlib import import_module
|
||||
import gettext
|
||||
#from paramecio.citoplasma.sessions import get_session
|
||||
import json
|
||||
from flask import session, has_request_context
|
||||
import os
|
||||
|
||||
yes_session=False
|
||||
|
||||
|
|
@ -28,6 +30,15 @@ def load_lang(*args):
|
|||
|
||||
# here load the language
|
||||
|
||||
def pgettext(module_file):
|
||||
|
||||
module=os.path.dirname(os.path.realpath(module_file))
|
||||
|
||||
base_name=os.path.dirname(os.path.realpath(module))
|
||||
|
||||
l=gettext.translation(os.path.basename(base_name), module+'/languages/', languages=I18n.dict_i18n, fallback=True)
|
||||
|
||||
return l.gettext
|
||||
|
||||
class I18n:
|
||||
"""Class for i18n tasks
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue