[Xfce4-commits] <xfce4-weather-plugin:master> Astrological data: Add translation function for moon phase.

Harald Judt noreply at xfce.org
Tue Jul 31 13:26:04 CEST 2012


Updating branch refs/heads/master
         to a9cb0d05f5b65a08fad63d96d1c224056f10a1c9 (commit)
       from 78cf9cf3a7e099c582b4f75dc4e755cba61221e2 (commit)

commit a9cb0d05f5b65a08fad63d96d1c224056f10a1c9
Author: Harald Judt <h.judt at gmx.at>
Date:   Tue Jul 31 11:12:49 2012 +0200

    Astrological data: Add translation function for moon phase.

 panel-plugin/weather-translate.c |   23 +++++++++++++++++++++++
 panel-plugin/weather-translate.h |    2 ++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/panel-plugin/weather-translate.c b/panel-plugin/weather-translate.c
index 8ed986e..656728d 100644
--- a/panel-plugin/weather-translate.c
+++ b/panel-plugin/weather-translate.c
@@ -51,6 +51,18 @@ static const gchar *wdirs[] = {
     NULL
 };
 
+static const gchar *moon_phases[] = {
+    N_("New moon"),
+    N_("Waxing crescent"),
+    N_("First quarter"),
+    N_("Waxing gibbous"),
+    N_("Full moon"),
+    N_("Waning gibbous"),
+    N_("Third quarter"),
+    N_("Waning crescent"),
+    NULL
+};
+#define NUM_MOON_PHASES (sizeof(moon_phases) / sizeof(gchar *))
 
 static const gchar *
 translate_str(const gchar **loc_strings,
@@ -137,6 +149,17 @@ translate_desc(const gchar *desc,
 }
 
 
+const gchar *
+translate_moon_phase(const gchar *moon_phase)
+{
+    guint i;
+    for (i = 0; i < NUM_MOON_PHASES; i++)
+        if (!strcmp(moon_phase, moon_phases[i]))
+            return _(moon_phases[i]);
+    return moon_phase;
+}
+
+
 gchar *
 translate_day(gint weekday)
 {
diff --git a/panel-plugin/weather-translate.h b/panel-plugin/weather-translate.h
index 6dd2b6f..cc57437 100644
--- a/panel-plugin/weather-translate.h
+++ b/panel-plugin/weather-translate.h
@@ -26,6 +26,8 @@ G_BEGIN_DECLS
 const gchar *translate_desc(const gchar *desc,
                             gboolean nighttime);
 
+const gchar *translate_moon_phase(const gchar *moon_phase);
+
 /* these return a newly allocated string, that should be freed */
 gchar *translate_day(gint weekday);
 


More information about the Xfce4-commits mailing list