From dc40dec212c209ad179f9f22762d9f7df9c336ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Fri, 18 Oct 2019 19:29:04 +0200 Subject: [PATCH 01/14] Add colors to cmake output --- CMakeLists.txt | 20 ++++++++++++++++++++ version/CMakeLists.txt | 25 +++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5dca072..4412d17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,25 @@ project(gds-render) +if(NOT WIN32) + string(ASCII 27 Esc) + set(ColorReset "${Esc}[m") + set(ColorBold "${Esc}[1m") + set(Red "${Esc}[31m") + set(Green "${Esc}[32m") + set(Yellow "${Esc}[33m") + set(Blue "${Esc}[34m") + set(Magenta "${Esc}[35m") + set(Cyan "${Esc}[36m") + set(White "${Esc}[37m") + set(BoldRed "${Esc}[1;31m") + set(BoldGreen "${Esc}[1;32m") + set(BoldYellow "${Esc}[1;33m") + set(BoldBlue "${Esc}[1;34m") + set(BoldMagenta "${Esc}[1;35m") + set(BoldCyan "${Esc}[1;36m") + set(BoldWhite "${Esc}[1;37m") +endif() + cmake_minimum_required(VERSION 2.8) find_package(PkgConfig REQUIRED) pkg_search_module(GLIB REQUIRED glib-2.0) diff --git a/version/CMakeLists.txt b/version/CMakeLists.txt index 5bdb64c..92469be 100644 --- a/version/CMakeLists.txt +++ b/version/CMakeLists.txt @@ -1,4 +1,25 @@ project(libversion) + +if(NOT WIN32) + string(ASCII 27 Esc) + set(ColorReset "${Esc}[m") + set(ColorBold "${Esc}[1m") + set(Red "${Esc}[31m") + set(Green "${Esc}[32m") + set(Yellow "${Esc}[33m") + set(Blue "${Esc}[34m") + set(Magenta "${Esc}[35m") + set(Cyan "${Esc}[36m") + set(White "${Esc}[37m") + set(BoldRed "${Esc}[1;31m") + set(BoldGreen "${Esc}[1;32m") + set(BoldYellow "${Esc}[1;33m") + set(BoldBlue "${Esc}[1;34m") + set(BoldMagenta "${Esc}[1;35m") + set(BoldCyan "${Esc}[1;36m") + set(BoldWhite "${Esc}[1;37m") +endif() + add_library(version STATIC "version.c") execute_process(COMMAND bash ./generate-version-string.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} @@ -6,6 +27,6 @@ execute_process(COMMAND bash ./generate-version-string.sh execute_process(COMMAND bash ./generate-git-commit-string.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT) -message("Commit: ${GIT_COMMIT}") -message("Version: ${GIT_VER}") +message("${BoldGreen}Commit: ${GIT_COMMIT}") +message("Version: ${GIT_VER}${ColorReset}") target_compile_definitions(version PRIVATE PROJECT_GIT_VERSION=${GIT_VER} PROJECT_GIT_COMMIT=${GIT_COMMIT}) From 8bef6bcb1745f93a4c7a96baaaa5bfdc072144a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Fri, 18 Oct 2019 19:29:55 +0200 Subject: [PATCH 02/14] First inits for translations --- CMakeLists.txt | 9 +++++++++ main.c | 16 ++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4412d17..7bd759c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,15 @@ pkg_check_modules(CAIRO REQUIRED cairo) add_compile_options(-Wall -Wold-style-declaration -Wuninitialized -Wmaybe-uninitialized -Wunused-parameter) +IF(CMAKE_BUILD_TYPE STREQUAL "Debug") + message("${Yellow}Debug mode for translations used!${ColorReset}") + add_definitions(-DGETTEXT_PACKAGE=\"gds-render\" -DLOCALEDATADIR=\"/usr/share\") +else(CMAKE_BUILD_TYPE STREQUAL "Debug") + message("Global locale directory used. Make sure files in /usr/share/locale are available") + add_definitions(-DGETTEXT_PACKAGE=\"gds-render\" -DLOCALEDATADIR=\"/usr/share\") +ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug") + + add_subdirectory(resources) add_subdirectory(doxygen) add_subdirectory(version) diff --git a/main.c b/main.c index b1a333f..87280fb 100644 --- a/main.c +++ b/main.c @@ -23,9 +23,13 @@ * @author Mario Hüttel */ + + #include #include #include +#include +#include #include #include @@ -91,8 +95,8 @@ static void app_about(GSimpleAction *action, GVariant *parameter, gpointer user_ (void)parameter; GString *comment_text; - comment_text = g_string_new("gds-render is a free tool for rendering GDS2 layout files into vector graphics."); - g_string_append_printf(comment_text, "\n\nFull git commit: %s", _app_git_commit); + comment_text = g_string_new(_("gds-render is a free tool for rendering GDS2 layout files into vector graphics.")); + g_string_append_printf(comment_text, _("\n\nFull git commit: %s"), _app_git_commit); builder = gtk_builder_new_from_resource("/gui/about.glade"); dialog = GTK_DIALOG(gtk_builder_get_object(builder, "about-dialog")); @@ -111,7 +115,7 @@ static void app_about(GSimpleAction *action, GVariant *parameter, gpointer user_ /* Pixbuf is now owned by about dialog. Unref */ g_object_unref(logo_buf); } else if (error) { - fprintf(stderr, "Logo could not be displayed: %s\n", error->message); + fprintf(stderr, _("Logo could not be displayed: %s\n"), error->message); g_error_free(error); } @@ -193,6 +197,10 @@ 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. @@ -208,7 +216,7 @@ static int start_gui(int argc, char **argv) if (g_application_get_is_remote(G_APPLICATION(gapp)) == TRUE) { g_application_activate(G_APPLICATION(gapp)); - printf("There is already an open instance. Will open second window in that instance.\n"); + printf(_("There is already an open instance. Will open second window in that instance.\n")); return 0; } From f1102162b771c4fbe64b3721dbabac020994e757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Fri, 18 Oct 2019 19:39:23 +0200 Subject: [PATCH 03/14] Add dirty warning to version Cmake --- version/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/version/CMakeLists.txt b/version/CMakeLists.txt index 92469be..2386646 100644 --- a/version/CMakeLists.txt +++ b/version/CMakeLists.txt @@ -29,4 +29,8 @@ execute_process(COMMAND bash ./generate-git-commit-string.sh OUTPUT_VARIABLE GIT_COMMIT) message("${BoldGreen}Commit: ${GIT_COMMIT}") message("Version: ${GIT_VER}${ColorReset}") + +IF(GIT_VER MATCHES "-dirty") + message("${BoldRed}Build is dirty! Commit your changes before releasing this version!${ColorReset}") +ENDIF(GIT_VER MATCHES "-dirty") target_compile_definitions(version PRIVATE PROJECT_GIT_VERSION=${GIT_VER} PROJECT_GIT_COMMIT=${GIT_COMMIT}) From 592dcbae53f0b952a053a8946a3c92c26433c5d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Fri, 18 Oct 2019 19:39:54 +0200 Subject: [PATCH 04/14] Use translations folder in binary dir when debugging --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bd759c..e632c60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,8 @@ add_compile_options(-Wall -Wold-style-declaration -Wuninitialized -Wmaybe-uninit IF(CMAKE_BUILD_TYPE STREQUAL "Debug") message("${Yellow}Debug mode for translations used!${ColorReset}") - add_definitions(-DGETTEXT_PACKAGE=\"gds-render\" -DLOCALEDATADIR=\"/usr/share\") + add_definitions(-DGETTEXT_PACKAGE=\"gds-render\" -DLOCALEDATADIR=\"${CMAKE_CURRENT_BINARY_DIR}/translations\") + message("${BoldMagenta}${CMAKE_CURRENT_BINARY_DIR}/translations used as data dir${ColorReset}") else(CMAKE_BUILD_TYPE STREQUAL "Debug") message("Global locale directory used. Make sure files in /usr/share/locale are available") add_definitions(-DGETTEXT_PACKAGE=\"gds-render\" -DLOCALEDATADIR=\"/usr/share\") From c70f99a283bf5d2342acca841186695a1346d357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Fri, 18 Oct 2019 20:32:58 +0200 Subject: [PATCH 05/14] Remove uneeded empty line in CMakeLists.txt --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e632c60..9808ba0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,6 @@ else(CMAKE_BUILD_TYPE STREQUAL "Debug") add_definitions(-DGETTEXT_PACKAGE=\"gds-render\" -DLOCALEDATADIR=\"/usr/share\") ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug") - add_subdirectory(resources) add_subdirectory(doxygen) add_subdirectory(version) From b6c62626620e4253dff70577454fc7635b1859ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Fri, 18 Oct 2019 20:34:03 +0200 Subject: [PATCH 06/14] Add helper scripts for gettext --- translations/generate_templates.sh | 19 +++++++++++++++++++ translations/pot/prepare_language.sh | 11 +++++++++++ 2 files changed, 30 insertions(+) create mode 100755 translations/generate_templates.sh create mode 100755 translations/pot/prepare_language.sh diff --git a/translations/generate_templates.sh b/translations/generate_templates.sh new file mode 100755 index 0000000..a785aaf --- /dev/null +++ b/translations/generate_templates.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )" +cd "$DIR" + +files=`find ../ -name "*.c"` +mkdir -p "pot" + +for file in $files; do + pot="pot/"$(echo "${file#*/}" | sed -e "s/\//_/g") + pot="${pot%.c}.pot" + xgettext --keyword=_ --language=C --add-comments --sort-output -o "$pot" "$file" +done diff --git a/translations/pot/prepare_language.sh b/translations/pot/prepare_language.sh new file mode 100755 index 0000000..639a453 --- /dev/null +++ b/translations/pot/prepare_language.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )" +cd "$DIR" + 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 07/14] 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 From 7753e420780ba9db74a0134521d25bbd56ec294c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Fri, 18 Oct 2019 22:51:31 +0200 Subject: [PATCH 08/14] Add translation output to Cmake --- CMakeLists.txt | 1 + translations/CMakeLists.txt | 4 ++++ translations/generate-mo.sh | 23 +++++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 translations/CMakeLists.txt create mode 100755 translations/generate-mo.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 9808ba0..7899a2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,7 @@ ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug") add_subdirectory(resources) add_subdirectory(doxygen) +add_subdirectory(translations) add_subdirectory(version) include_directories(${GLIB_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS} ${CAIRO_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include) diff --git a/translations/CMakeLists.txt b/translations/CMakeLists.txt new file mode 100644 index 0000000..3d85c59 --- /dev/null +++ b/translations/CMakeLists.txt @@ -0,0 +1,4 @@ +add_custom_target(translations + COMMAND ./generate-mo.sh "${PROJECT_BINARY_DIR}/translations" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Generating translation locales") diff --git a/translations/generate-mo.sh b/translations/generate-mo.sh new file mode 100755 index 0000000..872e94c --- /dev/null +++ b/translations/generate-mo.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )" +cd "$DIR" + +if [ -z $1 ]; then + echo "Must supply an output name" + exit -2 +fi + +for langdir in `find ./pot/po -mindepth 1 -maxdepth 1 -type d`; do + lang=`basename "$langdir"` + dest="$1/locale/$lang/LC_MESSAGES" + mkdir -p "$dest" + pofiles=`find "$langdir" -name "*.po"` + msgfmt --output-file="$dest/gds-render.mo" "$pofiles" +done From 31a47339f8a1f3e40ebf4024eae43c8a255ead7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Fri, 18 Oct 2019 23:25:27 +0200 Subject: [PATCH 09/14] Update translations --- gds-render-gui.c | 17 ++--- main.c | 30 ++++----- translations/generate-mo.sh | 5 +- translations/pot/gds-render-gui.pot | 50 ++++++++++++++ translations/pot/main.pot | 71 +++++++++++++++++++- translations/pot/po/de/.gitignore | 1 + translations/pot/po/de/gds-render-gui.po | 50 ++++++++++++++ translations/pot/po/de/main.po | 83 ++++++++++++++++++++++-- translations/pot/prepare_language.sh | 1 + 9 files changed, 277 insertions(+), 31 deletions(-) create mode 100644 translations/pot/gds-render-gui.pot create mode 100644 translations/pot/po/de/.gitignore create mode 100644 translations/pot/po/de/gds-render-gui.po diff --git a/gds-render-gui.c b/gds-render-gui.c index 62bcfc5..8017d23 100644 --- a/gds-render-gui.c +++ b/gds-render-gui.c @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -259,17 +260,17 @@ int gds_render_gui_setup_cell_selector(GdsRenderGui *self) render_cell = lib_cell_renderer_new(); render_lib = lib_cell_renderer_new(); - column = gtk_tree_view_column_new_with_attributes("Library", render_lib, "gds-lib", CELL_SEL_LIBRARY, NULL); + column = gtk_tree_view_column_new_with_attributes(_("Library"), render_lib, "gds-lib", CELL_SEL_LIBRARY, NULL); gtk_tree_view_append_column(self->cell_tree_view, column); - column = gtk_tree_view_column_new_with_attributes("Cell", render_cell, "gds-cell", CELL_SEL_CELL, + column = gtk_tree_view_column_new_with_attributes(_("Cell"), render_cell, "gds-cell", CELL_SEL_CELL, "error-level", CELL_SEL_CELL_ERROR_STATE, NULL); gtk_tree_view_append_column(self->cell_tree_view, column); - column = gtk_tree_view_column_new_with_attributes("Mod. Date", render_dates, "text", CELL_SEL_MODDATE, NULL); + column = gtk_tree_view_column_new_with_attributes(_("Mod. Date"), render_dates, "text", CELL_SEL_MODDATE, NULL); gtk_tree_view_append_column(self->cell_tree_view, column); - column = gtk_tree_view_column_new_with_attributes("Acc. Date", render_dates, "text", CELL_SEL_ACCESSDATE, NULL); + column = gtk_tree_view_column_new_with_attributes(_("Acc. Date"), render_dates, "text", CELL_SEL_ACCESSDATE, NULL); gtk_tree_view_append_column(self->cell_tree_view, column); /* Callback for selection @@ -308,17 +309,17 @@ static void on_load_gds(gpointer button, gpointer user) if (!self) return; - open_dialog = gtk_file_chooser_dialog_new("Open GDSII File", self->main_window, + open_dialog = gtk_file_chooser_dialog_new(_("Open GDSII File"), self->main_window, GTK_FILE_CHOOSER_ACTION_OPEN, - "Cancel", GTK_RESPONSE_CANCEL, - "Open GDSII", GTK_RESPONSE_ACCEPT, + _("Cancel"), GTK_RESPONSE_CANCEL, + _("Open GDSII"), GTK_RESPONSE_ACCEPT, NULL); file_chooser = GTK_FILE_CHOOSER(open_dialog); /* Add GDS II Filter */ filter = gtk_file_filter_new(); gtk_file_filter_add_pattern(filter, "*.gds"); - gtk_file_filter_set_name(filter, "GDSII-Files"); + gtk_file_filter_set_name(filter, _("GDSII-Files")); gtk_file_chooser_add_filter(file_chooser, filter); dialog_result = gtk_dialog_run(GTK_DIALOG(open_dialog)); diff --git a/main.c b/main.c index d7f522d..c2f1458 100644 --- a/main.c +++ b/main.c @@ -219,8 +219,8 @@ static int start_gui(int argc, char **argv) menu = g_menu_new(); m_quit = g_menu_new(); m_about = g_menu_new(); - g_menu_append(m_quit, "Quit", "app.quit"); - g_menu_append(m_about, "About", "app.about"); + g_menu_append(m_quit, _("Quit"), "app.quit"); + g_menu_append(m_about, _("About"), "app.about"); g_menu_append_section(menu, NULL, G_MENU_MODEL(m_about)); g_menu_append_section(menu, NULL, G_MENU_MODEL(m_quit)); g_action_map_add_action_entries(G_ACTION_MAP(gapp), app_actions, @@ -244,7 +244,7 @@ static int start_gui(int argc, char **argv) */ static void print_version(void) { - printf("This is gds-render, version: %s\n\nFor a list of supported commands execute with --help option.\n", + printf(_("This is gds-render, version: %s\n\nFor a list of supported commands execute with --help option.\n"), _app_version_string); } @@ -274,24 +274,24 @@ int main(int argc, char **argv) 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"}, - {"scale", 's', 0, G_OPTION_ARG_INT, &scale, "Divide output coordinates by ", "" }, - {"output-file", 'o', 0, G_OPTION_ARG_FILENAME_ARRAY, &output_paths, "Output file path. Can be used multiple times.", "PATH" }, - {"mapping", 'm', 0, G_OPTION_ARG_FILENAME, &mappingname, "Path for Layer Mapping File", "PATH" }, - {"cell", 'c', 0, G_OPTION_ARG_STRING, &cellname, "Cell to render", "NAME" }, - {"tex-standalone", 'a', 0, G_OPTION_ARG_NONE, &pdf_standalone, "Create standalone PDF", NULL }, - {"tex-layers", 'l', 0, G_OPTION_ARG_NONE, &pdf_layers, "Create PDF Layers (OCG)", NULL }, + {"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"}, + {"scale", 's', 0, G_OPTION_ARG_INT, &scale, _("Divide output coordinates by "), "" }, + {"output-file", 'o', 0, G_OPTION_ARG_FILENAME_ARRAY, &output_paths, _("Output file path. Can be used multiple times."), "PATH" }, + {"mapping", 'm', 0, G_OPTION_ARG_FILENAME, &mappingname, _("Path for Layer Mapping File"), "PATH" }, + {"cell", 'c', 0, G_OPTION_ARG_STRING, &cellname, _("Cell to render"), "NAME" }, + {"tex-standalone", 'a', 0, G_OPTION_ARG_NONE, &pdf_standalone, _("Create standalone TeX"), NULL }, + {"tex-layers", 'l', 0, G_OPTION_ARG_NONE, &pdf_layers, _("Create PDF Layers (OCG)"), NULL }, {"custom-render-lib", 'P', 0, G_OPTION_ARG_FILENAME, &custom_library_path, "Path to a custom shared object, that implements the " EXTERNAL_LIBRARY_FUNCTION " function", "PATH"}, {NULL} }; - context = g_option_context_new(" FILE - Convert GDS file to graphic"); + context = g_option_context_new(_(" FILE - Convert GDS file to graphic")); g_option_context_add_main_entries(context, entries, NULL); g_option_context_add_group(context, gtk_get_option_group(TRUE)); if (!g_option_context_parse(context, &argc, &argv, &error)) { - g_print("Option parsing failed: %s\n", error->message); + g_print(_("Option parsing failed: %s\n"), error->message); exit(1); } @@ -302,7 +302,7 @@ int main(int argc, char **argv) if (argc >= 2) { if (scale < 1) { - printf("Scale < 1 not allowed. Setting to 1\n"); + printf(_("Scale < 1 not allowed. Setting to 1\n")); scale = 1; } @@ -311,7 +311,7 @@ int main(int argc, char **argv) /* Print out additional arguments as ignored */ for (i = 2; i < argc; i++) { - printf("Ignored argument: %s", argv[i]); + printf(_("Ignored argument: %s"), argv[i]); } app_status = diff --git a/translations/generate-mo.sh b/translations/generate-mo.sh index 872e94c..16b6a44 100755 --- a/translations/generate-mo.sh +++ b/translations/generate-mo.sh @@ -18,6 +18,7 @@ for langdir in `find ./pot/po -mindepth 1 -maxdepth 1 -type d`; do lang=`basename "$langdir"` dest="$1/locale/$lang/LC_MESSAGES" mkdir -p "$dest" - pofiles=`find "$langdir" -name "*.po"` - msgfmt --output-file="$dest/gds-render.mo" "$pofiles" + pofiles=`find "$langdir" -name "*.po" | tr '\n' ' '` + comb=`msgcat $pofiles` + echo "$comb" | msgfmt --output-file="$dest/gds-render.mo" - done diff --git a/translations/pot/gds-render-gui.pot b/translations/pot/gds-render-gui.pot new file mode 100644 index 0000000..a0b152d --- /dev/null +++ b/translations/pot/gds-render-gui.pot @@ -0,0 +1,50 @@ +# 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 23:08+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=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../gds-render-gui.c:272 +msgid "Acc. Date" +msgstr "" + +#: ../gds-render-gui.c:313 +msgid "Cancel" +msgstr "" + +#: ../gds-render-gui.c:265 +msgid "Cell" +msgstr "" + +#: ../gds-render-gui.c:321 +msgid "GDSII-Files" +msgstr "" + +#: ../gds-render-gui.c:262 +msgid "Library" +msgstr "" + +#: ../gds-render-gui.c:269 +msgid "Mod. Date" +msgstr "" + +#: ../gds-render-gui.c:314 +msgid "Open GDSII" +msgstr "" + +#: ../gds-render-gui.c:311 +msgid "Open GDSII File" +msgstr "" diff --git a/translations/pot/main.pot b/translations/pot/main.pot index a01a80a..252e5f7 100644 --- a/translations/pot/main.pot +++ b/translations/pot/main.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-10-18 20:50+0200\n" +"POT-Creation-Date: 2019-10-18 23:08+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,18 +25,85 @@ msgid "" "Full git commit: %s" msgstr "" +#: ../main.c:289 +msgid " FILE - Convert GDS file to graphic" +msgstr "" + +#: ../main.c:223 +msgid "About" +msgstr "" + +#: ../main.c:282 +msgid "Cell to render" +msgstr "" + +#: ../main.c:284 +msgid "Create PDF Layers (OCG)" +msgstr "" + +#: ../main.c:283 +msgid "Create standalone TeX" +msgstr "" + +#: ../main.c:279 +msgid "Divide output coordinates by " +msgstr "" + +#: ../main.c:314 +#, c-format +msgid "Ignored argument: %s" +msgstr "" + #: ../main.c:118 #, c-format msgid "Logo could not be displayed: %s\n" msgstr "" -#: ../main.c:219 +#: ../main.c:294 +#, c-format +msgid "Option parsing failed: %s\n" +msgstr "" + +#: ../main.c:280 +msgid "Output file path. Can be used multiple times." +msgstr "" + +#: ../main.c:281 +msgid "Path for Layer Mapping File" +msgstr "" + +#: ../main.c:277 +msgid "Print version" +msgstr "" + +#: ../main.c:222 +msgid "Quit" +msgstr "" + +#: ../main.c:278 +msgid "Renderer to use. Can be used multiple times." +msgstr "" + +#: ../main.c:305 +#, c-format +msgid "Scale < 1 not allowed. Setting to 1\n" +msgstr "" + +#: ../main.c:215 #, c-format msgid "" "There is already an open instance. Will open second window in that " "instance.\n" msgstr "" +#: ../main.c:247 +#, c-format +msgid "" +"This is gds-render, version: %s\n" +"\n" +"For a list of supported commands execute with --help option.\n" +msgstr "" + #: ../main.c:98 msgid "" "gds-render is a free tool for rendering GDS2 layout files into vector " diff --git a/translations/pot/po/de/.gitignore b/translations/pot/po/de/.gitignore new file mode 100644 index 0000000..4591c0f --- /dev/null +++ b/translations/pot/po/de/.gitignore @@ -0,0 +1 @@ +*.po~ diff --git a/translations/pot/po/de/gds-render-gui.po b/translations/pot/po/de/gds-render-gui.po new file mode 100644 index 0000000..394ded6 --- /dev/null +++ b/translations/pot/po/de/gds-render-gui.po @@ -0,0 +1,50 @@ +# German translations for PACKAGE package. +# Copyright (C) 2019 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE 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 23:08+0200\n" +"PO-Revision-Date: 2019-10-18 23:10+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" + +#: ../gds-render-gui.c:272 +msgid "Acc. Date" +msgstr "Zugr. Datum" + +#: ../gds-render-gui.c:313 +msgid "Cancel" +msgstr "Abbruch" + +#: ../gds-render-gui.c:265 +msgid "Cell" +msgstr "Zelle" + +#: ../gds-render-gui.c:321 +msgid "GDSII-Files" +msgstr "GDSII-Dateiem" + +#: ../gds-render-gui.c:262 +msgid "Library" +msgstr "Bibliothek" + +#: ../gds-render-gui.c:269 +msgid "Mod. Date" +msgstr "Mod. Datum" + +#: ../gds-render-gui.c:314 +msgid "Open GDSII" +msgstr "GDSII öffnen" + +#: ../gds-render-gui.c:311 +msgid "Open GDSII File" +msgstr "GDSII Datei öffnen" diff --git a/translations/pot/po/de/main.po b/translations/pot/po/de/main.po index 63e3417..ec2d9a6 100644 --- a/translations/pot/po/de/main.po +++ b/translations/pot/po/de/main.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: gds-render VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-10-18 20:32+0200\n" +"POT-Creation-Date: 2019-10-18 23:03+0200\n" "PO-Revision-Date: 2019-10-18 20:49+0200\n" "Last-Translator: \n" "Language-Team: German \n" @@ -28,20 +28,95 @@ msgstr "" "\n" "Vollständige git Commit-ID %s" +#: ../main.c:289 +msgid " FILE - Convert GDS file to graphic" +msgstr "Datei -- Konvertiere GDS Datei zu Vektorgrafik" + +#: ../main.c:223 +msgid "About" +msgstr "Über" + +#: ../main.c:282 +msgid "Cell to render" +msgstr "Zu konvertierende Zelle" + +#: ../main.c:284 +msgid "Create PDF Layers (OCG)" +msgstr "Generiere PDF Layer (OCG)" + +#: ../main.c:283 +msgid "Create standalone TeX" +msgstr "Generiere alleinstehendes TeX" + +#: ../main.c:279 +msgid "Divide output coordinates by " +msgstr "Skaliere Ausgabekoordinaten um Faktor herab" + +#: ../main.c:314 +#, c-format +msgid "Ignored argument: %s" +msgstr "Ignoriertes Argument: %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 +#: ../main.c:294 +#, c-format +msgid "Option parsing failed: %s\n" +msgstr "Übergabeparameterkonvertierung fehlgeschlagen: %s\n" + +#: ../main.c:280 +msgid "Output file path. Can be used multiple times." +msgstr "Ausgabedatei. Kann mehrfach angegeben werden." + +#: ../main.c:281 +msgid "Path for Layer Mapping File" +msgstr "Pfad zur \"Layer Mapping\"-Datei" + +#: ../main.c:277 +msgid "Print version" +msgstr "Programmversion aufgeben" + +#: ../main.c:222 +msgid "Quit" +msgstr "Beenden" + +#: ../main.c:278 +msgid "Renderer to use. Can be used multiple times." +msgstr "Gewünschter Renderer. Kann mehrfach angegeben werden." + +#: ../main.c:305 +#, c-format +msgid "Scale < 1 not allowed. Setting to 1\n" +msgstr "Skalierung < 1 nicht erlaubt. Rückfallwert 1 benutzt.\n" + +#: ../main.c:215 #, 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" +msgstr "" +"Es is bereits eine Instanz dieses Programms geöffnet. Ein weiteres Fenster " +"in dieser wird geöffnet.\n" + +#: ../main.c:247 +#, c-format +msgid "" +"This is gds-render, version: %s\n" +"\n" +"For a list of supported commands execute with --help option.\n" +msgstr "" +"gds-render, Version %s\n" +"\n" +"Um eine Liste der unterstützten Befehle zu erhalten, bitte mit der Option --" +"help ausführen.\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." +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 94e30ab..162c631 100755 --- a/translations/pot/prepare_language.sh +++ b/translations/pot/prepare_language.sh @@ -11,6 +11,7 @@ cd "$DIR" if [ -z $1 ]; then echo "Please specify language code to generate/update" + exit -1 fi locale="$1" From 8005e8bcc7fa27badf06adbe0b103ac63d7559dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Sun, 20 Oct 2019 14:04:39 +0200 Subject: [PATCH 10/14] Adapt install routines to install locales --- AUR/PKGBUILD | 8 +++++--- CMakeLists.txt | 14 +++++++++++--- translations/CMakeLists.txt | 4 ++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/AUR/PKGBUILD b/AUR/PKGBUILD index 9f440fb..61d29a7 100644 --- a/AUR/PKGBUILD +++ b/AUR/PKGBUILD @@ -20,13 +20,14 @@ pkgver () { } build () { - cd "$srcdir/$pkgname-git" - cmake -DCMAKE_BUILD_TYPE=Release . + mkdir "$srcdir/$pkgname-git/build" + cd "$srcdir/$pkgname-git/build" + cmake -DCMAKE_BUILD_TYPE=Release .. make } package () { - cd "$srcdir/$pkgname-git" + cd "$srcdir/$pkgname-git/build" make DESTDIR="${pkgdir}" install install -D -m664 "$srcdir/$pkgname-git/AUR/gds-render.desktop" \ "$pkgdir/usr/share/applications/gds-render.desktop" @@ -34,4 +35,5 @@ package () { "$pkgdir/usr/share/icons/hicolor/scalable/apps/gds-render.svg" install -D -m664 "$srcdir/$pkgname-git/icon/128x128/gds-render.png" \ "$pkgdir/usr/share/icons/hicolor/128x128/apps/gds-render.png" + tar cf - "$srcdir/$pkgname-git/build/translations/output/locale" | (cd "$pkgdir/usr/share/" && tar xf -) } diff --git a/CMakeLists.txt b/CMakeLists.txt index 7899a2e..ddf4103 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,9 @@ project(gds-render) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "/usr/" CACHE PATH "..." FORCE) +endif() + if(NOT WIN32) string(ASCII 27 Esc) set(ColorReset "${Esc}[m") @@ -30,8 +34,8 @@ add_compile_options(-Wall -Wold-style-declaration -Wuninitialized -Wmaybe-uninit IF(CMAKE_BUILD_TYPE STREQUAL "Debug") message("${Yellow}Debug mode for translations used!${ColorReset}") - add_definitions(-DGETTEXT_PACKAGE=\"gds-render\" -DLOCALEDATADIR=\"${CMAKE_CURRENT_BINARY_DIR}/translations\") - message("${BoldMagenta}${CMAKE_CURRENT_BINARY_DIR}/translations used as data dir${ColorReset}") + add_definitions(-DGETTEXT_PACKAGE=\"gds-render\" -DLOCALEDATADIR=\"${CMAKE_CURRENT_BINARY_DIR}/translations/output\") + message("${BoldMagenta}${CMAKE_CURRENT_BINARY_DIR}/translations/output used as data dir${ColorReset}") else(CMAKE_BUILD_TYPE STREQUAL "Debug") message("Global locale directory used. Make sure files in /usr/share/locale are available") add_definitions(-DGETTEXT_PACKAGE=\"gds-render\" -DLOCALEDATADIR=\"/usr/share\") @@ -67,8 +71,12 @@ set(SOURCE add_executable(${PROJECT_NAME} ${SOURCE} ${CMAKE_CURRENT_BINARY_DIR}/resources/resources.c) add_dependencies(${PROJECT_NAME} glib-resources) add_dependencies(${PROJECT_NAME} version) +add_dependencies(${PROJECT_NAME} translations) SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/resources/resources.c PROPERTIES GENERATED 1) target_link_libraries(${PROJECT_NAME} ${GLIB_LDFLAGS} ${GTK3_LDFLAGS} ${CAIRO_LDFLAGS} m version ${CMAKE_DL_LIBS}) -install (TARGETS ${PROJECT_NAME} DESTINATION bin) +install (TARGETS ${PROJECT_NAME} + RUNTIME + DESTINATION bin + ) add_custom_target(documentation DEPENDS doxygen) diff --git a/translations/CMakeLists.txt b/translations/CMakeLists.txt index 3d85c59..a181f7b 100644 --- a/translations/CMakeLists.txt +++ b/translations/CMakeLists.txt @@ -1,4 +1,4 @@ -add_custom_target(translations - COMMAND ./generate-mo.sh "${PROJECT_BINARY_DIR}/translations" +add_custom_target(translations ALL + COMMAND ./generate-mo.sh "${PROJECT_BINARY_DIR}/translations/output" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Generating translation locales") From 0fbbc1db641fd5397134162e9a384964cc2deefe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Sun, 20 Oct 2019 14:26:46 +0200 Subject: [PATCH 11/14] Update package build --- AUR/PKGBUILD | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/AUR/PKGBUILD b/AUR/PKGBUILD index 61d29a7..3fbe7c2 100644 --- a/AUR/PKGBUILD +++ b/AUR/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Mario Hüttel pkgname=gds-render -pkgver=20180725.001 +pkgver=20191020.403.448de30 pkgrel=1 pkgdesc="Conversion tool for converting GDS layout files into TikZ Code and PDF" arch=('i686' 'x86_64') @@ -35,5 +35,6 @@ package () { "$pkgdir/usr/share/icons/hicolor/scalable/apps/gds-render.svg" install -D -m664 "$srcdir/$pkgname-git/icon/128x128/gds-render.png" \ "$pkgdir/usr/share/icons/hicolor/128x128/apps/gds-render.png" - tar cf - "$srcdir/$pkgname-git/build/translations/output/locale" | (cd "$pkgdir/usr/share/" && tar xf -) + + (cd $srcdir/$pkgname-git/build/translations/output/ && tar cf - "locale" | (cd "$pkgdir/usr/share/" && tar xf -)) } From e90cd1313df58b84716a4babdb7cf0750ad42490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Tue, 22 Oct 2019 22:59:05 +0200 Subject: [PATCH 12/14] remove useless tab at end of line in script --- translations/generate_templates.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations/generate_templates.sh b/translations/generate_templates.sh index a785aaf..cb3099c 100755 --- a/translations/generate_templates.sh +++ b/translations/generate_templates.sh @@ -14,6 +14,6 @@ mkdir -p "pot" for file in $files; do pot="pot/"$(echo "${file#*/}" | sed -e "s/\//_/g") - pot="${pot%.c}.pot" + pot="${pot%.c}.pot" xgettext --keyword=_ --language=C --add-comments --sort-output -o "$pot" "$file" done From f7b2a331ec4bbb2b65068ddf67b3e997f73e1957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Tue, 22 Oct 2019 23:13:09 +0200 Subject: [PATCH 13/14] Add German translations for command line interface --- command-line.c | 21 +++---- translations/pot/command-line.pot | 72 +++++++++++++++++++++++ translations/pot/gds-render-gui.pot | 20 +++---- translations/pot/main.pot | 2 +- translations/pot/po/de/command-line.po | 73 ++++++++++++++++++++++++ translations/pot/po/de/gds-render-gui.po | 18 +++--- 6 files changed, 176 insertions(+), 30 deletions(-) create mode 100644 translations/pot/command-line.pot create mode 100644 translations/pot/po/de/command-line.po diff --git a/command-line.c b/command-line.c index 4e75ec6..62cb5a4 100644 --- a/command-line.c +++ b/command-line.c @@ -29,6 +29,7 @@ */ #include +#include #include #include @@ -70,14 +71,14 @@ static int create_renderers(char **renderers, return -1; if (!renderers || !output_file_names) { - fprintf(stderr, "Please specify renderers and file names\n"); + fprintf(stderr, _("Please specify renderers and file names\n")); return -1; } count_render = string_array_count(renderers); count_out = string_array_count(output_file_names); if (count_render != count_out) { - fprintf(stderr, "Count of renderers %d does not match count of output file names %d\n", + fprintf(stderr, _("Count of renderers %d does not match count of output file names %d\n"), count_render, count_out); return -1; } @@ -100,7 +101,7 @@ static int create_renderers(char **renderers, output_renderer = GDS_RENDER_OUTPUT_RENDERER(cairo_renderer_new_svg()); } else if (!strcmp(current_renderer, "ext")) { if (!so_path) { - fprintf(stderr, "Please specify shared object for external renderer. Will ignore this renderer.\n"); + fprintf(stderr, _("Please specify shared object for external renderer. Will ignore this renderer.\n")); continue; } output_renderer = GDS_RENDER_OUTPUT_RENDERER(external_renderer_new_with_so(so_path)); @@ -154,7 +155,7 @@ int command_line_convert_gds(const char *gds_name, /* Check if parameters are valid */ if (!gds_name || !cell_name || !output_file_names || !layer_file || !renderers) { - printf("Probably missing argument. Check --help option\n"); + printf(_("Probably missing argument. Check --help option\n")); return -2; } @@ -180,7 +181,7 @@ int command_line_convert_gds(const char *gds_name, first_lib = (struct gds_library *)libs->data; if (!first_lib) { - fprintf(stderr, "No library in library list. This should not happen.\n"); + fprintf(stderr, _("No library in library list. This should not happen.\n")); /* This is safe. Library destruction can handle an empty list element */ goto ret_destroy_library_list; } @@ -189,27 +190,27 @@ int command_line_convert_gds(const char *gds_name, toplevel_cell = find_gds_cell_in_lib(first_lib, cell_name); if (!toplevel_cell) { - printf("Couldn't find cell in first library!\n"); + printf(_("Couldn't find cell in first library!\n")); goto ret_destroy_library_list; } /* Check if cell passes vital checks */ res = gds_tree_check_reference_loops(toplevel_cell->parent_library); if (res < 0) { - fprintf(stderr, "Checking library %s failed.\n", first_lib->name); + fprintf(stderr, _("Checking library %s failed.\n"), first_lib->name); goto ret_destroy_library_list; } else if (res > 0) { - fprintf(stderr, "%d reference loops found.\n", res); + fprintf(stderr, _("%d reference loops found.\n"), res); /* do further checking if the specified cell and/or its subcells are affected */ if (toplevel_cell->checks.affected_by_reference_loop == 1) { - fprintf(stderr, "Cell is affected by reference loop. Abort!\n"); + fprintf(stderr, _("Cell is affected by reference loop. Abort!\n")); goto ret_destroy_library_list; } } if (toplevel_cell->checks.affected_by_reference_loop == GDS_CELL_CHECK_NOT_RUN) - fprintf(stderr, "Cell was not checked. This should not happen. Please report this issue. Will continue either way.\n"); + fprintf(stderr, _("Cell was not checked. This should not happen. Please report this issue. Will continue either way.\n")); /* Note: unresolved references are not an abort condition. * Deal with it. diff --git a/translations/pot/command-line.pot b/translations/pot/command-line.pot new file mode 100644 index 0000000..c452ac5 --- /dev/null +++ b/translations/pot/command-line.pot @@ -0,0 +1,72 @@ +# 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-22 23:02+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" + +#: ../command-line.c:203 +#, c-format +msgid "%d reference loops found.\n" +msgstr "" + +#: ../command-line.c:207 +#, c-format +msgid "Cell is affected by reference loop. Abort!\n" +msgstr "" + +#: ../command-line.c:213 +#, c-format +msgid "" +"Cell was not checked. This should not happen. Please report this issue. Will " +"continue either way.\n" +msgstr "" + +#: ../command-line.c:200 +#, c-format +msgid "Checking library %s failed.\n" +msgstr "" + +#: ../command-line.c:193 +#, c-format +msgid "Couldn't find cell in first library!\n" +msgstr "" + +#: ../command-line.c:81 +#, c-format +msgid "Count of renderers %d does not match count of output file names %d\n" +msgstr "" + +#: ../command-line.c:184 +#, c-format +msgid "No library in library list. This should not happen.\n" +msgstr "" + +#: ../command-line.c:74 +#, c-format +msgid "Please specify renderers and file names\n" +msgstr "" + +#: ../command-line.c:104 +#, c-format +msgid "" +"Please specify shared object for external renderer. Will ignore this " +"renderer.\n" +msgstr "" + +#: ../command-line.c:158 +#, c-format +msgid "Probably missing argument. Check --help option\n" +msgstr "" diff --git a/translations/pot/gds-render-gui.pot b/translations/pot/gds-render-gui.pot index a0b152d..7d41a23 100644 --- a/translations/pot/gds-render-gui.pot +++ b/translations/pot/gds-render-gui.pot @@ -8,43 +8,43 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-10-18 23:08+0200\n" +"POT-Creation-Date: 2019-10-22 23:02+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=UTF-8\n" +"Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../gds-render-gui.c:272 +#: ../gds-render-gui.c:273 msgid "Acc. Date" msgstr "" -#: ../gds-render-gui.c:313 +#: ../gds-render-gui.c:314 msgid "Cancel" msgstr "" -#: ../gds-render-gui.c:265 +#: ../gds-render-gui.c:266 msgid "Cell" msgstr "" -#: ../gds-render-gui.c:321 +#: ../gds-render-gui.c:322 msgid "GDSII-Files" msgstr "" -#: ../gds-render-gui.c:262 +#: ../gds-render-gui.c:263 msgid "Library" msgstr "" -#: ../gds-render-gui.c:269 +#: ../gds-render-gui.c:270 msgid "Mod. Date" msgstr "" -#: ../gds-render-gui.c:314 +#: ../gds-render-gui.c:315 msgid "Open GDSII" msgstr "" -#: ../gds-render-gui.c:311 +#: ../gds-render-gui.c:312 msgid "Open GDSII File" msgstr "" diff --git a/translations/pot/main.pot b/translations/pot/main.pot index 252e5f7..5dbf53a 100644 --- a/translations/pot/main.pot +++ b/translations/pot/main.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-10-18 23:08+0200\n" +"POT-Creation-Date: 2019-10-22 23:02+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/translations/pot/po/de/command-line.po b/translations/pot/po/de/command-line.po new file mode 100644 index 0000000..d2270f6 --- /dev/null +++ b/translations/pot/po/de/command-line.po @@ -0,0 +1,73 @@ +# German translations for gds-render package. +# Copyright (C) 2019 THE gds-render's COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Mario Hüttel , 2019. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-10-22 23:02+0200\n" +"PO-Revision-Date: 2019-10-22 23:02+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" + +#: ../command-line.c:203 +#, c-format +msgid "%d reference loops found.\n" +msgstr "%d Referenzschleifen gefunden.\n" + +#: ../command-line.c:207 +#, c-format +msgid "Cell is affected by reference loop. Abort!\n" +msgstr "Zelle von Referenzschleife betroffen. Abbruch!\n" + +#: ../command-line.c:213 +#, c-format +msgid "" +"Cell was not checked. This should not happen. Please report this issue. Will " +"continue either way.\n" +msgstr "Zelle wurde nicht überprüft. Das sollte nicht passieren. Bitte melden Sie dieses Fehlverhalten. Es wird " +"dennoch fortgefahren.\n" + +#: ../command-line.c:200 +#, c-format +msgid "Checking library %s failed.\n" +msgstr "Überprüfen der Bibliothek %s fehlgeschlagen.\n" + +#: ../command-line.c:193 +#, c-format +msgid "Couldn't find cell in first library!\n" +msgstr "Konnte Zelle nicht in der ersten Bibliothek finden!\n" + +#: ../command-line.c:81 +#, c-format +msgid "Count of renderers %d does not match count of output file names %d\n" +msgstr "Anzahl der Renderer %d entspricht nicht der Anzahl der angegebenen Ausgabepfade %s\n" + +#: ../command-line.c:184 +#, c-format +msgid "No library in library list. This should not happen.\n" +msgstr "Keine Bilbiothek in Bibliotheksliste vorhanden. Dies sollte nicht passieren.\n" + +#: ../command-line.c:74 +#, c-format +msgid "Please specify renderers and file names\n" +msgstr "Bitte geben Sie Renderer und Dateinamen an\n" + +#: ../command-line.c:104 +#, c-format +msgid "" +"Please specify shared object for external renderer. Will ignore this " +"renderer.\n" +msgstr "Bitte geben Sie ein 'shared object' für den externen Renderer an. Renderer wird ignoriert.\n" + +#: ../command-line.c:158 +#, c-format +msgid "Probably missing argument. Check --help option\n" +msgstr "Vermutlich fehlendes Argument. Siehe --help Option für Hilfe\n" diff --git a/translations/pot/po/de/gds-render-gui.po b/translations/pot/po/de/gds-render-gui.po index 394ded6..8ea66bc 100644 --- a/translations/pot/po/de/gds-render-gui.po +++ b/translations/pot/po/de/gds-render-gui.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: gds-render VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-10-18 23:08+0200\n" +"POT-Creation-Date: 2019-10-22 23:02+0200\n" "PO-Revision-Date: 2019-10-18 23:10+0200\n" "Last-Translator: \n" "Language-Team: German \n" @@ -17,34 +17,34 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: ../gds-render-gui.c:272 +#: ../gds-render-gui.c:273 msgid "Acc. Date" msgstr "Zugr. Datum" -#: ../gds-render-gui.c:313 +#: ../gds-render-gui.c:314 msgid "Cancel" msgstr "Abbruch" -#: ../gds-render-gui.c:265 +#: ../gds-render-gui.c:266 msgid "Cell" msgstr "Zelle" -#: ../gds-render-gui.c:321 +#: ../gds-render-gui.c:322 msgid "GDSII-Files" msgstr "GDSII-Dateiem" -#: ../gds-render-gui.c:262 +#: ../gds-render-gui.c:263 msgid "Library" msgstr "Bibliothek" -#: ../gds-render-gui.c:269 +#: ../gds-render-gui.c:270 msgid "Mod. Date" msgstr "Mod. Datum" -#: ../gds-render-gui.c:314 +#: ../gds-render-gui.c:315 msgid "Open GDSII" msgstr "GDSII öffnen" -#: ../gds-render-gui.c:311 +#: ../gds-render-gui.c:312 msgid "Open GDSII File" msgstr "GDSII Datei öffnen" From 4a6b0dc879b8cf8bf7635832953d48db4a7f4300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Fri, 25 Oct 2019 20:30:08 +0200 Subject: [PATCH 14/14] Update translation for German --- translations/pot/command-line.pot | 2 +- translations/pot/gds-render-gui.pot | 2 +- translations/pot/main.pot | 2 +- .../pot/po/de/widgets_activity-bar.po | 26 +++++++++++++++++++ translations/pot/widgets_activity-bar.pot | 26 +++++++++++++++++++ widgets/activity-bar.c | 5 ++-- 6 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 translations/pot/po/de/widgets_activity-bar.po create mode 100644 translations/pot/widgets_activity-bar.pot diff --git a/translations/pot/command-line.pot b/translations/pot/command-line.pot index c452ac5..01569ed 100644 --- a/translations/pot/command-line.pot +++ b/translations/pot/command-line.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-10-22 23:02+0200\n" +"POT-Creation-Date: 2019-10-25 20:27+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/translations/pot/gds-render-gui.pot b/translations/pot/gds-render-gui.pot index 7d41a23..3f8cd5a 100644 --- a/translations/pot/gds-render-gui.pot +++ b/translations/pot/gds-render-gui.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-10-22 23:02+0200\n" +"POT-Creation-Date: 2019-10-25 20:27+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/translations/pot/main.pot b/translations/pot/main.pot index 5dbf53a..141a115 100644 --- a/translations/pot/main.pot +++ b/translations/pot/main.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-10-22 23:02+0200\n" +"POT-Creation-Date: 2019-10-25 20:27+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/translations/pot/po/de/widgets_activity-bar.po b/translations/pot/po/de/widgets_activity-bar.po new file mode 100644 index 0000000..3dca313 --- /dev/null +++ b/translations/pot/po/de/widgets_activity-bar.po @@ -0,0 +1,26 @@ +# German translations for gds-render package. +# Copyright (C) 2019 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Mario Hüttel , 2019. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-10-25 20:27+0200\n" +"PO-Revision-Date: 2019-10-25 20:27+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" + +#: ../widgets/activity-bar.c:105 +msgid "Ready" +msgstr "Bereit" + +#: ../widgets/activity-bar.c:111 +msgid "Working..." +msgstr "Berechnung aktiv..." diff --git a/translations/pot/widgets_activity-bar.pot b/translations/pot/widgets_activity-bar.pot new file mode 100644 index 0000000..9adf407 --- /dev/null +++ b/translations/pot/widgets_activity-bar.pot @@ -0,0 +1,26 @@ +# 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-25 20:27+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" + +#: ../widgets/activity-bar.c:105 +msgid "Ready" +msgstr "" + +#: ../widgets/activity-bar.c:111 +msgid "Working..." +msgstr "" diff --git a/widgets/activity-bar.c b/widgets/activity-bar.c index dccd9d0..ebeaebf 100644 --- a/widgets/activity-bar.c +++ b/widgets/activity-bar.c @@ -37,6 +37,7 @@ */ #include +#include /** @brief Opaque ActivityBar object. Not viewable outside this source file. */ struct _ActivityBar { @@ -101,13 +102,13 @@ ActivityBar *activity_bar_new() /* TODO: Complete this once the task list is fully implemented */ void activity_bar_set_ready(ActivityBar *bar) { - gtk_label_set_text(GTK_LABEL(bar->label), "Ready"); + gtk_label_set_text(GTK_LABEL(bar->label), _("Ready")); gtk_spinner_stop(GTK_SPINNER(bar->spinner)); } void activity_bar_set_busy(ActivityBar *bar, const char *text) { - gtk_label_set_text(GTK_LABEL(bar->label), (text ? text : "Working...")); + gtk_label_set_text(GTK_LABEL(bar->label), (text ? text : _("Working..."))); gtk_spinner_start(GTK_SPINNER(bar->spinner)); }