mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-29 18:52:13 +01:00
Silently revert to system i18n language, if the currently selected language is not available.
This commit is contained in:
parent
448595d0b2
commit
ed41a67614
@ -28,14 +28,16 @@ public class I18n {
|
||||
static String PROMPT_OK;
|
||||
static String PROMPT_BROWSE;
|
||||
|
||||
static protected void init (String language) {
|
||||
static protected void init (String language) throws MissingResourceException {
|
||||
// there might be a null pointer exception ... most likely will never happen but the jvm gets mad
|
||||
try {
|
||||
if (language != null && language.trim().length() > 0) {
|
||||
Locale.setDefault(new Locale(language));
|
||||
Locale locale = new Locale(language);
|
||||
i18n = ResourceBundle.getBundle("processing.app.i18n.Resources", locale);
|
||||
Locale.setDefault(locale);
|
||||
} else {
|
||||
i18n = ResourceBundle.getBundle("processing.app.i18n.Resources", Locale.getDefault());
|
||||
}
|
||||
i18n = ResourceBundle.getBundle("processing.app.i18n.Resources", Locale.getDefault());
|
||||
|
||||
PROMPT_YES = _("Yes");
|
||||
PROMPT_NO = _("No");
|
||||
PROMPT_CANCEL = _("Cancel");
|
||||
|
@ -267,7 +267,12 @@ public class Preferences {
|
||||
}
|
||||
|
||||
// load the I18n module for internationalization
|
||||
I18n.init(Preferences.get("editor.languages.current"));
|
||||
try {
|
||||
I18n.init(Preferences.get("editor.languages.current"));
|
||||
} catch (MissingResourceException e) {
|
||||
I18n.init("");
|
||||
Preferences.set("editor.languages.current", "");
|
||||
}
|
||||
|
||||
// set some other runtime constants (not saved on preferences file)
|
||||
table.put("runtime.os", PConstants.platformNames[PApplet.platform]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user