Skip to content
Ben Fry edited this page Jan 22, 2019 · 6 revisions

We've put a huge amount of work into making it possible for Processing 3 to run in multiple languages.

This has been an exciting improvement, and 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!

Two ways to get started

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 inside processing/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, simply make a folder called languages inside your sketchbook. Then copy one of the existing .properties files from your Processing download, and edit away. You'll probably need to restart Processing to see the changes.

Translating Processing to a new language

If you are translating to a new language, there are a couple of things you will need to setup first before it works.

  • Copy the default translation at build/shared/lib/languages/PDE.properties to build/shared/lib/languages/PDE_xx.properties where xx is the Java code for your language (usually the ISO 639-1 code).
  • Add your new language code to the build/shared/lib/languages/languages.txt file.
  • 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

Improving an existing translation

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.

Shortcuts and Key Bindings

Starting with Processing 3.5, a few key bindings that have been causing trouble on some keyboards have been moved to the language file. The syntax for each of these comes from the KeyStroke documentation for Java 8.

Redo, Comment/Uncomment, Increase Indent, Decrease Indent (Editor.java). Redo is included because it has cross-platform differences between Mac, Windows, and Linux.

menu.edit.redo.keystroke.macosx = 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.macosx = 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.macosx = 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.macosx = 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.macosx = 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.macosx = meta pressed J
menu.debug.step.keystroke.windows = ctrl pressed J
menu.debug.step.keystroke.linux = ctrl pressed J
menu.debug.step_into.keystroke.macosx = 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.macosx = 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, starting with Processing 3.5.2 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