-
Notifications
You must be signed in to change notification settings - Fork 411
Internationalization
Flashlight.app
is currently translated into English, German, Spanish, Dutch, Chinese, French, Portuguese, Japanese, Italian, Turkish, Korean and Russian. If you're fluent in another language, it'd be awesome if you could translate it.
Flashlight is translated via the usual OS X app localization methods. You'll want to copy en.lproj, replace en
with your language code, and translate the strings in Localizable.strings
. See the German translation for an example.
Different parts of your plugin should be internationalized in different ways:
Info.json keys like displayName
and description
should be localized by adding new keys with names like displayName_zh
and description_zh
, where zh
is replaced with your language code. Do not translate categories
.
Examples.txt can be translated by adding new examples_zh.txt
files. Make sure to translate the commands and sample text, but not the field names. (e.g. 天气在 ~place(上海)
)
Strings that are returned by Python can be translated any way you'd like. The easiest way is probably to use Flashlight's i18n
module. The strings you're going to display to the user, put them in a file called strings_zh.json
, using the English phrases as keys and the translated phrases as values, and then call i18n.localstr("english text")
to get a local string. Do not create a strings_en.json
— just use English strings as keys.
Other files like HTML can be localized by copying them with names like myHTML_zh.html
, then getting the appropriate localized file's path by calling i18n.find_localized_path("myHTML.html")
. Don't create myHTML_en.html
— just use myHTML.html
for the English resource.
A good example of a localized plugin is the timezone plugin.
If you've got a plugin that's language-specific, you can add a preferred_locales
key to your info.json
file, supplying a list of OS X language codes that your plugin is specific to. For example:
...
"description": "Vertaalt woord van Engels naar Nederlands",
"examples": ["Vertaal car", "vertaal car naar Nederlands"],
"categories": ["Language"],
"preferred_locales": ["nl"],
...