macos“.localized”本地化文件夹名
mac-localized的Python项目详细描述
安装
$ [sudo] pip install mac-localized
工作原理
Release Notes.localized/
.localized/
en.strings
de.strings
ja.strings
Release Notes.localized/
.localized/
en.strings
de.strings
ja.strings
.strings
:
"Release Notes" = "Localized name";
函数
function | ^{ |
---|---|
^{ | return path with ^{ |
^{ | return translation |
^{ | return dictionary with keys as languages and translations with values |
^{ | mkdir (if not exists), write translations and return folder fullpath |
^{ | return folder name without ^{ |
^{ | rm .localized/ lang files or .localized/ folder |
^{ | update folder translations |
^{ | return a list with ^{ |
^{ | return dictionary with keys as languages and translations with values |
示例
>>>importmac_localized>>>mac_localized.mkdir("folder",ru="ru translation",de="de translation")'folder.localized'>>>mac_localized.load("folder"){'ru':'ru translation','de':'de translation'}>>>mac_localized.update("folder",ru="new ru translation",de="new de translation")>>>mac_localized.get("folder","ru")'new ru translation'>>>mac_localized.rm("folder",["ru"])>>>mac_localized.rm("folder")# rm all localizations