aboutsummaryrefslogtreecommitdiffstats
path: root/src/redshift.c
diff options
context:
space:
mode:
authorJon Lund Steffensen <jonlst@gmail.com>2014-12-27 23:12:43 -0500
committerJon Lund Steffensen <jonlst@gmail.com>2014-12-27 23:12:47 -0500
commitcfe90ccf70b070807ae6c864bd45076087385f66 (patch)
tree52499e70e06b550fcdf07888eb64f95b5b8fa2c0 /src/redshift.c
parentMerge branch 'less-verbose' (diff)
downloadredshift-ng-cfe90ccf70b070807ae6c864bd45076087385f66.tar.gz
redshift-ng-cfe90ccf70b070807ae6c864bd45076087385f66.tar.bz2
redshift-ng-cfe90ccf70b070807ae6c864bd45076087385f66.tar.xz
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.
Diffstat (limited to 'src/redshift.c')
-rw-r--r--src/redshift.c14
1 files changed, 9 insertions, 5 deletions
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 <libintl.h>
# 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;
}
}