Example #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)
Example #2
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)
Example #3
0
def getPoPathFromLocale(locale):
  return os.path.join(getLocaleDir(), '%s/LC_MESSAGES/messages.po' % locale)
Example #4
0
def getPoPathFromLocale(locale):
    return os.path.join(getLocaleDir(), '%s/LC_MESSAGES/messages.po' % locale)