gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis] branch master updated: add i18n for continents


From: gnunet
Subject: [taler-anastasis] branch master updated: add i18n for continents
Date: Mon, 05 Apr 2021 19:07:44 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new bb78928  add i18n for continents
bb78928 is described below

commit bb78928b39bc8daf7dd853f0f1c21453df38e096
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Apr 5 19:07:41 2021 +0200

    add i18n for continents
---
 src/reducer/anastasis_api_redux.c | 55 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 48 insertions(+), 7 deletions(-)

diff --git a/src/reducer/anastasis_api_redux.c 
b/src/reducer/anastasis_api_redux.c
index 73b781f..2c93ad9 100644
--- a/src/reducer/anastasis_api_redux.c
+++ b/src/reducer/anastasis_api_redux.c
@@ -1651,7 +1651,7 @@ ANASTASIS_REDUX_load_continents_ ()
 
     json_array_foreach (countries, index, country)
     {
-      bool existing = false;
+      json_t *ex = NULL;
       const json_t *continent;
 
       continent = json_object_get (country,
@@ -1662,25 +1662,66 @@ ANASTASIS_REDUX_load_continents_ ()
         GNUNET_break (0);
         continue;
       }
-
       {
         size_t inner_index;
         json_t *inner_continent;
 
         json_array_foreach (continents, inner_index, inner_continent)
         {
+          const json_t *name;
+
+          name = json_object_get (inner_continent,
+                                  "name");
           if (1 == json_equal (continent,
-                               inner_continent))
+                               name))
           {
-            existing = true;
+            ex = inner_continent;
             break;
           }
         }
       }
-      if (! existing)
+      if (NULL == ex)
+      {
+        ex = json_pack ("{s:O}",
+                        "name",
+                        continent);
         GNUNET_assert (0 ==
-                       json_array_append (continents,
-                                          (json_t *) continent));
+                       json_array_append_new (continents,
+                                              ex));
+      }
+
+      {
+        json_t *i18n_continent;
+        json_t *name_ex;
+
+        i18n_continent = json_object_get (country,
+                                          "continent_i18n");
+        name_ex = json_object_get (ex,
+                                   "name_i18n");
+        if (NULL != i18n_continent)
+        {
+          const char *lang;
+          json_t *trans;
+
+          json_object_foreach (i18n_continent, lang, trans)
+          {
+            if (NULL == name_ex)
+            {
+              name_ex = json_object ();
+              json_object_set_new (ex,
+                                   "name_i18n",
+                                   name_ex);
+            }
+            if (NULL == json_object_get (name_ex,
+                                         lang))
+            {
+              json_object_set (name_ex,
+                               lang,
+                               trans);
+            }
+          }
+        }
+      }
     }
   }
   return json_pack ("{s:o}",

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]