1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-18 07:52:14 +01:00

Adding "system default" (default locale) option for IDE language.

That is, if the editor.languages.current preference is empty (or
missing), use the default system locale.
This commit is contained in:
David A. Mellis 2012-04-08 15:06:24 -04:00
parent c03ea000a2
commit b816571772
2 changed files with 4 additions and 1 deletions

View File

@ -25,7 +25,8 @@ public class I18n {
static protected void init (String language) {
// there might be a null pointer exception ... most likely will never happen but the jvm gets mad
try {
locale = new Locale(language);
if (language == null || language.trim().isEmpty()) locale = Locale.getDefault();
else locale = new Locale(language);
i18n = ResourceBundle.getBundle("processing.app.Resources", locale);
} catch (java.lang.NullPointerException e) {
}

View File

@ -112,6 +112,7 @@ public class Preferences {
// language related arrays, please read notes later, where the language combo box is introduced
String[] languages = {
_("System Default"),
_("Catalan"),
_("Chinese Simplified"),
_("Chinese Taiwan"),
@ -133,6 +134,7 @@ public class Preferences {
_("Russian"),
_("Spanish")};
String[] languagesISO = {
"",
"ca",
"zh_cn",
"zh_tw",