示例#1
0
def createPOT():
  if not os.path.exists(getLocaleDir()):
    os.makedirs(getLocaleDir())

  # The default locale dir of webapp2 i18n is $PROJECT_DIR/locale
  # The default domain of webapp2 i18n is 'messages'
  # see http://webapp-improved.appspot.com/api/webapp2_extras/i18n.html#webapp2_extras.i18n.default_config
  cmd_xgettext = 'xgettext --no-wrap --from-code=UTF-8 --keyword=_ --output=%s/messages.pot `find %s -name *.html` `find %s -name *.html` `find %s -name *.html` `find %s -name *.html`' \
      % (getLocaleDir(), getDicHtmlDir(), getTpkHtmlDir(), getDicHtmlDir2(), getTpkHtmlDir2())
  cmd_sed = 'sed -i "s/charset=CHARSET/charset=utf-8/g" %s/messages.pot' % getLocaleDir()

  print(cmd_xgettext)
  os.system(cmd_xgettext)
  print(cmd_sed)
  os.system(cmd_sed)
示例#2
0
文件: i18nUtils.py 项目: sup6/pali
def createPOT():
    if not os.path.exists(getLocaleDir()):
        os.makedirs(getLocaleDir())

    # The default locale dir of webapp2 i18n is $PROJECT_DIR/locale
    # The default domain of webapp2 i18n is 'messages'
    # see http://webapp-improved.appspot.com/api/webapp2_extras/i18n.html#webapp2_extras.i18n.default_config
    cmd_xgettext = 'xgettext --no-wrap --from-code=UTF-8 --keyword=_ --output=%s/messages.pot `find %s -name *.html` `find %s -name *.html` `find %s -name *.html` `find %s -name *.html`' \
        % (getLocaleDir(), getDicHtmlDir(), getTpkHtmlDir(), getDicHtmlDir2(), getTpkHtmlDir2())
    cmd_sed = 'sed -i "s/charset=CHARSET/charset=utf-8/g" %s/messages.pot' % getLocaleDir(
    )

    print(cmd_xgettext)
    os.system(cmd_xgettext)
    print(cmd_sed)
    os.system(cmd_sed)
示例#3
0
def getPoPathFromLocale(locale):
  return os.path.join(getLocaleDir(), '%s/LC_MESSAGES/messages.po' % locale)
示例#4
0
文件: i18nUtils.py 项目: sup6/pali
def getPoPathFromLocale(locale):
    return os.path.join(getLocaleDir(), '%s/LC_MESSAGES/messages.po' % locale)