mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Test import of pysollib.resource.
This commit is contained in:
parent
52cdff574b
commit
8acdff6b48
3 changed files with 39 additions and 1 deletions
|
@ -1,4 +1,41 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- mode: python; coding: utf-8; -*-
|
# -*- mode: python; coding: utf-8; -*-
|
||||||
|
|
||||||
|
import gettext
|
||||||
|
|
||||||
def n_(x):
|
def n_(x):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
def fix_gettext():
|
||||||
|
def ugettext(message):
|
||||||
|
# unicoded gettext
|
||||||
|
if not isinstance(message, unicode):
|
||||||
|
message = unicode(message, 'utf-8')
|
||||||
|
domain = gettext._current_domain
|
||||||
|
try:
|
||||||
|
t = gettext.translation(domain,
|
||||||
|
gettext._localedirs.get(domain, None))
|
||||||
|
except IOError:
|
||||||
|
return message
|
||||||
|
return t.ugettext(message)
|
||||||
|
gettext.ugettext = ugettext
|
||||||
|
def ungettext(msgid1, msgid2, n):
|
||||||
|
# unicoded ngettext
|
||||||
|
if not isinstance(msgid1, unicode):
|
||||||
|
msgid1 = unicode(msgid1, 'utf-8')
|
||||||
|
if not isinstance(msgid2, unicode):
|
||||||
|
msgid2 = unicode(msgid2, 'utf-8')
|
||||||
|
domain = gettext._current_domain
|
||||||
|
try:
|
||||||
|
t = gettext.translation(domain,
|
||||||
|
gettext._localedirs.get(domain, None))
|
||||||
|
except IOError:
|
||||||
|
if n == 1:
|
||||||
|
return msgid1
|
||||||
|
else:
|
||||||
|
return msgid2
|
||||||
|
return t.ungettext(msgid1, msgid2, n)
|
||||||
|
gettext.ungettext = ungettext
|
||||||
|
|
||||||
|
fix_gettext()
|
||||||
|
_ = gettext.ugettext
|
||||||
|
|
|
@ -29,6 +29,7 @@ import os, glob, traceback
|
||||||
from pysollib.mfxutil import Struct, KwStruct
|
from pysollib.mfxutil import Struct, KwStruct
|
||||||
from pysollib.settings import DEBUG
|
from pysollib.settings import DEBUG
|
||||||
|
|
||||||
|
from pysollib.mygettext import _
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# * Abstract
|
# * Abstract
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import os.path
|
import os.path
|
||||||
for module_name in ['pysollib.mfxutil', 'pysollib.move', 'pysollib.settings', 'pysollib.mygettext', 'pysollib.wizardpresets',]:
|
for module_name in ['pysollib.mfxutil', 'pysollib.move', 'pysollib.resource', 'pysollib.settings', 'pysollib.mygettext', 'pysollib.wizardpresets',]:
|
||||||
open(os.path.join(".", "tests", "individually-importing", "import_" + module_name + ".py"), 'w').write('''#!/usr/bin/env python
|
open(os.path.join(".", "tests", "individually-importing", "import_" + module_name + ".py"), 'w').write('''#!/usr/bin/env python
|
||||||
import sys
|
import sys
|
||||||
sys.path.append("./tests/lib")
|
sys.path.append("./tests/lib")
|
||||||
|
|
Loading…
Add table
Reference in a new issue