本地化.strings读写器
localizablestrings的Python项目详细描述
本地化字符串
Xcode项目使用的可本地化.strings文件的简单读写器。
安装
pip install localizablestrings
用法
fromlocalizablestringsimportStringsFile,Translationsf=StringsFile('/path/to/Localizable.strings')fortranslationinsf:print(f'Key = {translation.key}\nValue = {translation.value}\nComment = {translation.comment}')ifsf.get_translation('spam')isNone:new_translation=Translation(key='spam',value='eggs',comment='Needs more bacon')sf.add_translation(new_translation)sf.write()