Skip to content

Commit 5089eb3

Browse files
committed
Merge pull request #315 from natural-law/v3
Solve the error when Auto Package Cocos Framework in jenkins environment.
2 parents fd06f4b + fdf3c0d commit 5089eb3

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

bin/cocos.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -869,22 +869,23 @@ def _check_python_version():
869869

870870
return ret
871871

872+
# gettext
873+
locale.setlocale(locale.LC_ALL, '') # use user's preferred locale
874+
language, encoding = locale.getlocale()
875+
if language is not None:
876+
filename = "language_%s.mo" % language[0:2]
877+
try:
878+
trans = gettext.GNUTranslations(open(filename, "rb"))
879+
except IOError:
880+
trans = gettext.NullTranslations()
881+
trans.install()
882+
_ = trans.gettext
883+
else:
884+
_ = MultiLanguage.get_string
872885

873886
if __name__ == "__main__":
874887
DataStatistic.stat_event('cocos', 'start', 'invoked')
875888

876-
# gettext
877-
locale.setlocale(locale.LC_ALL, '') # use user's preferred locale
878-
language, encoding = locale.getlocale()
879-
if language is not None:
880-
filename = "language_%s.mo" % language[0:2]
881-
try:
882-
trans = gettext.GNUTranslations(open(filename, "rb"))
883-
except IOError:
884-
trans = gettext.NullTranslations()
885-
trans.install()
886-
_ = trans.gettext
887-
888889
# Parse the arguments, specify the language
889890
language_arg = '--ol'
890891
if language_arg in sys.argv:

0 commit comments

Comments
 (0)