diff options
-rw-r--r-- | meson.build | 5 | ||||
-rw-r--r-- | po/LINGUAS | 1 | ||||
-rw-r--r-- | po/POTFILES | 1 | ||||
-rw-r--r-- | po/colloquium.pot | 74 | ||||
-rw-r--r-- | po/de.po | 74 | ||||
-rw-r--r-- | po/en.po | 74 | ||||
-rw-r--r-- | po/meson.build | 9 | ||||
-rw-r--r-- | src/colloquium.c | 32 | ||||
-rw-r--r-- | src/utils.h | 2 |
9 files changed, 257 insertions, 15 deletions
diff --git a/meson.build b/meson.build index 115a3f4..24f54ed 100644 --- a/meson.build +++ b/meson.build @@ -11,6 +11,11 @@ datadir=join_paths(get_option('datadir'), 'colloquium') add_project_arguments('-DPACKAGE_VERSION="'+meson.project_version()+'"', language : 'c') add_project_arguments('-DDATADIR="'+join_paths(get_option('prefix'), datadir)+'"', language : 'c') +add_project_arguments('-DLOCALEDIR="'+join_paths(get_option('prefix'), get_option('localedir'))+'"', + language : 'c') + +# Localisation +subdir('po') # Dependencies gtkdep = dependency('gtk+-3.0') diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..3ae2b72 --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1 @@ +en de diff --git a/po/POTFILES b/po/POTFILES new file mode 100644 index 0000000..681214c --- /dev/null +++ b/po/POTFILES @@ -0,0 +1 @@ +src/colloquium.c diff --git a/po/colloquium.pot b/po/colloquium.pot new file mode 100644 index 0000000..c0d293c --- /dev/null +++ b/po/colloquium.pot @@ -0,0 +1,74 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the colloquium package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: colloquium\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-04-11 09:12+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" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/colloquium.c:113 +msgid "Narrative-based presentation system" +msgstr "" + +#: src/colloquium.c:184 +#, c-format +msgid "Failed to convert file list\n" +msgstr "" + +#: src/colloquium.c:207 +msgid "Open Presentation" +msgstr "" + +#: src/colloquium.c:210 +msgid "_Cancel" +msgstr "" + +#: src/colloquium.c:211 +msgid "_Open" +msgstr "" + +#: src/colloquium.c:246 +#, c-format +msgid "Failed to load presentation '%s'\n" +msgstr "" + +#: src/colloquium.c:290 +#, c-format +msgid "Don't understand '%s', assuming false\n" +msgstr "" + +#: src/colloquium.c:302 +#, c-format +msgid "Failed to open config %s\n" +msgstr "" + +#: src/colloquium.c:377 +#, c-format +msgid "Failed to create config folder\n" +msgstr "" + +#: src/colloquium.c:446 +#, c-format +msgid "" +"Syntax: %s [options] [<file.sc>]\n" +"\n" +msgstr "" + +#: src/colloquium.c:447 +#, c-format +msgid "" +"A tiny presentation program.\n" +"\n" +" -h, --help Display this help message.\n" +msgstr "" diff --git a/po/de.po b/po/de.po new file mode 100644 index 0000000..449c242 --- /dev/null +++ b/po/de.po @@ -0,0 +1,74 @@ +# German translations for colloquium package. +# Copyright (C) 2018 THE colloquium'S COPYRIGHT HOLDER +# This file is distributed under the same license as the colloquium package. +# Automatically generated, 2018. +# +msgid "" +msgstr "" +"Project-Id-Version: colloquium\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-04-11 09:12+0200\n" +"PO-Revision-Date: 2018-04-10 23:10+0200\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: de\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" + +#: src/colloquium.c:113 +msgid "Narrative-based presentation system" +msgstr "Erzählungsbasiertes Präsentationssystem" + +#: src/colloquium.c:184 +#, c-format +msgid "Failed to convert file list\n" +msgstr "" + +#: src/colloquium.c:207 +msgid "Open Presentation" +msgstr "" + +#: src/colloquium.c:210 +msgid "_Cancel" +msgstr "" + +#: src/colloquium.c:211 +msgid "_Open" +msgstr "" + +#: src/colloquium.c:246 +#, c-format +msgid "Failed to load presentation '%s'\n" +msgstr "" + +#: src/colloquium.c:290 +#, c-format +msgid "Don't understand '%s', assuming false\n" +msgstr "" + +#: src/colloquium.c:302 +#, c-format +msgid "Failed to open config %s\n" +msgstr "" + +#: src/colloquium.c:377 +#, c-format +msgid "Failed to create config folder\n" +msgstr "" + +#: src/colloquium.c:446 +#, c-format +msgid "" +"Syntax: %s [options] [<file.sc>]\n" +"\n" +msgstr "" + +#: src/colloquium.c:447 +#, c-format +msgid "" +"A tiny presentation program.\n" +"\n" +" -h, --help Display this help message.\n" +msgstr "" diff --git a/po/en.po b/po/en.po new file mode 100644 index 0000000..2a3c7ee --- /dev/null +++ b/po/en.po @@ -0,0 +1,74 @@ +# English translations for colloquium package. +# Copyright (C) 2018 THE colloquium'S COPYRIGHT HOLDER +# This file is distributed under the same license as the colloquium package. +# Automatically generated, 2018. +# +msgid "" +msgstr "" +"Project-Id-Version: colloquium\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-04-11 09:12+0200\n" +"PO-Revision-Date: 2018-04-10 23:09+0200\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: en\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ASCII\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/colloquium.c:113 +msgid "Narrative-based presentation system" +msgstr "Narrative-based presentation system" + +#: src/colloquium.c:184 +#, c-format +msgid "Failed to convert file list\n" +msgstr "" + +#: src/colloquium.c:207 +msgid "Open Presentation" +msgstr "" + +#: src/colloquium.c:210 +msgid "_Cancel" +msgstr "" + +#: src/colloquium.c:211 +msgid "_Open" +msgstr "" + +#: src/colloquium.c:246 +#, c-format +msgid "Failed to load presentation '%s'\n" +msgstr "" + +#: src/colloquium.c:290 +#, c-format +msgid "Don't understand '%s', assuming false\n" +msgstr "" + +#: src/colloquium.c:302 +#, c-format +msgid "Failed to open config %s\n" +msgstr "" + +#: src/colloquium.c:377 +#, c-format +msgid "Failed to create config folder\n" +msgstr "" + +#: src/colloquium.c:446 +#, c-format +msgid "" +"Syntax: %s [options] [<file.sc>]\n" +"\n" +msgstr "" + +#: src/colloquium.c:447 +#, c-format +msgid "" +"A tiny presentation program.\n" +"\n" +" -h, --help Display this help message.\n" +msgstr "" diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000..8e33532 --- /dev/null +++ b/po/meson.build @@ -0,0 +1,9 @@ +i18n = import('i18n') + +# define GETTEXT_PACKAGE + +add_project_arguments('-DGETTEXT_PACKAGE="intltest"', + language : 'c') + +i18n.gettext(meson.project_name(), + args : '--directory=' + meson.source_root()) diff --git a/src/colloquium.c b/src/colloquium.c index f1d754c..de88fdb 100644 --- a/src/colloquium.c +++ b/src/colloquium.c @@ -32,6 +32,7 @@ #include <sys/stat.h> #include <glib.h> #include <glib/gstdio.h> +#include <libintl.h> #include "colloquium.h" #include "presentation.h" @@ -108,7 +109,7 @@ static void about_sig(GSimpleAction *action, GVariant *parameter, gpointer vp) gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(window), "© 2017-2018 Thomas White <taw@bitwiz.me.uk>"); gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window), - "Narrative-based presentation system"); + gettext("Narrative-based presentation system")); gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(window), "© 2017-2018 Thomas White <taw@bitwiz.me.uk>\n" "\n" @@ -179,7 +180,7 @@ static gint open_response_sig(GtkWidget *d, gint response, GApplication *papp) files = gtk_file_chooser_get_files(GTK_FILE_CHOOSER(d)); files_array = gslist_to_array(files, &n_files); if ( files_array == NULL ) { - fprintf(stderr, "Failed to convert file list\n"); + fprintf(stderr, _("Failed to convert file list\n")); return 0; } g_slist_free(files); @@ -202,11 +203,11 @@ static void open_sig(GSimpleAction *action, GVariant *parameter, gpointer vp) GtkWidget *d; GApplication *app = vp; - d = gtk_file_chooser_dialog_new("Open Presentation", + d = gtk_file_chooser_dialog_new(_("Open Presentation"), gtk_application_get_active_window(GTK_APPLICATION(app)), GTK_FILE_CHOOSER_ACTION_OPEN, - "_Cancel", GTK_RESPONSE_CANCEL, - "_Open", GTK_RESPONSE_ACCEPT, + _("_Cancel"), GTK_RESPONSE_CANCEL, + _("_Open"), GTK_RESPONSE_ACCEPT, NULL); gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(d), TRUE); @@ -241,7 +242,8 @@ static void colloquium_open(GApplication *papp, GFile **files, gint n_files, narrative_window_new(p, papp); } else { char *uri = g_file_get_uri(files[i]); - fprintf(stderr, "Failed to load '%s'\n", uri); + fprintf(stderr, _("Failed to load presentation '%s'\n"), + uri); g_free(uri); } } @@ -284,7 +286,7 @@ static int yesno(const char *a) if ( strcasecmp(a, "no") == 0 ) return 0; if ( strcasecmp(a, "false") == 0 ) return 0; - fprintf(stderr, "Don't understand '%s', assuming false\n", a); + fprintf(stderr, _("Don't understand '%s', assuming false\n"), a); return 0; } @@ -296,7 +298,7 @@ static void read_config(const char *filename, Colloquium *app) fh = fopen(filename, "r"); if ( fh == NULL ) { - fprintf(stderr, "Failed to open %s\n", filename); + fprintf(stderr, _("Failed to open config %s\n"), filename); return; } @@ -371,7 +373,7 @@ static void colloquium_startup(GApplication *papp) app->first_run = 1; if ( g_mkdir(app->mydir, S_IRUSR | S_IWUSR | S_IXUSR) ) { - fprintf(stderr, "Failed to create folder\n"); + fprintf(stderr, _("Failed to create config folder\n")); } } @@ -440,12 +442,9 @@ static Colloquium *colloquium_new() static void show_help(const char *s) { - printf("Syntax: %s [options] [<file.sc>]\n\n", s); - printf( -"A tiny presentation program.\n" -"\n" -" -h, --help Display this help message.\n" -"\n"); + printf(_("Syntax: %s [options] [<file.sc>]\n\n"), s); + printf(_("A tiny presentation program.\n\n" + " -h, --help Display this help message.\n")); } @@ -483,6 +482,9 @@ int main(int argc, char *argv[]) g_type_init(); #endif + bindtextdomain("colloquium", LOCALEDIR); + textdomain("colloquium"); + app = colloquium_new(); status = g_application_run(G_APPLICATION(app), argc, argv); g_object_unref(app); diff --git a/src/utils.h b/src/utils.h index 99701e3..cc686f2 100644 --- a/src/utils.h +++ b/src/utils.h @@ -32,4 +32,6 @@ extern void chomp(char *s); extern int safe_strcmp(const char *a, const char *b); extern char *load_everything(const char *filename); +#define _(x) gettext(x) + #endif /* UTILS_H */ |