Translate constant strings at run-time

This commit is contained in:
Pierre Pronchery 2016-06-04 20:13:41 +02:00
parent 3925694f1d
commit 380c2ad706
6 changed files with 11 additions and 9 deletions

View File

@ -26,7 +26,7 @@
#include <Desktop.h>
#include "Panel/applet.h"
#define _(string) gettext(string)
#define N_(string) (string)
#define N_(string) string
#if !GTK_CHECK_VERSION(3, 0, 0)
# define gdk_error_trap_pop_ignored() gdk_error_trap_pop()

View File

@ -211,8 +211,8 @@ static void _logout_dialog_on_response(GtkWidget * widget, gint response);
static void _panel_helper_logout_dialog(Panel * panel)
{
const char * message = _("This will log you out of the current session,"
" therefore closing any application currently opened"
const char message[] = N_("This will log you out of the current session"
", therefore closing any application currently opened"
" and losing any unsaved data.\n"
"Do you really want to proceed?");
GtkWidget * widget;
@ -229,7 +229,7 @@ static void _panel_helper_logout_dialog(Panel * panel)
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(
panel->lo_window),
#endif
"%s", message);
"%s", _(message));
#if GTK_CHECK_VERSION(2, 10, 0)
gtk_message_dialog_set_image(GTK_MESSAGE_DIALOG(panel->lo_window),
gtk_image_new_from_icon_name("gnome-logout",
@ -386,12 +386,12 @@ enum { RES_CANCEL, RES_REBOOT, RES_SHUTDOWN };
static void _panel_helper_shutdown_dialog(Panel * panel)
{
#ifdef EMBEDDED
const char * message = _("This will shutdown your device,"
const char message[] = N_("This will shutdown your device,"
" therefore closing any application currently opened"
" and losing any unsaved data.\n"
"Do you really want to proceed?");
#else
const char * message = _("This will shutdown your computer,"
const char message[] = N_("This will shutdown your computer,"
" therefore closing any application currently opened"
" and losing any unsaved data.\n"
"Do you really want to proceed?");
@ -410,7 +410,7 @@ static void _panel_helper_shutdown_dialog(Panel * panel)
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(
panel->sh_window),
#endif
"%s", message);
"%s", _(message));
#if GTK_CHECK_VERSION(2, 10, 0)
gtk_message_dialog_set_image(GTK_MESSAGE_DIALOG(panel->sh_window),
gtk_image_new_from_icon_name("gnome-shutdown",

View File

@ -39,7 +39,7 @@
#include "panel.h"
#include "../config.h"
#define _(string) gettext(string)
#define N_(string) (string)
#define N_(string) string
/* constants */
#ifndef PROGNAME

View File

@ -27,7 +27,7 @@
#include "window.h"
#include "../config.h"
#define _(string) gettext(string)
#define N_(string) (string)
#define N_(string) string
/* constants */
#ifndef PROGNAME

View File

@ -30,6 +30,7 @@
#include "../src/panel.h"
#include "../config.h"
#define _(string) gettext(string)
#define N_(string) string
/* constants */
#ifndef PROGNAME

View File

@ -29,6 +29,7 @@
#include "../src/panel.h"
#include "../config.h"
#define _(string) gettext(string)
#define N_(string) string
#ifndef PROGNAME
# define PROGNAME "panel-test"