From cfe90ccf70b070807ae6c864bd45076087385f66 Mon Sep 17 00:00:00 2001 From: Jon Lund Steffensen Date: Sat, 27 Dec 2014 23:12:43 -0500 Subject: redshift: Fix translation of period names The static string array period_names contains strings that are printed but these were not marked for translation. This is fixed now by adding the _N() macro and calling gettext() when the strings are used. --- src/redshift.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/redshift.c b/src/redshift.c index fa791bd..4a5bfbf 100644 --- a/src/redshift.c +++ b/src/redshift.c @@ -37,8 +37,11 @@ #ifdef ENABLE_NLS # include # define _(s) gettext(s) +# define N_(s) (s) #else # define _(s) s +# define N_(s) s +# define gettext(s) s #endif #include "redshift.h" @@ -303,9 +306,9 @@ typedef enum { /* Names of periods of day */ static const char *period_names[] = { - "Daytime", - "Night", - "Transition" + N_("Daytime"), + N_("Night"), + N_("Transition") }; #if defined(HAVE_SIGNAL_H) && !defined(__WIN32__) @@ -373,11 +376,12 @@ print_period(period_t period, double transition) switch (period) { case PERIOD_NIGHT: case PERIOD_DAYTIME: - printf(_("Period: %s\n"), period_names[period]); + printf(_("Period: %s\n"), gettext(period_names[period])); break; case PERIOD_TRANSITION: printf(_("Period: %s (%.2f%% day)\n"), - period_names[period], transition*100); + gettext(period_names[period]), + transition*100); break; } } -- cgit v1.2.3-70-g09d2