1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-17 22:23:10 +03:00

Merge branch 'master' of github.com:arduino/Arduino into LUFA_bootloader

This commit is contained in:
Zach Eveland
2012-04-09 08:25:43 -04:00
51 changed files with 58770 additions and 1438 deletions

View File

@ -169,6 +169,9 @@ public class Base {
// run static initialization that grabs all the prefs // run static initialization that grabs all the prefs
Preferences.init(null); Preferences.init(null);
// load the I18n module for internationalization
I18n.init(Preferences.get("editor.languages.current"));
// setup the theme coloring fun // setup the theme coloring fun
Theme.init(); Theme.init();

View File

@ -12,11 +12,25 @@
*/ */
package processing.app; package processing.app;
import java.util.*; import java.util.*;
import java.util.Locale.*;
import java.text.MessageFormat; import java.text.MessageFormat;
public class I18n { public class I18n {
// start using current locale but still allow using the dropdown list later
private static ResourceBundle i18n = ResourceBundle.getBundle("processing.app.Resources"); private static ResourceBundle i18n = ResourceBundle.getBundle("processing.app.Resources");
public static Locale locale;
static protected void init (String language) {
// 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 = Locale.getDefault();
else locale = new Locale(language);
i18n = ResourceBundle.getBundle("processing.app.Resources", locale);
} catch (java.lang.NullPointerException e) {
}
}
public static String _(String s) { public static String _(String s) {
try { try {

View File

@ -79,6 +79,51 @@ public class Preferences {
static final String PROMPT_OK = _("OK"); static final String PROMPT_OK = _("OK");
static final String PROMPT_BROWSE = _("Browse"); static final String PROMPT_BROWSE = _("Browse");
String[] languages = {
_("System Default"),
"Català" + " (" + _("Catalan") + ")",
"简体中文" + " (" + _("Chinese Simplified") + ")",
"繁體中文" + " (" + _("Chinese Traditional") + ")",
"Dansk" + " (" + _("Danish") + ")",
"Nederlands" + " (" + _("Dutch") + ")",
"English" + " (" + _("English") + ")",
"Français" + " (" + _("French") + ")",
"Pilipino" + " (" + _("Filipino") + ")",
"Galego" + " (" + _("Galician") + ")",
"Deutsch" + " (" + _("German") + ")",
"ελληνικά" + " (" + _("Greek") + ")",
"Magyar" + " (" + _("Hungarian") + ")",
"Italiano" + " (" + _("Italian") + ")",
"日本語" + " (" + _("Japanese") + ")",
"Latviešu" + " (" + _("Latvian") + ")",
"فارسی" + " (" + _("Persian") + ")",
"Português" + " (" + _("Portuguese") + ")",
"Română" + " (" + _("Romanian") + ")",
"русский" + " (" + _("Russian") + ")",
"Español" + " (" + _("Spanish") + ")"};
String[] languagesISO = {
"",
"ca",
"zh_cn",
"zh_tw",
"da",
"nl",
"en",
"fr",
"tl",
"gl",
"de",
"el",
"hu",
"it",
"ja",
"lv",
"fa",
"pt_br",
"ro",
"ru",
"es"};
/** /**
* Standardized width for buttons. Mac OS X 10.3 wants 70 as its default, * Standardized width for buttons. Mac OS X 10.3 wants 70 as its default,
* Windows XP needs 66, and my Ubuntu machine needs 80+, so 80 seems proper. * Windows XP needs 66, and my Ubuntu machine needs 80+, so 80 seems proper.
@ -124,6 +169,7 @@ public class Preferences {
JTextField fontSizeField; JTextField fontSizeField;
JCheckBox updateExtensionBox; JCheckBox updateExtensionBox;
JCheckBox autoAssociateBox; JCheckBox autoAssociateBox;
JComboBox comboLanguage;
// the calling editor, so updates can be applied // the calling editor, so updates can be applied
@ -270,9 +316,25 @@ public class Preferences {
top += vmax + GUI_BETWEEN; top += vmax + GUI_BETWEEN;
// Preferred language: [ ] (requires restart of Arduino)
Container box = Box.createHorizontalBox();
label = new JLabel(_("Editor language: "));
box.add(label);
comboLanguage = new JComboBox(languages);
comboLanguage.setSelectedIndex((Arrays.asList(languagesISO)).indexOf(Preferences.get("editor.languages.current")));
box.add(comboLanguage);
label = new JLabel(_(" (requires restart of Arduino)"));
box.add(label);
pain.add(box);
d = box.getPreferredSize();
box.setForeground(Color.gray);
box.setBounds(left, top, d.width, d.height);
right = Math.max(right, left + d.width);
top += d.height + GUI_BETWEEN;
// Editor font size [ ] // Editor font size [ ]
Container box = Box.createHorizontalBox(); box = Box.createHorizontalBox();
label = new JLabel(_("Editor font size: ")); label = new JLabel(_("Editor font size: "));
box.add(label); box.add(label);
fontSizeField = new JTextField(4); fontSizeField = new JTextField(4);
@ -350,7 +412,6 @@ public class Preferences {
top += d.height + GUI_BETWEEN; top += d.height + GUI_BETWEEN;
} }
// More preferences are in the ... // More preferences are in the ...
label = new JLabel(_("More preferences can be edited directly in the file")); label = new JLabel(_("More preferences can be edited directly in the file"));
@ -539,6 +600,11 @@ public class Preferences {
setBoolean("editor.update_extension", updateExtensionBox.isSelected()); setBoolean("editor.update_extension", updateExtensionBox.isSelected());
// adds the selected language to the preferences file
Object newItem = comboLanguage.getSelectedItem();
int pos = (Arrays.asList(languages)).indexOf(newItem.toString()); // position in the languages array
set("editor.languages.current",(Arrays.asList(languagesISO)).get(pos));
editor.applyPreferences(); editor.applyPreferences();
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -573,6 +573,7 @@
<tarfileset dir="../" <tarfileset dir="../"
prefix="arduino-${version}" prefix="arduino-${version}"
excludes="**/*.tgz, excludes="**/*.tgz,
**/*.bz2,
**/macosx/, **/macosx/,
**/windows/, **/windows/,
**/work/, **/work/,

View File

@ -255,3 +255,8 @@ serial.databits=8
serial.stopbits=1 serial.stopbits=1
serial.parity=N serial.parity=N
serial.debug_rate=9600 serial.debug_rate=9600
# I18 Preferences
# default chosen language (none for none)
editor.languages.current =