From b2ffc709bba41ac35775f52594a2ce629ec7744c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Fri, 18 Oct 2019 21:19:29 +0200 Subject: [PATCH] Started first translation approach --- main.c | 8 ++--- translations/pot/main.pot | 44 ++++++++++++++++++++++++++ translations/pot/po/de/main.po | 47 ++++++++++++++++++++++++++++ translations/pot/prepare_language.sh | 22 +++++++++++++ 4 files changed, 117 insertions(+), 4 deletions(-) create mode 100644 translations/pot/main.pot create mode 100644 translations/pot/po/de/main.po diff --git a/main.c b/main.c index 87280fb..d7f522d 100644 --- a/main.c +++ b/main.c @@ -197,10 +197,6 @@ static int start_gui(int argc, char **argv) GMenu *m_quit; GMenu *m_about; - bindtextdomain(GETTEXT_PACKAGE, LOCALEDATADIR "/locale"); - bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); - textdomain(GETTEXT_PACKAGE); - /* * Generate version dependent application id * This allows running the application in different versions at the same time. @@ -273,6 +269,10 @@ int main(int argc, char **argv) int scale = 1000; int app_status = 0; + bindtextdomain(GETTEXT_PACKAGE, LOCALEDATADIR "/locale"); + bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); + textdomain(GETTEXT_PACKAGE); + GOptionEntry entries[] = { {"version", 'v', 0, G_OPTION_ARG_NONE, &version, "Print version", NULL}, {"renderer", 'r', 0, G_OPTION_ARG_STRING_ARRAY, &renderer_args, "Renderer to use. Can be used multiple times.", "pdf|svg|tikz|ext"}, diff --git a/translations/pot/main.pot b/translations/pot/main.pot new file mode 100644 index 0000000..a01a80a --- /dev/null +++ b/translations/pot/main.pot @@ -0,0 +1,44 @@ +# 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 , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-10-18 20:50+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../main.c:99 +#, c-format +msgid "" +"\n" +"\n" +"Full git commit: %s" +msgstr "" + +#: ../main.c:118 +#, c-format +msgid "Logo could not be displayed: %s\n" +msgstr "" + +#: ../main.c:219 +#, c-format +msgid "" +"There is already an open instance. Will open second window in that " +"instance.\n" +msgstr "" + +#: ../main.c:98 +msgid "" +"gds-render is a free tool for rendering GDS2 layout files into vector " +"graphics." +msgstr "" diff --git a/translations/pot/po/de/main.po b/translations/pot/po/de/main.po new file mode 100644 index 0000000..63e3417 --- /dev/null +++ b/translations/pot/po/de/main.po @@ -0,0 +1,47 @@ +# German translations for gds-render package. +# Copyright (C) 2019 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the gds-render package. +# Mario Hüttel , 2019. +# +msgid "" +msgstr "" +"Project-Id-Version: gds-render VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-10-18 20:32+0200\n" +"PO-Revision-Date: 2019-10-18 20:49+0200\n" +"Last-Translator: \n" +"Language-Team: German \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" + +#: ../main.c:99 +#, c-format +msgid "" +"\n" +"\n" +"Full git commit: %s" +msgstr "" +"\n" +"\n" +"Vollständige git Commit-ID %s" + +#: ../main.c:118 +#, c-format +msgid "Logo could not be displayed: %s\n" +msgstr "Logo konnte nicht angezeigt werden: %s\n" + +#: ../main.c:219 +#, c-format +msgid "" +"There is already an open instance. Will open second window in that " +"instance.\n" +msgstr "Es is bereits eine Instanz dieses Programms geöffnet. Ein weiteres Fenster in dieser wird geöffnet.\n" + +#: ../main.c:98 +msgid "" +"gds-render is a free tool for rendering GDS2 layout files into vector " +"graphics." +msgstr "gds-render is ein freies Werkzeug zum Wandeln von GDS2 Layouts in Vektorgrafiken." diff --git a/translations/pot/prepare_language.sh b/translations/pot/prepare_language.sh index 639a453..94e30ab 100755 --- a/translations/pot/prepare_language.sh +++ b/translations/pot/prepare_language.sh @@ -9,3 +9,25 @@ done DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )" cd "$DIR" +if [ -z $1 ]; then + echo "Please specify language code to generate/update" +fi + +locale="$1" +podir="./po/$locale" +echo "Selected locale: $locale" +mkdir -p "$podir" +pots=`find . -name '*.pot'` +for pot in $pots; do + po=`echo "$podir/${pot%.pot}.po" | sed -e "s/\/.\//\//g"` + echo -n "$po: " + + if [ -f "$po" ]; then + echo "update" + msgmerge --update "$po" "$pot" + else + echo "generate" + msginit --input="$pot" --locale="$locale" --output="$po" + fi + +done