1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-20 21:01:25 +03:00

Renamed resouces boundles he and id to iw and in respectively

Removed try catch around i18n.init
This commit is contained in:
Federico Fissore
2013-10-02 17:52:46 +02:00
parent 8028cc38e7
commit 9a10a22bc3
3 changed files with 21 additions and 25 deletions

View File

@ -31,27 +31,23 @@ public class I18n {
static String PROMPT_BROWSE; static String PROMPT_BROWSE;
static protected void init(String language) throws MissingResourceException { 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 String[] languageParts = language.split("_");
try { Locale locale = Locale.getDefault();
String[] languageParts = language.split("_"); // both language and country
Locale locale = Locale.getDefault(); if (languageParts.length == 2) {
// both language and country locale = new Locale(languageParts[0], languageParts[1]);
if (languageParts.length == 2) { // just language
locale = new Locale(languageParts[0], languageParts[1]); } else if (languageParts.length == 1 && !"".equals(languageParts[0])) {
// just language locale = new Locale(languageParts[0]);
} else if (languageParts.length == 1 && !"".equals(languageParts[0])) {
locale = new Locale(languageParts[0]);
}
// there might be a null pointer exception ... most likely will never happen but the jvm gets mad
Locale.setDefault(locale);
i18n = ResourceBundle.getBundle("processing.app.i18n.Resources", Locale.getDefault());
PROMPT_YES = _("Yes");
PROMPT_NO = _("No");
PROMPT_CANCEL = _("Cancel");
PROMPT_OK = _("OK");
PROMPT_BROWSE = _("Browse");
} catch (java.lang.NullPointerException e) {
} }
// there might be a null pointer exception ... most likely will never happen but the jvm gets mad
Locale.setDefault(locale);
i18n = ResourceBundle.getBundle("processing.app.i18n.Resources", Locale.getDefault());
PROMPT_YES = _("Yes");
PROMPT_NO = _("No");
PROMPT_CANCEL = _("Cancel");
PROMPT_OK = _("OK");
PROMPT_BROWSE = _("Browse");
} }
public static String _(String s) { public static String _(String s) {