Compare commits

...

2 Commits

Author SHA1 Message Date
31a47339f8 Update translations 2019-10-18 23:25:27 +02:00
7753e42078 Add translation output to Cmake 2019-10-18 22:51:31 +02:00
11 changed files with 303 additions and 29 deletions

View File

@ -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)

View File

@ -29,6 +29,7 @@
#include <stdio.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gds-render/gds-render-gui.h>
#include <gds-render/gds-utils/gds-parser.h>
@ -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));

30
main.c
View File

@ -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 <SCALE>", "<SCALE>" },
{"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 <SCALE>"), "<SCALE>" },
{"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 <FILE> to graphic");
context = g_option_context_new(_(" FILE - Convert GDS file <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 =

View File

@ -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")

24
translations/generate-mo.sh Executable file
View File

@ -0,0 +1,24 @@
#!/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" | tr '\n' ' '`
comb=`msgcat $pofiles`
echo "$comb" | msgfmt --output-file="$dest/gds-render.mo" -
done

View File

@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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 ""

View File

@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -25,18 +25,85 @@ msgid ""
"Full git commit: %s"
msgstr ""
#: ../main.c:289
msgid " FILE - Convert GDS file <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 <SCALE>"
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 "

1
translations/pot/po/de/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.po~

View File

@ -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 <mario.huettel@gmx.net>, 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: <mario.huettel@gmx.net>\n"
"Language-Team: German <translation-team-de@lists.sourceforge.net>\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"

View File

@ -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: <mario.huettel@gmx.net>\n"
"Language-Team: German <translation-team-de@lists.sourceforge.net>\n"
@ -28,20 +28,95 @@ msgstr ""
"\n"
"Vollständige git Commit-ID %s"
#: ../main.c:289
msgid " FILE - Convert GDS file <FILE> to graphic"
msgstr "Datei -- Konvertiere GDS Datei <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 <SCALE>"
msgstr "Skaliere Ausgabekoordinaten um Faktor <SCALE> 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."

View File

@ -11,6 +11,7 @@ cd "$DIR"
if [ -z $1 ]; then
echo "Please specify language code to generate/update"
exit -1
fi
locale="$1"