[gnome-latex: 5/205] Translation with gettext



commit 7bb9791301ecf80634af3a5df65750d4b0fc8dff
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date:   Thu Jul 30 00:42:39 2009 +0200

    Translation with gettext

 TODO                     |   2 +-
 po/french.po             | 130 +++++++++++++++++++++++++++++++++++++++++++++++
 po/latexila.mo           | Bin 0 -> 1967 bytes
 po/latexila.pot          | 129 ++++++++++++++++++++++++++++++++++++++++++++++
 Makefile => src/Makefile |   0
 main.c => src/main.c     |  62 ++++++++++++----------
 src/main.h               |   6 +++
 ui.xml => src/ui.xml     |   0
 8 files changed, 302 insertions(+), 27 deletions(-)
---
diff --git a/TODO b/TODO
index 80e8a15..c00ae5d 100644
--- a/TODO
+++ b/TODO
@@ -22,5 +22,5 @@ TODO LaTeXila
 [-] traduction (gettext)
        - lire le tutoriel
        - mettre en place la traduction
-       - traduire
+       - traduire en français
 
diff --git a/po/french.po b/po/french.po
new file mode 100644
index 0000000..39c9f92
--- /dev/null
+++ b/po/french.po
@@ -0,0 +1,130 @@
+# French translations for latexila package.
+# Copyright (C) 2009 Sébastien Wilmet
+# This file is distributed under the same license as the latexila package.
+# Sébastien Wilmet <sebastien wilmet gmail com>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: latexila\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-07-29 23:53+0200\n"
+"PO-Revision-Date: 2009-07-30 00:19+0100\n"
+"Last-Translator: Sébastien Wilmet <sebastien wilmet gmail com>\n"
+"Language-Team: French\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#: main.c:32
+msgid "File"
+msgstr "Fichier"
+
+#: main.c:33
+msgid "New"
+msgstr "Nouveau"
+
+#: main.c:33
+msgid "New file"
+msgstr "Nouveau fichier"
+
+#: main.c:35
+msgid "Open..."
+msgstr "Ouvrir..."
+
+#: main.c:36
+msgid "Open a file"
+msgstr "Ouvre un fichier"
+
+#: main.c:37
+msgid "Save..."
+msgstr "Enregistrer..."
+
+#: main.c:38
+msgid "Save the current file"
+msgstr "Enregistre le fichier actuel"
+
+#: main.c:39
+msgid "Save as..."
+msgstr "Enregistrer sous..."
+
+#: main.c:40
+msgid "Save the current file with a different name"
+msgstr "Enregistrer le fichier actuel sous un nom différent"
+
+#: main.c:41
+msgid "Quit"
+msgstr "Quitter"
+
+#: main.c:42
+msgid "Quit the program"
+msgstr "Quitte le programme"
+
+#: main.c:44
+msgid "Edit"
+msgstr "Édition"
+
+#: main.c:45
+msgid "Undo"
+msgstr "Annuler"
+
+#: main.c:46
+msgid "Undo the last action"
+msgstr "Annule la dernière action"
+
+#: main.c:47
+msgid "Redo"
+msgstr "Rétablir"
+
+#: main.c:48
+msgid "Redo the last undone action"
+msgstr "Refait la dernière opération annulée"
+
+#: main.c:51
+msgid "Compile (latex)"
+msgstr "Compiler (latex)"
+
+#: main.c:52
+msgid "Produce the document in DVI format"
+msgstr "Produit le document au format DVI"
+
+#: main.c:53
+msgid "View DVI"
+msgstr "Visionner DVI"
+
+#: main.c:54
+msgid "View the DVI file"
+msgstr "Visionner le fichier DVI"
+
+#: main.c:55
+msgid "Compile (pdflatex)"
+msgstr "Compiler (pdflatex)"
+
+#: main.c:56
+msgid "Produce the document in PDF format"
+msgstr "Produit le document au format PDF"
+
+#: main.c:57
+msgid "View PDF"
+msgstr "Visionner PDF"
+
+#: main.c:58
+msgid "View the PDF file"
+msgstr "Visionner le fichier PDF"
+
+#: main.c:60
+msgid "Help"
+msgstr "Aide"
+
+#: main.c:61
+msgid "About"
+msgstr "À propos"
+
+#: main.c:61
+msgid "About LaTeXila"
+msgstr "À propos de LaTeXila"
+
+#: main.c:123
+msgid "Welcome to LaTeXila!"
+msgstr "Bienvenue sur LaTeXila !"
+
diff --git a/po/latexila.mo b/po/latexila.mo
new file mode 100644
index 0000000..7d19fbf
Binary files /dev/null and b/po/latexila.mo differ
diff --git a/po/latexila.pot b/po/latexila.pot
new file mode 100644
index 0000000..01529f6
--- /dev/null
+++ b/po/latexila.pot
@@ -0,0 +1,129 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-07-29 23:53+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL li org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: main.c:32
+msgid "File"
+msgstr ""
+
+#: main.c:33
+msgid "New"
+msgstr ""
+
+#: main.c:33
+msgid "New file"
+msgstr ""
+
+#: main.c:35
+msgid "Open..."
+msgstr ""
+
+#: main.c:36
+msgid "Open a file"
+msgstr ""
+
+#: main.c:37
+msgid "Save..."
+msgstr ""
+
+#: main.c:38
+msgid "Save the current file"
+msgstr ""
+
+#: main.c:39
+msgid "Save as..."
+msgstr ""
+
+#: main.c:40
+msgid "Save the current file with a different name"
+msgstr ""
+
+#: main.c:41
+msgid "Quit"
+msgstr ""
+
+#: main.c:42
+msgid "Quit the program"
+msgstr ""
+
+#: main.c:44
+msgid "Edit"
+msgstr ""
+
+#: main.c:45
+msgid "Undo"
+msgstr ""
+
+#: main.c:46
+msgid "Undo the last action"
+msgstr ""
+
+#: main.c:47
+msgid "Redo"
+msgstr ""
+
+#: main.c:48
+msgid "Redo the last undone action"
+msgstr ""
+
+#: main.c:51
+msgid "Compile (latex)"
+msgstr ""
+
+#: main.c:52
+msgid "Produce the document in DVI format"
+msgstr ""
+
+#: main.c:53
+msgid "View DVI"
+msgstr ""
+
+#: main.c:54
+msgid "View the DVI file"
+msgstr ""
+
+#: main.c:55
+msgid "Compile (pdflatex)"
+msgstr ""
+
+#: main.c:56
+msgid "Produce the document in PDF format"
+msgstr ""
+
+#: main.c:57
+msgid "View PDF"
+msgstr ""
+
+#: main.c:58
+msgid "View the PDF file"
+msgstr ""
+
+#: main.c:60
+msgid "Help"
+msgstr ""
+
+#: main.c:61
+msgid "About"
+msgstr ""
+
+#: main.c:61
+msgid "About LaTeXila"
+msgstr ""
+
+#: main.c:123
+msgid "Welcome to LaTeXila!"
+msgstr ""
diff --git a/Makefile b/src/Makefile
similarity index 100%
rename from Makefile
rename to src/Makefile
diff --git a/main.c b/src/main.c
similarity index 65%
rename from main.c
rename to src/main.c
index 862cb89..f48af8b 100644
--- a/main.c
+++ b/src/main.c
@@ -1,8 +1,12 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdbool.h>
+#include <locale.h>
+#include <libintl.h>
 #include <gtk/gtk.h>
 
+#include "main.h"
+
 static void
 menu_add_widget (GtkUIManager *ui_manager, GtkWidget *widget, GtkContainer *box)
 {
@@ -13,6 +17,11 @@ menu_add_widget (GtkUIManager *ui_manager, GtkWidget *widget, GtkContainer *box)
 int
 main (int argc, char *argv[])
 {
+       /* localisation */      
+       setlocale (LC_ALL, "");
+       bindtextdomain ("latexila", "/usr/share/locale");
+       textdomain ("latexila");
+
        char *xml_file = "ui.xml";
 
        // all the actions (for the menu and the toolbar)
@@ -20,35 +29,36 @@ main (int argc, char *argv[])
        // the names come from the XML file
        GtkActionEntry entries[] =
        {
-               {"File", NULL, "File", NULL, NULL, NULL},
-               {"FileNew", GTK_STOCK_NEW, "New", "<Control>N", "New file", NULL},
-               {"FileOpen", GTK_STOCK_OPEN, "Open...", "<Control>O", "Open a file",
+               {"File", NULL, _("File"), NULL, NULL, NULL},
+               {"FileNew", GTK_STOCK_NEW, _("New"), "<Control>N", _("New file"),
                        NULL},
-               {"FileSave", GTK_STOCK_SAVE, "Save...", "<Control>S",
-                       "Save the current file", NULL},
-               {"FileSaveAs", GTK_STOCK_SAVE_AS, "Save as...", "<Shift><Control>S",
-                       "Save the current file with a different name", NULL},
-               {"FileQuit", GTK_STOCK_QUIT, "Quit", "<Control>Q", "Quit the program",
-                       gtk_main_quit},
+               {"FileOpen", GTK_STOCK_OPEN, _("Open..."), "<Control>O",
+                       _("Open a file"), NULL},
+               {"FileSave", GTK_STOCK_SAVE, _("Save..."), "<Control>S",
+                       _("Save the current file"), NULL},
+               {"FileSaveAs", GTK_STOCK_SAVE_AS, _("Save as..."), "<Shift><Control>S",
+                       _("Save the current file with a different name"), NULL},
+               {"FileQuit", GTK_STOCK_QUIT, _("Quit"), "<Control>Q",
+                       _("Quit the program"), gtk_main_quit},
                
-               {"Edit", NULL, "Edit", NULL, NULL, NULL},
-               {"EditUndo", GTK_STOCK_UNDO, "Undo", "<Control>Z",
-                       "Undo the last action", NULL},
-               {"EditRedo", GTK_STOCK_REDO, "Redo", "<Shift><Control>Z",
-                       "Redo the last undone action", NULL},
+               {"Edit", NULL, _("Edit"), NULL, NULL, NULL},
+               {"EditUndo", GTK_STOCK_UNDO, _("Undo"), "<Control>Z",
+                       _("Undo the last action"), NULL},
+               {"EditRedo", GTK_STOCK_REDO, _("Redo"), "<Shift><Control>Z",
+                       _("Redo the last undone action"), NULL},
                
                {"LaTeX", NULL, "LaTeX", NULL, NULL, NULL},
-               {"compile_latex", GTK_STOCK_EXECUTE, "Compile (latex)", "<Release>F5",
-                       "Produce the document in DVI format", NULL},
-               {"viewDVI", GTK_STOCK_FILE, "View DVI", "<Release>F6",
-                       "View the DVI file", NULL},
-               {"compile_pdflatex", GTK_STOCK_EXECUTE, "Compile (pdflatex)",
-                       "<Release>F7", "Produce the document in PDF format", NULL},
-               {"viewPDF", GTK_STOCK_FILE, "View PDF", "<Release>F8",
-                       "View the PDF file", NULL},
+               {"compile_latex", GTK_STOCK_EXECUTE, _("Compile (latex)"),
+                       "<Release>F5", _("Produce the document in DVI format"), NULL},
+               {"viewDVI", GTK_STOCK_FILE, _("View DVI"), "<Release>F6",
+                       _("View the DVI file"), NULL},
+               {"compile_pdflatex", GTK_STOCK_EXECUTE, _("Compile (pdflatex)"),
+                       "<Release>F7", _("Produce the document in PDF format"), NULL},
+               {"viewPDF", GTK_STOCK_FILE, _("View PDF"), "<Release>F8",
+                       _("View the PDF file"), NULL},
                
-               {"Help", NULL, "Help", NULL, NULL, NULL},
-               {"HelpAbout", GTK_STOCK_ABOUT, "About", NULL, "About LaTeXila", NULL}
+               {"Help", NULL, _("Help"), NULL, NULL, NULL},
+               {"HelpAbout", GTK_STOCK_ABOUT, _("About"), NULL, _("About LaTeXila"), NULL}
        };
 
        int nb_entries = sizeof (entries) / sizeof (entries[0]);
@@ -76,7 +86,7 @@ main (int argc, char *argv[])
        GtkWidget *vpaned = gtk_vpaned_new ();
        gtk_box_pack_start (GTK_BOX (vbox2), vpaned, TRUE, TRUE, 0);
 
-       /* menubar */
+       /* menubar and toolbar */
        GtkUIManager *ui_manager = gtk_ui_manager_new ();
        GtkActionGroup *action_group = gtk_action_group_new ("menuActionGroup");
        gtk_action_group_add_actions (action_group, entries, nb_entries, NULL);
@@ -110,7 +120,7 @@ main (int argc, char *argv[])
        GtkWidget *log_view = gtk_text_view_new ();
        GtkTextBuffer *log_buffer = gtk_text_view_get_buffer (
                        GTK_TEXT_VIEW (log_view));
-       gtk_text_buffer_set_text (log_buffer, "Welcome to LaTeXila!", -1);
+       gtk_text_buffer_set_text (log_buffer, _("Welcome to LaTeXila!"), -1);
        gtk_text_view_set_editable (GTK_TEXT_VIEW(log_view), FALSE);
        
        // with a scrollbar
diff --git a/src/main.h b/src/main.h
new file mode 100644
index 0000000..87e636f
--- /dev/null
+++ b/src/main.h
@@ -0,0 +1,6 @@
+#ifndef MAIN_H
+#define MAIN_H
+
+#define _(STRING) gettext(STRING)
+
+#endif // MAIN_H
diff --git a/ui.xml b/src/ui.xml
similarity index 100%
rename from ui.xml
rename to src/ui.xml


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]