Skip to content

Translations

Ben Fry edited this page Sep 23, 2022 · 1 revision

This is an update of the Localization wiki page for Processing 3.

We've put a huge amount of work into making it possible for Processing to run in multiple languages. 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:

  1. 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.

  2. If you're not comfortable with building from source, simply make a folder called languages inside your sketchbook. Then copy a .properties file from the languages folder inside your Processing download, and edit away. You'll 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

…in the languages folder

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

…in the preferences.txt file

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