]> git.ipfire.org Git - people/bonnietwin/ipfire-2.x.git/commitdiff
installer: Rewrite language selection.
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 12 Aug 2014 13:09:47 +0000 (15:09 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 12 Aug 2014 13:11:39 +0000 (15:11 +0200)
src/installer/Makefile.am
src/installer/configure.ac
src/installer/dracut-module/module-setup.sh
src/installer/main.c
src/installer/po/LINGUAS [new file with mode: 0644]
src/installer/po/Makevars [new file with mode: 0644]
src/installer/po/POTFILES.in [new file with mode: 0644]
src/installer/po/de.po [new file with mode: 0644]

index 14436f0a458381a566eea0741fc70ff4e3c23843..259db0610679b635f5158e9b63895ca8accae359 100644 (file)
@@ -1,6 +1,6 @@
-#  This file is part of the libsmooth library.
+#  This file is part of the installer.
 #
-#  libsmooth is free software; you can redistribute it and/or modify it
+#  installer is free software; you can redistribute it and/or modify it
 #  under the terms of the GNU Lesser General Public License as published by
 #  the Free Software Foundation; either version 2.1 of the License, or
 #  (at your option) any later version.
@@ -9,7 +9,7 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
 AM_MAKEFLAGS = --no-print-directory
 AUTOMAKE_OPTIONS = color-tests parallel-tests
 
-SUBDIRS = .
+SUBDIRS = . po
 
 # remove targets if the command fails
 .DELETE_ON_ERROR:
index 9a3c45529a658604fa6b467d18a2e4ccf8400192..da968f637f009085b390a63cf8f952efbb2224c0 100644 (file)
@@ -41,6 +41,9 @@ AC_PROG_CC_C_O
 
 AC_PATH_PROG([M4], [m4])
 
+# Gettext
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION([0.18])
 AC_CHECK_HEADERS([libintl.h])
 
 # This makes sure pkg.m4 is available.
@@ -83,6 +86,7 @@ AC_ARG_WITH([config-root],
 
 AC_CONFIG_FILES([
        Makefile
+       po/Makefile.in
 ])
 
 AC_OUTPUT
index 396cbdf3be936095a78038ec5d3c2969a03d5191..545c2cd68fcb9bfb2a40d38b2faf9ba737f2a6d3 100755 (executable)
@@ -56,6 +56,9 @@ install() {
             inst "${file}"
         done
     done
+    for file in /usr/share/locale/*/LC_MESSAGES/installer.mo; do
+        inst "${file}"
+    done
 
     # Bash start files
     inst_multiple /etc/profile /root/.bash_profile /etc/bashrc /root/.bashrc
index 2a5122e1af1fce764742192818123bf1d13749f7..e3ed7957ef64857fa28d904991881a35ab14218e 100644 (file)
@@ -29,8 +29,6 @@
 FILE *flog = NULL;
 char *mylog;
 
-char **ctr;
-
 extern char url[STRING_SIZE];
 
 static int newtChecklist(const char* title, const char* message,
@@ -207,6 +205,24 @@ static char* center_string(const char* str, int width) {
        return string;
 }
 
+#define DEFAULT_LANG "English"
+#define NUM_LANGS 8
+
+static struct lang {
+       const char* code;
+       char* name;
+} languages[NUM_LANGS + 1] = {
+       { "nl", "Dutch (Nederlands)" },
+       { "en", "English" },
+       { "fr", "French (Français)" },
+       { "de", "German (Deutsch)" },
+       { "pl", "Polish (Polski)" },
+       { "ru", "Russian (Русский)" },
+       { "es", "Spanish (Español)" },
+       { "tr", "Turkish (Türkçe)" },
+       { NULL, NULL },
+};
+
 int main(int argc, char *argv[]) {
        struct hw* hw = hw_init();
 
@@ -215,8 +231,6 @@ int main(int argc, char *argv[]) {
 
        char discl_msg[40000] = "Disclaimer\n";
 
-       char *langnames[] = { "Deutsch", "English", "Français", "Español", "Nederlands", "Polski", "Русский", "Türkçe", NULL };
-       char *shortlangnames[] = { "de", "en", "fr", "es", "nl", "pl", "ru", "tr", NULL };
        char* sourcedrive = NULL;
        int rc = 0;
        char commandstring[STRING_SIZE];
@@ -285,21 +299,26 @@ int main(int argc, char *argv[]) {
        mysystem("/sbin/modprobe vfat"); // USB key
        hw_stop_all_raid_arrays();
 
-       /* German is the default */
-       for (choice = 0; langnames[choice]; choice++)
-       {
-               if (strcmp(langnames[choice], "English") == 0)
-                       break;
-       }
-       if (!langnames[choice])
-               goto EXIT;
-
        if (!unattended) {
-           rc = newtWinMenu("Language selection", "Select the language you wish to use for the " NAME ".", 50, 5, 5, 8,
-                   langnames, &choice, "Ok", NULL);
-       }
+               // Language selection
+               char* langnames[NUM_LANGS + 1];
 
-       setlocale(LC_ALL, shortlangnames[choice]);
+               for (unsigned int i = 0; i < NUM_LANGS; i++) {
+                       if (strcmp(languages[i].name, DEFAULT_LANG) == 0)
+                               choice = i;
+
+                       langnames[i] = languages[i].name;
+               }
+               langnames[NUM_LANGS] = NULL;
+
+           rc = newtWinMenu(_("Language selection"), _("Select the language you wish to use for the installation."),
+                       50, 5, 5, 8, langnames, &choice, _("OK"), NULL);
+
+               assert(choice <= NUM_LANGS);
+
+               fprintf(flog, "Selected language: %s (%s)\n", languages[choice].name, languages[choice].code);
+               setlocale(LC_ALL, languages[choice].code);
+       }
 
        char* helpline = center_string(_("<Tab>/<Alt-Tab> between elements | <Space> selects | <F12> next screen"), screen_cols);
        newtPushHelpLine(helpline);
diff --git a/src/installer/po/LINGUAS b/src/installer/po/LINGUAS
new file mode 100644 (file)
index 0000000..7673daa
--- /dev/null
@@ -0,0 +1 @@
+de
diff --git a/src/installer/po/Makevars b/src/installer/po/Makevars
new file mode 100644 (file)
index 0000000..cf8c600
--- /dev/null
@@ -0,0 +1,41 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
+# package.  (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.)  Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright.  The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = The IPFire Project (www.ipfire.org)
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+#   in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+#   understood.
+# - Strings which make invalid assumptions about notation of date, time or
+#   money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS =
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used.  It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
diff --git a/src/installer/po/POTFILES.in b/src/installer/po/POTFILES.in
new file mode 100644 (file)
index 0000000..e241137
--- /dev/null
@@ -0,0 +1 @@
+main.c
diff --git a/src/installer/po/de.po b/src/installer/po/de.po
new file mode 100644 (file)
index 0000000..51ec1e1
--- /dev/null
@@ -0,0 +1,229 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR The IPFire Project (www.ipfire.org)
+# This file is distributed under the same license as the PACKAGE package.
+# 
+# Translators:
+# Michael Tremer <michael.tremer@ipfire.org>, 2014
+msgid ""
+msgstr ""
+"Project-Id-Version: IPFire Project\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-07-31 09:28+0000\n"
+"PO-Revision-Date: 2014-07-31 09:44+0000\n"
+"Last-Translator: Michael Tremer <michael.tremer@ipfire.org>\n"
+"Language-Team: German (http://www.transifex.com/projects/p/ipfire/language/de/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: de\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: main.c:82 main.c:153 main.c:320 main.c:474 main.c:505 main.c:643
+msgid "OK"
+msgstr "OK"
+
+#: main.c:83 main.c:427 main.c:437 main.c:474 main.c:505
+msgid "Cancel"
+msgstr "Abbrechen"
+
+#: main.c:150
+msgid "I accept this license"
+msgstr "Ich akzeptiere die Lizenz"
+
+#: main.c:304
+msgid "<Tab>/<Alt-Tab> between elements | <Space> selects | <F12> next screen"
+msgstr "<Tab>/<Alt-Tab> um zu wechseln | <Leertaste> wählt aus | <F12> nächster Bildschirm"
+
+#: main.c:309
+#, c-format
+msgid ""
+"Welcome to the %s installation program. Selecting Cancel on any of the "
+"following screens will reboot the computer."
+msgstr ""
+
+#: main.c:311
+msgid "Start installation"
+msgstr "Installation beginnen"
+
+#: main.c:320
+msgid "No local source media found. Starting download."
+msgstr ""
+
+#: main.c:321
+msgid "Downloading installation image ..."
+msgstr "Lade Installationsimage herunter..."
+
+#: main.c:323
+msgid "Download error"
+msgstr "Fehler beim Download"
+
+#: main.c:358
+msgid "License not accepted!"
+msgstr "Lizenz nicht akzeptiert!"
+
+#: main.c:380
+msgid "No hard disk found."
+msgstr "Es wurde keine Festplatte gefunden."
+
+#: main.c:399
+msgid "Disk Selection"
+msgstr "Festplattenauswahl"
+
+#: main.c:400
+msgid ""
+"Select the disk(s) you want to install IPFire on. First those will be partitioned, and then the partitions will have a filesystem put on them.\n"
+"\n"
+"ALL DATA ON THE DISK WILL BE DESTROYED."
+msgstr ""
+
+#: main.c:411
+msgid ""
+"No disk has been selected.\n"
+"\n"
+"Please select one or more disks you want to install IPFire on."
+msgstr ""
+
+#: main.c:424
+#, c-format
+msgid ""
+"The installation program will now prepare the chosen harddisk:\n"
+"\n"
+"  %s\n"
+"\n"
+"Do you agree to continue?"
+msgstr ""
+
+#: main.c:426
+msgid "Disk Setup"
+msgstr "Disk-Setup"
+
+#: main.c:427 main.c:437
+msgid "Delete all data"
+msgstr "Alle Daten löschen"
+
+#: main.c:434
+#, c-format
+msgid ""
+"The installation program will now set up a RAID configuration on the selected harddisks:\n"
+"\n"
+"  %s\n"
+"  %s\n"
+"\n"
+"Do you agree to continue?"
+msgstr ""
+
+#: main.c:436
+msgid "RAID Setup"
+msgstr "RAID-Setup"
+
+#: main.c:447
+msgid "You disk configuration is currently not supported."
+msgstr ""
+
+#: main.c:461
+msgid "Your harddisk is too small."
+msgstr "Ihre Festplatte ist zu klein."
+
+#: main.c:475
+msgid ""
+"Your harddisk is very small, but you can continue with an very small swap. "
+"(Use with caution)."
+msgstr ""
+
+#: main.c:487
+msgid "ext4 Filesystem"
+msgstr "ext4-Dateisystem"
+
+#: main.c:488
+msgid "ext4 Filesystem without journal"
+msgstr "ext4-Dateisystem ohne Journal"
+
+#: main.c:489
+msgid "XFS Filesystem"
+msgstr "XFS-Dateisystem"
+
+#: main.c:490
+msgid "ReiserFS Filesystem"
+msgstr "ReiserFS-Dateisystem"
+
+#: main.c:504
+msgid "Filesystem Selection"
+msgstr "Dateisystemauswahl"
+
+#: main.c:504
+msgid "Please choose your filesystem:"
+msgstr "Bitte wählen Sie ein Dateisystem:"
+
+#: main.c:515
+msgid "Building RAID..."
+msgstr "Erstelle RAID..."
+
+#: main.c:519
+msgid "Unable to build the RAID."
+msgstr "Das RAID konnte nicht erstellt werden."
+
+#: main.c:527
+msgid "Partitioning disk..."
+msgstr "Partitioniere die Festplatte..."
+
+#: main.c:531
+msgid "Unable to partition the disk."
+msgstr "Die Festplatte konnte nicht partitioniert werden."
+
+#: main.c:538
+msgid "Creating filesystems..."
+msgstr "Erstelle Dateisysteme..."
+
+#: main.c:542
+msgid "Unable to create filesystems."
+msgstr "Die Dateisysteme konnten nicht erstellt werden."
+
+#: main.c:548
+msgid "Unable to mount filesystems."
+msgstr "Die Dateisysteme konnten nicht eingehangen werden."
+
+#: main.c:559
+msgid "Installing the system..."
+msgstr "Installiere das System..."
+
+#: main.c:560
+msgid "Unable to install the system."
+msgstr "Das System konnte nicht installiert werden."
+
+#: main.c:576
+msgid "Installing the language cache..."
+msgstr "Installiere den Sprachdateicache..."
+
+#: main.c:577
+msgid "Unable to install the language cache."
+msgstr "Der Sprachdateicache konnte nicht erstellt werden."
+
+#: main.c:582
+msgid "Installing the bootloader..."
+msgstr "Installiere den Bootloader..."
+
+#: main.c:586
+msgid "Unable to install the bootloader."
+msgstr "Der Bootloader konnte nicht installiert werden."
+
+#: main.c:628
+#, c-format
+msgid ""
+"%s was successfully installed. Please remove any installation mediums from "
+"this system. Setup will now run where you may configure networking and the "
+"system passwords. After Setup has been completed, you should point your web "
+"browser at https://%s:444 (or whatever you name your %s), and configure "
+"dialup networking (if required) and remote access."
+msgstr ""
+
+#: main.c:634
+msgid "Congratulations!"
+msgstr "Herzlichen Glückwunsch!"
+
+#: main.c:634
+msgid "Reboot"
+msgstr "Neustarten"
+
+#: main.c:643
+msgid "Press Ok to reboot."
+msgstr "Drücken Sie OK um neuzustarten."