weblate中使用的翻译文件查找程序。
translation-finder的Python项目详细描述
用于Weblate的翻译文件查找器,具有精简版本的翻译工具 控制集成。
此库由Weblate用于在克隆的 储存库。它可以在文件列表和实际文件系统上操作。 在某些情况下,需要文件系统访问才能更准确地检测 (检测类似文件的编码或实际语法)。
用法
可以从Python使用In:
>>>fromtranslation_finderimportdiscover>>>frompprintimportpprint>>>results=discover('translation_finder/test_data/')>>>len(results)19>>>pprint(results[0].match){'file_format':'aresource','filemask':'app/src/res/main/values-*/strings.xml','name':'android','template':'app/src/res/main/values/strings.xml'}>>>pprint(results[8].match){'file_format':'po','filemask':'locales/*.po','new_base':'locales/messages.pot'}
有关发现的其他信息可以从meta属性获得:
>>>pprint(results[0].meta){'discovery':'TransifexDiscovery','origin':'Transifex','priority':500}>>>pprint(results[8].meta){'discovery':'GettextDiscovery','origin':None,'priority':1000}
或命令行:
$ weblate-discovery translation_finder/test_data/ == Match 1 (Transifex) == file_format : aresource filemask : app/src/res/main/values-*/strings.xml name : android template : app/src/res/main/values/strings.xml ... == Match 7 == file_format : po filemask : locales/*.po new_base : locales/messages.pot