-
-
Notifications
You must be signed in to change notification settings - Fork 6
Translations
This is an update of the Localization wiki page from Processing 3. This page covers Localization and Internationalization for Processing 4.
We've put a huge amount of work into making it possible for Processing to run in multiple languages. Initially developed in the United States and first used publicly in a course in Japan, support for multiple locales has always been a huge priority. It's been great to see all the help from the community, which has provided several new languages and continued to refine them. Join us and contribute!
If you'd like to help the community by adding a new language or improving an existing translation, there are two options:
-
You can build the code and modify the
.properties
files insideprocessing/build/shared/lib/languages
to add or modify an existing language. When you have updates, submit a pull request with the updates. -
If you're not comfortable with building from source, look for the
languages
folder inside the Processing download.- On Windows and Linux, this is inside
lib/languages
- On macOS, this is inside
Processing.app/Contents/Java/lib/languages
. (You'll need to right-click Processing.app and select “Show Package Contents”)
Then modify the
.properties
file from inside that folder, and edit away. (First make a backup!) You'll need to restart Processing to see the changes. - On Windows and Linux, this is inside
Translations are stored in the lib/languages
folder inside the Processing download. If you'd like to see existing translations, you can see an online version here.
To translate to a new language, follow these steps:
- Copy the default translation from
languages/PDE.properties
tolanguages/PDE_xx.properties
wherexx
is the Java code for your language.- This should be the ISO 639-1 code.
- If needed, you can also specify a variant, for instance we have
PDE_zh-CN.properties
for Chinese (Simplified) andPDE_zh-TW.properties
(for Chinese (Traditional).
- Translate strings in the file you just copied (change only the text after the
=
sign) - Rebuild the project and restart Processing to see the changes
Processing 4.1 adds support for extended language tags, which made available a Traditional Chinese (zh_TW
) translation in addition to the previously available Simplified Chinese translation (originally zh
, now renamed to zh_CN
).
You can see the full list of supported language tags here. We will keep the existing two-digit tags in place for now, and update them as needed when new language translations are added.
To find missing strings in an existing translation, you can use this script.
Download it to the root of your Processing source code and make it executable:
curl https://gist.githubusercontent.com/federicobond/741d5c7df61191e13408/raw/d8862f2599fd26ba88833094548d4bd77a8f6b5f/missing.sh > missing.sh
chmod +x ./missing.sh
If you call it like this:
./missing.sh
It will show strings that are missing from the default English properties file (indented lines are those found in the .properties file but not in the codebase)
If you call it with a language code as an argument:
./missing.sh es
It will compare the keys for that language against the keys in the default language .properties file. Again, the behavior with regards to indented lines is similar: those lines appear in the corresponding language file but were removed from the default one.
You can get false positives occasionally from this tool, depending on how the actual code is split into lines. Be sure to check for usages in the source code before removing or renaming any obsolete key.
A few key bindings that cause trouble on local keyboards were moved to the language file. The syntax used for each of these comes from the KeyStroke documentation for Java 8.
Redo, Comment/Uncomment, Increase Indent, Decrease Indent (Editor.java
). Redo is also included because it has cross-platform differences between macOS, Windows, and Linux.
menu.edit.redo.keystroke.macos = shift meta pressed Z
menu.edit.redo.keystroke.windows = meta pressed Y
menu.edit.redo.keystroke.linux = shift ctrl pressed Z
menu.edit.comment_uncomment.keystroke.macos = meta pressed SLASH
menu.edit.comment_uncomment.keystroke.windows = ctrl pressed SLASH
menu.edit.comment_uncomment.keystroke.linux = ctrl pressed SLASH
menu.edit.increase_indent.keystroke.macosx = meta pressed CLOSE_BRACKET
menu.edit.increase_indent.keystroke.windows = ctrl pressed CLOSE_BRACKET
menu.edit.increase_indent.keystroke.linux = ctrl pressed CLOSE_BRACKET
menu.edit.decrease_indent.keystroke.macos = meta pressed OPEN_BRACKET
menu.edit.decrease_indent.keystroke.windows = ctrl pressed OPEN_BRACKET
menu.edit.decrease_indent.keystroke.linux = ctrl pressed OPEN_BRACKET
Previous Tab, Next Tab (EditorHeader.java
)
editor.header.previous_tab.keystroke.macos = meta alt pressed LEFT
editor.header.previous_tab.keystroke.windows = ctrl alt pressed LEFT
editor.header.previous_tab.keystroke.linux = ctrl pressed PAGE_UP
editor.header.next_tab.keystroke.macos = meta alt pressed RIGHT
editor.header.next_tab.keystroke.windows = ctrl alt pressed RIGHT
editor.header.next_tab.keystroke.linux = ctrl pressed PAGE_DOWN
Step, Step Into, and Step Out (JavaEditor.java
)
menu.debug.step.keystroke.macos = meta pressed J
menu.debug.step.keystroke.windows = ctrl pressed J
menu.debug.step.keystroke.linux = ctrl pressed J
menu.debug.step_into.keystroke.macos = shift meta pressed J
menu.debug.step_into.keystroke.windows = shift ctrl pressed J
menu.debug.step_into.keystroke.linux = shift ctrl pressed J
menu.debug.step_out.keystroke.macos = meta alt pressed J
menu.debug.step_out.keystroke.windows = ctrl alt pressed J
menu.debug.step_out.keystroke.linux = ctrl alt pressed J
It's also possible to override these settings in preferences.txt
. Leave the platform part of each key name off the end, for instance, add this line to use ctrl-Y for Redo:
menu.edit.redo.keystroke = ctrl pressed Y