spek

Acoustic spectrum analyser
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

commit 2bc90c30a5b567fe89ef53771ca92c5a9c3e7001
parent f18acb72bd67aa59a865b54de4890f97417190b4
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Fri, 22 Apr 2011 19:17:23 +0800

i18n: Really fix '(system default)' translation

Diffstat:
Mdist/README | 2+-
Msrc/spek-preferences-dialog.vala | 24++++++++++++++++++++----
Msrc/spek-preferences.vala | 18------------------
3 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/dist/README b/dist/README @@ -9,7 +9,7 @@ Spek release checklist * `tx pull -a`. * Update the list of available languages, 80% or so will do: * po/LINGUAS - * src/spek-preferences.vala + * src/spek-preferences-dialog.vala * dist/win/bundle.sh * dist/osx/bundle.sh * Update AUTHORS using `git log X.Y.. --pretty=format:"%an <%ae>" | sort -u`. diff --git a/src/spek-preferences-dialog.vala b/src/spek-preferences-dialog.vala @@ -20,11 +20,27 @@ using Gtk; namespace Spek { public class PreferencesDialog : Gtk.Dialog { + // List all languages with a decent (e.g. 80%) number of translated + // strings. Don't translate language names. Keep the first line intact. + private static string[,] languages = { + {"", null}, + {"de", "Deutsch"}, + {"en", "English"}, + {"es", "Español"}, + {"fr", "Français"}, + {"nl", "Nederlands"}, + {"pl", "Polski"}, + {"ru", "Русский"}, + {"sv", "Svenska"}, + {"uk", "Українська"} + }; + public PreferencesDialog () { title = _("Preferences"); modal = true; resizable = false; window_position = WindowPosition.CENTER_ON_PARENT; + languages[0,1] = _("(system default)"); var alignment = new Alignment (0.5f, 0.5f, 1f, 1f); alignment.set_padding (12, 12, 12, 12); @@ -47,15 +63,15 @@ namespace Spek { var language_combo = new ComboBox.text (); int active_language = 0; var prefs = Preferences.instance; - for (int i = 0; i < prefs.languages.length[0]; i++) { - language_combo.append_text (prefs.languages[i,1]); - if (prefs.languages[i,0] == prefs.language) { + for (int i = 0; i < languages.length[0]; i++) { + language_combo.append_text (languages[i,1]); + if (languages[i,0] == prefs.language) { active_language = i; } } language_combo.active = active_language; language_combo.changed.connect ( - () => prefs.language = prefs.languages[language_combo.active,0]); + () => prefs.language = languages[language_combo.active,0]); language_label.mnemonic_widget = language_combo; language_box.pack_start (language_combo, false, false, 0); general_subbox.pack_start(language_box, false, false, 0); diff --git a/src/spek-preferences.vala b/src/spek-preferences.vala @@ -21,21 +21,6 @@ namespace Spek { private KeyFile key_file; private string file_name; - // List all languages with a decent (e.g. 80%) number of translated - // strings. Don't translate language names. Keep the first line intact. - public string[,] languages = { - {"", null}, - {"de", "Deutsch"}, - {"en", "English"}, - {"es", "Español"}, - {"fr", "Français"}, - {"nl", "Nederlands"}, - {"pl", "Polski"}, - {"ru", "Русский"}, - {"sv", "Svenska"}, - {"uk", "Українська"} - }; - private Preferences () { file_name = Path.build_filename (Environment.get_user_config_dir (), "spek"); DirUtils.create_with_parents (file_name, 0755); @@ -58,9 +43,6 @@ namespace Spek { if (_instance == null) { _instance = new Preferences (); } - if (_instance.languages[0,1] == null) { - _instance.languages[0,1] = _("(system default)"); - } return _instance; } }