spek

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

commit 5dacc190eb907eef7a5c1b97b6e2506b72c84cd7
parent fabf59fd68b80c69a4b8be6b8a7d0e2efe44a9e0
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Sat, 26 Mar 2011 22:16:53 +0800

Show the list of available language translations

Diffstat:
Msrc/spek-preferences-dialog.vala | 7+++++--
Msrc/spek-preferences.vala | 16++++++++++++++++
2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/spek-preferences-dialog.vala b/src/spek-preferences-dialog.vala @@ -20,6 +20,8 @@ using Gtk; namespace Spek { public class PreferencesDialog : Gtk.Dialog { + private Preferences prefs = new Preferences (); + public PreferencesDialog () { title = _("Preferences"); modal = true; @@ -45,8 +47,9 @@ namespace Spek { var language_label = new Label.with_mnemonic (_("_Language:")); language_box.pack_start (language_label, false, false, 0); var language_combo = new ComboBox.text (); - language_combo.append_text (_("(system default)")); - language_combo.append_text ("English"); + for (int i = 0; i < prefs.languages.length[0]; i++) { + language_combo.append_text (prefs.languages[i,1]); + } 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 @@ -20,7 +20,23 @@ namespace Spek { public class Preferences { 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"}, + {"es", "Español"}, + {"fr", "Français"}, + {"nl", "Nederlands"}, + {"pl", "Polski"}, + {"ru", "Русский"}, + {"sv", "Svenska"}, + {"uk", "Українська"} + }; + public Preferences () { + languages[0,1] = _("(system default)"); file_name = Path.build_filename (Environment.get_user_config_dir (), "spek"); DirUtils.create_with_parents (file_name, 0755); file_name = Path.build_filename (file_name, "config.ini");