Added language files for spanish, default is english
This commit is contained in:
parent
2f1d79ffc4
commit
9cd3ada7b4
9 changed files with 183 additions and 16 deletions
|
|
@ -29,7 +29,36 @@ def load_lang(*args):
|
|||
pass
|
||||
|
||||
# here load the language
|
||||
|
||||
class PGetText:
|
||||
|
||||
# Dict where all gettext domain are saved -> domain=name, example, admin, libraries, pastafari2, etc...
|
||||
|
||||
l={}
|
||||
|
||||
def __init__(self, module_file):
|
||||
|
||||
module_dir=os.path.dirname(os.path.realpath(module_file))
|
||||
|
||||
module_name=os.path.basename(module_dir)
|
||||
|
||||
if module_name not in PGetText.l:
|
||||
|
||||
PGetText.l[module_name]={}
|
||||
|
||||
for i in I18n.dict_i18n:
|
||||
|
||||
if i not in PGetText.l[module_name]:
|
||||
|
||||
PGetText.l[module_name][i]=gettext.translation(module_name, module_dir+'/languages/', languages=[i], fallback=True)
|
||||
PGetText.l[module_name][i].install()
|
||||
|
||||
self.module=module_name
|
||||
|
||||
def gettext(self, text):
|
||||
|
||||
return PGetText.l[self.module][I18n.get_default_lang()].gettext(text)
|
||||
|
||||
def pgettext(module_file):
|
||||
|
||||
module=os.path.dirname(os.path.realpath(module_file))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue