当前位置: 首页>>代码示例>>Python>>正文


Python translation.iter_langs函数代码示例

本文整理汇总了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) + ";")
开发者ID:ActivateServices,项目名称:reddit,代码行数:25,代码来源:js.py

示例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)
开发者ID:LDot,项目名称:reddit,代码行数:20,代码来源:js.py

示例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())
开发者ID:Elfmagi,项目名称:reddit,代码行数:24,代码来源:js.py

示例4: outputs

 def outputs(self):
     for lang, unused in iter_langs():
         yield LocalizedModule.languagize_path(self.path, lang)
开发者ID:Elfmagi,项目名称:reddit,代码行数:3,代码来源:js.py


注:本文中的r2.lib.translation.iter_langs函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。