diff --git a/src/locale/fr_FR/LC_MESSAGES/manjaro-hello.mo b/src/locale/fr_FR/LC_MESSAGES/manjaro-hello.mo
index 7b5a17b..a49fb22 100644
Binary files a/src/locale/fr_FR/LC_MESSAGES/manjaro-hello.mo and b/src/locale/fr_FR/LC_MESSAGES/manjaro-hello.mo differ
diff --git a/src/locale/fr_FR/LC_MESSAGES/manjaro-hello.po b/src/locale/fr_FR/LC_MESSAGES/manjaro-hello.po
index 886678c..b3e54d9 100644
--- a/src/locale/fr_FR/LC_MESSAGES/manjaro-hello.po
+++ b/src/locale/fr_FR/LC_MESSAGES/manjaro-hello.po
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2016-12-09 17:26+0100\n"
-"PO-Revision-Date: 2016-12-09 17:26+0100\n"
+"POT-Creation-Date: 2016-12-10 23:59+0100\n"
+"PO-Revision-Date: 2016-12-10 23:59+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr_FR\n"
@@ -30,11 +30,11 @@ msgstr "Écran de bienvenue pour Manjaro"
msgid "Github"
msgstr "Github"
-#: manjaro-hello.glade:104
+#: manjaro-hello.glade:103
msgid "Welcome to Manjaro!"
msgstr "Bienvenue sur Manjaro !"
-#: manjaro-hello.glade:121
+#: manjaro-hello.glade:120
msgid ""
"Thank you for joining our community!\n"
"\n"
@@ -51,86 +51,84 @@ msgstr ""
"Alors profitez de l'expérience, et n'hésitez pas à nous faire part de vos "
"commentaires."
-#: manjaro-hello.glade:138
+#: manjaro-hello.glade:137
msgid "DOCUMENTATION"
msgstr "DOCUMENTATION"
-#: manjaro-hello.glade:152
+#: manjaro-hello.glade:151
msgid "SUPPORT"
msgstr "SUPPORT"
-#: manjaro-hello.glade:166
+#: manjaro-hello.glade:165
msgid "PROJECT"
msgstr "PROJET"
-#: manjaro-hello.glade:178 manjaro-hello.glade:542
+#: manjaro-hello.glade:177 manjaro-hello.glade:537
msgid "Read me"
msgstr "Lisez moi"
-#: manjaro-hello.glade:192 manjaro-hello.glade:582
+#: manjaro-hello.glade:191 manjaro-hello.glade:577
msgid "Release info"
msgstr "Informations de version"
-#: manjaro-hello.glade:206
+#: manjaro-hello.glade:205
msgid "Wiki"
msgstr "Wiki"
-#: manjaro-hello.glade:220 manjaro-hello.glade:643
+#: manjaro-hello.glade:219 manjaro-hello.glade:638
msgid "Get involved"
msgstr "S'investir"
-#: manjaro-hello.glade:234
+#: manjaro-hello.glade:233
msgid "Forums"
msgstr "Forums"
-#: manjaro-hello.glade:248
+#: manjaro-hello.glade:247
msgid "Chat room"
msgstr "Salon de chat"
-#: manjaro-hello.glade:262
+#: manjaro-hello.glade:261
msgid "Mailling lists"
msgstr "Listes de diffusion"
-#: manjaro-hello.glade:276
+#: manjaro-hello.glade:275
msgid "Build Manjaro"
msgstr "Construire Manjaro"
-#: manjaro-hello.glade:290
+#: manjaro-hello.glade:289
msgid "Donate"
msgstr "Faire un don"
-#: manjaro-hello.glade:406
+#: manjaro-hello.glade:401
msgid "Launch at start"
msgstr "Lancer au démarrage"
-#: manjaro-hello.glade:443
+#: manjaro-hello.glade:438
msgid "Use Calamares (Graphic method)"
msgstr "Utiliser Calamares (Méthode graphique)"
-#: manjaro-hello.glade:457
+#: manjaro-hello.glade:452
msgid "Use CLI-Installer (Command line)"
msgstr "Utiliser CLI-Installer (Ligne de commande)"
-#: manjaro-hello.glade:479
+#: manjaro-hello.glade:474
msgid "INSTALLATION"
msgstr "INSTALLATION"
-#: manjaro-hello.glade:498
+#: manjaro-hello.glade:493
msgid "Welcome"
msgstr "Bienvenue"
-#: manjaro-hello.glade:598
+#: manjaro-hello.glade:593
msgid "Documentation"
msgstr "Documentation"
-#: manjaro-hello.glade:664
+#: manjaro-hello.glade:659
msgid "Project"
msgstr "Projet"
-#: manjaro-hello.glade:687
-msgid "English (United States)"
-msgstr "Anglais (États-Unis)"
+#~ msgid "English (United States)"
+#~ msgstr "Anglais (États-Unis)"
-#: manjaro-hello.glade:688
-msgid "French (France)"
-msgstr "Français (France)"
+#~ msgid "French (France)"
+#~ msgstr "Français (France)"
diff --git a/src/manjaro-hello.glade b/src/manjaro-hello.glade
index 9895582..989b2c4 100644
--- a/src/manjaro-hello.glade
+++ b/src/manjaro-hello.glade
@@ -75,7 +75,7 @@
False
crossfade
-
-
+
True
False
Welcome to Manjaro!
@@ -113,7 +113,7 @@
-
+
True
False
True
@@ -131,7 +131,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
-
+
True
False
DOCUMENTATION
@@ -145,7 +145,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
-
+
True
False
SUPPORT
@@ -159,7 +159,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
-
+
True
False
PROJECT
@@ -173,7 +173,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
-
+
Read me
readmebtn
True
@@ -187,7 +187,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
-
+
Release info
releasebtn
True
@@ -201,7 +201,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
-
+
Wiki
wikibtn
True
@@ -215,7 +215,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
-
+
Get involved
involvedbtn
True
@@ -229,7 +229,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
-
+
Forums
forumsbtn
True
@@ -243,7 +243,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
-
+
Chat room
chatbtn
True
@@ -257,7 +257,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
-
+
Mailling lists
maillingbtn
True
@@ -271,7 +271,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
-
+
Build Manjaro
buildbtn
True
@@ -285,7 +285,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
-
+
Donate
donatebtn
True
@@ -394,7 +394,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
-
+
True
False
end
@@ -531,7 +531,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
-
+
True
False
Read me
@@ -571,7 +571,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
-
+
True
False
Release info
@@ -632,7 +632,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
-
+
True
False
Get involved
@@ -679,8 +679,8 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
True
False
- - English (United States)
- - French (France)
+ - English (United States)
+ - Français (France)
diff --git a/src/manjaro-hello.pot b/src/manjaro-hello.pot
index 23100ec..07140d3 100644
--- a/src/manjaro-hello.pot
+++ b/src/manjaro-hello.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2016-12-09 17:26+0100\n"
+"POT-Creation-Date: 2016-12-10 23:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -29,11 +29,11 @@ msgstr ""
msgid "Github"
msgstr ""
-#: manjaro-hello.glade:104
+#: manjaro-hello.glade:103
msgid "Welcome to Manjaro!"
msgstr ""
-#: manjaro-hello.glade:121
+#: manjaro-hello.glade:120
msgid ""
"Thank you for joining our community!\n"
"\n"
@@ -43,86 +43,78 @@ msgid ""
"your feedback."
msgstr ""
-#: manjaro-hello.glade:138
+#: manjaro-hello.glade:137
msgid "DOCUMENTATION"
msgstr ""
-#: manjaro-hello.glade:152
+#: manjaro-hello.glade:151
msgid "SUPPORT"
msgstr ""
-#: manjaro-hello.glade:166
+#: manjaro-hello.glade:165
msgid "PROJECT"
msgstr ""
-#: manjaro-hello.glade:178 manjaro-hello.glade:542
+#: manjaro-hello.glade:177 manjaro-hello.glade:537
msgid "Read me"
msgstr ""
-#: manjaro-hello.glade:192 manjaro-hello.glade:582
+#: manjaro-hello.glade:191 manjaro-hello.glade:577
msgid "Release info"
msgstr ""
-#: manjaro-hello.glade:206
+#: manjaro-hello.glade:205
msgid "Wiki"
msgstr ""
-#: manjaro-hello.glade:220 manjaro-hello.glade:643
+#: manjaro-hello.glade:219 manjaro-hello.glade:638
msgid "Get involved"
msgstr ""
-#: manjaro-hello.glade:234
+#: manjaro-hello.glade:233
msgid "Forums"
msgstr ""
-#: manjaro-hello.glade:248
+#: manjaro-hello.glade:247
msgid "Chat room"
msgstr ""
-#: manjaro-hello.glade:262
+#: manjaro-hello.glade:261
msgid "Mailling lists"
msgstr ""
-#: manjaro-hello.glade:276
+#: manjaro-hello.glade:275
msgid "Build Manjaro"
msgstr ""
-#: manjaro-hello.glade:290
+#: manjaro-hello.glade:289
msgid "Donate"
msgstr ""
-#: manjaro-hello.glade:406
+#: manjaro-hello.glade:401
msgid "Launch at start"
msgstr ""
-#: manjaro-hello.glade:443
+#: manjaro-hello.glade:438
msgid "Use Calamares (Graphic method)"
msgstr ""
-#: manjaro-hello.glade:457
+#: manjaro-hello.glade:452
msgid "Use CLI-Installer (Command line)"
msgstr ""
-#: manjaro-hello.glade:479
+#: manjaro-hello.glade:474
msgid "INSTALLATION"
msgstr ""
-#: manjaro-hello.glade:498
+#: manjaro-hello.glade:493
msgid "Welcome"
msgstr ""
-#: manjaro-hello.glade:598
+#: manjaro-hello.glade:593
msgid "Documentation"
msgstr ""
-#: manjaro-hello.glade:664
+#: manjaro-hello.glade:659
msgid "Project"
msgstr ""
-
-#: manjaro-hello.glade:687
-msgid "English (United States)"
-msgstr ""
-
-#: manjaro-hello.glade:688
-msgid "French (France)"
-msgstr ""
diff --git a/src/manjaro-hello.py b/src/manjaro-hello.py
index d8d6d63..d7efd65 100644
--- a/src/manjaro-hello.py
+++ b/src/manjaro-hello.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-from locale import gettext as _
+import gettext
import gi
import json
import locale
@@ -53,7 +53,17 @@ class ManjaroHello():
"locale": None
}
+ # Load system infos
+ self.infos = get_infos()
+
+ # Init window
+ self.builder = Gtk.Builder()
+ self.builder.add_from_file("manjaro-hello.glade")
+ self.builder.connect_signals(self)
+ self.window = self.builder.get_object("window")
+
# Init translation
+ self.default_texts = {}
locales = os.listdir(self.locale_path)
locales.append(self.default_locale)
if self.preferences["locale"] not in locales:
@@ -62,26 +72,18 @@ class ManjaroHello():
else:
self.preferences["locale"] = self.default_locale
- locale.setlocale(locale.LC_ALL, self.preferences["locale"] + ".utf8")
- locale.bindtextdomain(self.app, self.locale_path)
- locale.textdomain(self.app)
+ # Select current locale in languages menu
+ self.builder.get_object("languages").set_active_id(self.preferences["locale"]);
+ self.builder.get_object("languages").connect("changed", self.on_languages_changed)
+
+ # Make translation
+ gettext.bindtextdomain(self.app, self.locale_path)
+ gettext.textdomain(self.app)
+ self.set_locale(self.preferences["locale"])
# Save locale used in config file
self.save_preferences()
- # Load system infos
- self.infos = get_infos()
-
- # Init window
- self.builder = Gtk.Builder()
- self.builder.set_translation_domain(self.app)
- self.builder.add_from_file("manjaro-hello.glade")
- self.builder.connect_signals(self)
- self.window = self.builder.get_object("window")
-
- # Select current locale in languages menu
- self.builder.get_object("languages").set_active_id(self.preferences["locale"]);
- self.builder.get_object("languages").connect("changed", self.on_languages_changed)
# Set window subtitle
if self.infos["codename"] and self.infos["release"]:
@@ -115,6 +117,49 @@ class ManjaroHello():
self.window.show();
+ def set_locale(self, locale_code):
+ if self.preferences["locale"] != self.default_locale:
+ locale = gettext.translation(self.app, self.locale_path, [locale_code])
+ locale.install()
+ else:
+ gettext.install(self.app)
+
+ # Dirty code to fix an issue with gettext that can't translate text from glade interface
+ # TODO: Find a better solution
+ elts = {
+ "welcomelabel": "label",
+ "welcometext": "label",
+ "documentationtitle": "label",
+ "readmelabel": "label",
+ "releaselabel": "label",
+ "involvedlabel": "label",
+ "supporttitle": "label",
+ "projecttitle": "label",
+ "readmebtn": "label",
+ "releasebtn": "label",
+ "wikibtn": "label",
+ "involvedbtn": "label",
+ "forumsbtn": "label",
+ "chatbtn": "label",
+ "maillingbtn": "label",
+ "buildbtn": "label",
+ "donatebtn": "label",
+ "installlabel": "label",
+ "installgui": "label",
+ "installcli": "label",
+ "autostartlabel": "label",
+ "aboutdialog": "comments"
+ }
+ for elt in elts:
+ if elt not in self.default_texts:
+ self.default_texts[elt] = getattr(self.builder.get_object(elt), "get_" + elts[elt])()
+ getattr(self.builder.get_object(elt), "set_" + elts[elt])(_(self.default_texts[elt]))
+
+ for stack in ("welcome", "documentation", "project"):
+ if stack not in self.default_texts:
+ self.default_texts[stack] = self.builder.get_object("stack").child_get_property(self.builder.get_object(stack), "title")
+ self.builder.get_object("stack").child_set_property(self.builder.get_object(stack), "title", _(self.default_texts[stack]))
+
def change_autostart(self, state):
if state and not os.path.isfile(self.autostart_path):
try:
@@ -156,8 +201,8 @@ class ManjaroHello():
# Handlers
def on_languages_changed(self, combobox):
self.preferences["locale"] = combobox.get_active_id()
+ self.set_locale(self.preferences["locale"])
self.save_preferences()
- os.execv(sys.executable, ['python'] + sys.argv)
def on_about_clicked(self, btn):
dialog = self.builder.get_object("aboutdialog")