First inits for translations
This commit is contained in:
parent
dc40dec212
commit
8bef6bcb17
@ -28,6 +28,15 @@ pkg_check_modules(CAIRO REQUIRED cairo)
|
|||||||
|
|
||||||
add_compile_options(-Wall -Wold-style-declaration -Wuninitialized -Wmaybe-uninitialized -Wunused-parameter)
|
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(resources)
|
||||||
add_subdirectory(doxygen)
|
add_subdirectory(doxygen)
|
||||||
add_subdirectory(version)
|
add_subdirectory(version)
|
||||||
|
16
main.c
16
main.c
@ -23,9 +23,13 @@
|
|||||||
* @author Mario Hüttel <mario.huettel@gmx.net>
|
* @author Mario Hüttel <mario.huettel@gmx.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <glib/gi18n.h>
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
#include <gds-render/gds-render-gui.h>
|
#include <gds-render/gds-render-gui.h>
|
||||||
#include <gds-render/command-line.h>
|
#include <gds-render/command-line.h>
|
||||||
@ -91,8 +95,8 @@ static void app_about(GSimpleAction *action, GVariant *parameter, gpointer user_
|
|||||||
(void)parameter;
|
(void)parameter;
|
||||||
GString *comment_text;
|
GString *comment_text;
|
||||||
|
|
||||||
comment_text = g_string_new("gds-render is a free tool for rendering GDS2 layout files into vector graphics.");
|
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);
|
g_string_append_printf(comment_text, _("\n\nFull git commit: %s"), _app_git_commit);
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource("/gui/about.glade");
|
builder = gtk_builder_new_from_resource("/gui/about.glade");
|
||||||
dialog = GTK_DIALOG(gtk_builder_get_object(builder, "about-dialog"));
|
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 */
|
/* Pixbuf is now owned by about dialog. Unref */
|
||||||
g_object_unref(logo_buf);
|
g_object_unref(logo_buf);
|
||||||
} else if (error) {
|
} 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);
|
g_error_free(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,6 +197,10 @@ static int start_gui(int argc, char **argv)
|
|||||||
GMenu *m_quit;
|
GMenu *m_quit;
|
||||||
GMenu *m_about;
|
GMenu *m_about;
|
||||||
|
|
||||||
|
bindtextdomain(GETTEXT_PACKAGE, LOCALEDATADIR "/locale");
|
||||||
|
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
|
||||||
|
textdomain(GETTEXT_PACKAGE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate version dependent application id
|
* Generate version dependent application id
|
||||||
* This allows running the application in different versions at the same time.
|
* 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) {
|
if (g_application_get_is_remote(G_APPLICATION(gapp)) == TRUE) {
|
||||||
g_application_activate(G_APPLICATION(gapp));
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user