本文整理汇总了Python中r2.lib.translation.iter_langs函数的典型用法代码示例。如果您正苦于以下问题:Python iter_langs函数的具体用法?Python iter_langs怎么用?Python iter_langs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了iter_langs函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build
def build(self, minifier):
Module.build(self, minifier)
with open(self.path) as f:
reddit_source = f.read()
localized_appendices = self.localized_appendices
msgids = extract_javascript_msgids(reddit_source)
if msgids:
localized_appendices = localized_appendices + [StringsSource(msgids)]
print >> sys.stderr, "Creating language-specific files:"
for lang, unused in iter_langs():
lang_path = LocalizedModule.languagize_path(self.path, lang)
# make sure we're not rewriting a different mangled file
# via symlink
if os.path.islink(lang_path):
os.unlink(lang_path)
with open(lang_path, "w") as out:
print >> sys.stderr, " " + lang_path
out.write(reddit_source)
for appendix in localized_appendices:
out.write(appendix.get_localized_source(lang) + ";")
示例2: build
def build(self, closure):
Module.build(self, closure)
reddit_source = open(self.path).read()
string_keys = re.findall("r\.strings\.([\w$_]+)", reddit_source)
print >> sys.stderr, "Creating language-specific files:"
for lang, unused in iter_langs():
strings = StringsSource(lang, string_keys)
source = strings.get_source()
lang_path = LocalizedModule.languagize_path(self.path, lang)
# make sure we're not rewriting a different mangled file
# via symlink
if os.path.islink(lang_path):
os.unlink(lang_path)
with open(lang_path, "w") as out:
print >> sys.stderr, " " + lang_path
out.write(reddit_source+source)
示例3: build
def build(self, closure):
Module.build(self, closure)
with open(self.path) as f:
reddit_source = f.read()
msgids = extract_javascript_msgids(reddit_source)
print >> sys.stderr, "Creating language-specific files:"
for lang, unused in iter_langs():
strings = StringsSource(lang, msgids)
lang_path = LocalizedModule.languagize_path(self.path, lang)
# make sure we're not rewriting a different mangled file
# via symlink
if os.path.islink(lang_path):
os.unlink(lang_path)
with open(lang_path, "w") as out:
print >> sys.stderr, " " + lang_path
out.write(reddit_source)
if self.inject_plural_forms:
out.write(strings.get_plural_forms())
out.write(strings.get_source())
示例4: outputs
def outputs(self):
for lang, unused in iter_langs():
yield LocalizedModule.languagize_path(self.path, lang)