Skip to content

UI text internationalization #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

UI text internationalization #44

wants to merge 2 commits into from

Conversation

sgk
Copy link
Contributor

@sgk sgk commented Oct 15, 2011

Internationalization for the user interface (menus, dialogs etc). The UI automatically switches according to the locale. I provided the text catalog for Japanese. You can easily add other languages.

Arduino is not only used for arts, but it is also widely used for education. When used for education, it is a little bit difficult to force students to also learn English in addition to Arduino itself. It is important to let world wide users to be able to use Arduino without learning English. This modification is exactly for this purpose.

The heart of modification is to just add files "I18n.java", "Resources.java", "i18n_update.py" and "i18n_update.sh", for the total of only 155 lines. Other modifications are just to wrap string literals with _(...) function. Concatenations of string and variable are converted to the call to I18n.format() function.

If you want to add a language locale "XX", you have to do as follows:

  1. % cd app/src/processing/app
  2. % touch Resources_XX.po
  3. % ./i18n_update.sh --- You can ignore a warning for "CHARSET" at this time.
  4. Edit "Resources_XX.po". Change "CHARSET" to "utf-8". Translate strings to language "XX".
  5. % ./i18n_update.sh --- again
  6. % git add Resources_XX.*

@damellis
Copy link
Contributor

Wow, very impressive!

I'd like to wait until after the final Arduino 1.0 release comes out before merging this - but it would be great to include after that.

One question / concern: what happens when we change the English version of a particular string? Do we then need to manually update the msgid in all of the language files? Would it be better to use shorter strings as keys and provide an English property file to map those to the appropriate messages?

@sgk
Copy link
Contributor Author

sgk commented Oct 23, 2011

I am sorry that I pushed unnecessary commits 957999c and 30891e8 as an accident. However, the code is still complete for the purpose of this pull request.

Thank you for considering to merge this pull request. I don't have an opinion for the schedule of merge. I can continue to release my privately built Japanese version binary packages until the official merge.

what happens when we change the English version of a particular string?
Do we then need to manually update the msgid in all of the language files?

"msgid" will be automatically updated by running "i18n_update.sh". However, the translated "msgstr" string will be discarded from the ".po" file. We have to provide the new "msgstr" string either by translating the new "msgid" or by picking up the old "msgstr" from the old ".po" file. Running "git diff -- *.po" helps to pick up the old string.

Would it be better to use shorter strings as keys and provide an English property file to map those to the appropriate messages?

This should be the widely discussed issue in the opensource software communities. It may be "perfect" to manage the all messages as short IDs. We don't lose any translated string by updating English messages. The message catalog should not clash by short words with double meanings (like "home", "back" etc). However, it costs a lot to maintain. Programmers have to see the catalog file in addition to the source code to understand the code. Translators have to see both English catalog file and their native language catalog file.

At this point, I think it should be better to use English string as msgid as we do currently.

@sgk
Copy link
Contributor Author

sgk commented Oct 25, 2011

I cleaned up the unnecessary commits and merges.

Shigeru KANEMOTO added 2 commits November 16, 2011 01:56
Wrapped the every string literals with _(...) function.
The _() function resides in "app/src/processing/app/I18n.java",
which translates the UI texts using "Resources_XX.properties" file
where XX is the locale code.

I provided the properties file for the ja (Japanese) locale.
I created this file using "xgettext" and "msgcat" commands.
"i18n_update.{py,sh}" files are the tool I used to do that.

Change in "app/build.xml" is to include the properties files
in jar file.
Imported from Processing development r6687 on
http://code.google.com/p/processing
Close #1
@damellis
Copy link
Contributor

damellis commented Dec 5, 2011

How do you actually specify which language to use / which properties file to load? Does the pull request need any updates for the latest code? If not, I'll go ahead and merge it.

@sgk
Copy link
Contributor Author

sgk commented Dec 6, 2011

How do you actually specify which language to use / which properties file to load?

See https://github.com/sgk/ArduinoIntl/commit/bfb57073334391d1536f4f3530a7517e047dac75#L7R19.
The ResourceBundle.getBundle(baseName, [locale]) method does everything. The baseName string and locale name string will be concatenated together with "_", and used as the properties file to be loaded. The locale argument can be omitted and defaults to the current system locale.

I set baseName as "processing.app.Resources"

Does the pull request need any updates for the latest code? If not, I'll go ahead and merge it.

No.

Although I followed and updated to your commits after I created this pull request, the pull request can be applied to any versions of your commits after I first made the pull request.

@damellis
Copy link
Contributor

damellis commented Dec 6, 2011

Thanks!

I merged this pull request. It was great to see the Arduino IDE come up in Japanese.

If I add you to the Arduino wiki on Google Code, can you write some instructions about how to create and update a translation file? Feel free to email me at [email protected] to coordinate.

Thanks again!

@damellis damellis closed this Dec 6, 2011
@sgk
Copy link
Contributor Author

sgk commented Dec 7, 2011

Thank you! All Japanese users will love the UI in native language.

Of course, I can write instructions about creating a new language catalog file.

tbowmo pushed a commit to tbowmo/Arduino that referenced this pull request Jul 14, 2016
fix a possible parent repeater loop
@per1234 per1234 added the Localization Adding support for specific regions or languages to the Arduino IDE label Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Localization Adding support for specific regions or languages to the Arduino IDE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants