summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/edje/edje_cc_handlers.c20
-rwxr-xr-xsrc/bin/edje/edje_cc_out.c80
-rw-r--r--src/examples/edje/en_IN/domain_name.mobin201 -> 0 bytes
-rw-r--r--src/examples/edje/en_IN/domain_name.po11
-rw-r--r--src/examples/edje/hi_IN/domain_name.mobin260 -> 0 bytes
-rw-r--r--src/examples/edje/hi_IN/domain_name.po11
-rw-r--r--src/examples/edje/text.edc18
-rw-r--r--src/lib/edje/edje_load.c11
-rw-r--r--src/lib/edje/edje_private.h2
9 files changed, 127 insertions, 26 deletions
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index 5b5d233a8d..52390729c7 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -154,6 +154,8 @@ Eina_Bool current_group_inherit = EINA_FALSE;
154static Edje_Program *sequencing = NULL; 154static Edje_Program *sequencing = NULL;
155static Eina_List *sequencing_lookups = NULL; 155static Eina_List *sequencing_lookups = NULL;
156 156
157Eina_List *po_files;
158
157struct _Edje_Cc_Handlers_Hierarchy_Info 159struct _Edje_Cc_Handlers_Hierarchy_Info
158{ /* Struct that keeps globals value to impl hierarchy */ 160{ /* Struct that keeps globals value to impl hierarchy */
159 Edje_Part_Collection_Directory_Entry *current_de; 161 Edje_Part_Collection_Directory_Entry *current_de;
@@ -3056,23 +3058,23 @@ st_collections_group_vibration_sample_source(void)
3056 .. 3058 ..
3057 file { 3059 file {
3058 locale: "en_IN"; 3060 locale: "en_IN";
3059 source: "domain_name.mo"; 3061 source: "domain_name.po";
3060 } 3062 }
3061 file { 3063 file {
3062 locale: "en_US"; 3064 locale: "en_US";
3063 source: "domain_name.mo"; 3065 source: "domain_name.po";
3064 } 3066 }
3065 } 3067 }
3066 @description 3068 @description
3067 The file block defines the mo file. 3069 The file block defines the po or mo file.
3068 @endblock 3070 @endblock
3069 @property 3071 @property
3070 name 3072 name
3071 @parameters 3073 @parameters
3072 [locale name] 3074 [locale name]
3073 @effect 3075 @effect
3074 Used to include each mo file. The full path to the directory holding 3076 Used to include each po or mo file. The full path to the directory holding
3075 the mo file can be defined later with edje_cc's "-md" option. 3077 the po or mo file can be defined later with edje_cc's "-md" option.
3076 3078
3077 @since 1.15 3079 @since 1.15
3078 @endproperty 3080 @endproperty
@@ -3122,10 +3124,10 @@ st_collections_group_translation_file_locale(void)
3122 @property 3124 @property
3123 source 3125 source
3124 @parameters 3126 @parameters
3125 [mo file name] 3127 [po file name or Mo file name]
3126 @effect 3128 @effect
3127 The mo source file name (Source should be a valid mo file. 3129 The po or mo source file name (Source should be a valid po or mo file.
3128 Only mo files are supported now) 3130 Only po or mo files are supported now)
3129 @since 1.15 3131 @since 1.15
3130 @endproperty 3132 @endproperty
3131 */ 3133 */
@@ -3134,7 +3136,7 @@ static void
3134st_collections_group_translation_file_source(void) 3136st_collections_group_translation_file_source(void)
3135{ 3137{
3136 Edje_Mo *mo_entry; 3138 Edje_Mo *mo_entry;
3137 3139 char *mo_path_str;
3138 check_arg_count(1); 3140 check_arg_count(1);
3139 3141
3140 if (!edje_file->mo_dir->mo_entries) 3142 if (!edje_file->mo_dir->mo_entries)
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c
index f755254286..485aa8c0dc 100755
--- a/src/bin/edje/edje_cc_out.c
+++ b/src/bin/edje/edje_cc_out.c
@@ -169,6 +169,8 @@ struct _Mo_Write
169{ 169{
170 Eet_File *ef; 170 Eet_File *ef;
171 Edje_Mo *mo_entry; 171 Edje_Mo *mo_entry;
172 char *mo_path;
173 Ecore_Exe *exe;
172 char *errstr; 174 char *errstr;
173}; 175};
174 176
@@ -205,6 +207,8 @@ static int pending_threads = 0;
205 207
206static void data_process_string(Edje_Part_Collection *pc, const char *prefix, char *s, void (*func)(Edje_Part_Collection *pc, char *name, char* ptr, int len)); 208static void data_process_string(Edje_Part_Collection *pc, const char *prefix, char *s, void (*func)(Edje_Part_Collection *pc, char *name, char* ptr, int len));
207 209
210extern Eina_List *po_files;
211
208Edje_File *edje_file = NULL; 212Edje_File *edje_file = NULL;
209Eina_List *edje_collections = NULL; 213Eina_List *edje_collections = NULL;
210Eina_Hash *edje_collections_lookup = NULL; 214Eina_Hash *edje_collections_lookup = NULL;
@@ -1232,6 +1236,8 @@ data_thread_mo(void *data, Ecore_Thread *thread EINA_UNUSED)
1232 eina_file_map_free(f, m); 1236 eina_file_map_free(f, m);
1233 } 1237 }
1234 eina_file_close(f); 1238 eina_file_close(f);
1239 if (mw->mo_path)
1240 ecore_file_remove(mo_path);
1235 1241
1236 INF("Wrote %9i bytes (%4iKb) for \"%s\" %s mo entry \"%s\"", 1242 INF("Wrote %9i bytes (%4iKb) for \"%s\" %s mo entry \"%s\"",
1237 bytes, (bytes + 512) / 1024, moid_str, "RAW PCM", mw->mo_entry->locale); 1243 bytes, (bytes + 512) / 1024, moid_str, "RAW PCM", mw->mo_entry->locale);
@@ -1249,9 +1255,38 @@ data_thread_mo_end(void *data, Ecore_Thread *thread EINA_UNUSED)
1249 error_and_abort(mw->ef, mw->errstr); 1255 error_and_abort(mw->ef, mw->errstr);
1250 free(mw->errstr); 1256 free(mw->errstr);
1251 } 1257 }
1258 if (mw->mo_path)
1259 free(mw->mo_path);
1252 free(mw); 1260 free(mw);
1253} 1261}
1254 1262
1263Eina_Bool
1264_exe_del_cb(void *data EINA_UNUSED, int evtype EINA_UNUSED, void *evinfo)
1265{
1266 Mo_Write *mw = data;
1267 Ecore_Exe_Event_Del *ev = evinfo;
1268 if (!ev->exe) return ECORE_CALLBACK_RENEW;
1269 if (ecore_exe_data_get(ev->exe) != mw) return ECORE_CALLBACK_RENEW;
1270 if (ev->exit_code != 0)
1271 {
1272 error_and_abort(mw->ef, "Creation of .mo from .po failed.");
1273 return ECORE_CALLBACK_CANCEL;
1274 }
1275 if (ecore_file_exists(mw->mo_path))
1276 {
1277 if (threads)
1278 ecore_thread_run(data_thread_mo, data_thread_mo_end, NULL, mw);
1279 else
1280 {
1281 data_thread_mo(mw, NULL);
1282 data_thread_mo_end(mw, NULL);
1283 }
1284 }
1285 else
1286 return ECORE_CALLBACK_RENEW;
1287 if (pending_threads <= 0) ecore_main_loop_quit();
1288 return ECORE_CALLBACK_CANCEL;
1289}
1255 1290
1256static void 1291static void
1257data_write_mo(Eet_File *ef, int *mo_num) 1292data_write_mo(Eet_File *ef, int *mo_num)
@@ -1259,24 +1294,57 @@ data_write_mo(Eet_File *ef, int *mo_num)
1259 if ((edje_file) && (edje_file->mo_dir)) 1294 if ((edje_file) && (edje_file->mo_dir))
1260 { 1295 {
1261 int i; 1296 int i;
1297 char *po_entry;
1298 char *sub_str;
1299 char buf[PATH_MAX];
1300 Eina_List *ll;
1301 char *dir_path = NULL;
1302 char mo_path[PATH_MAX];
1303 char po_path[PATH_MAX];
1262 1304
1263 for (i = 0; i < (int)edje_file->mo_dir->mo_entries_count; i++) 1305 for (i = 0; i < (int)edje_file->mo_dir->mo_entries_count; i++)
1264 { 1306 {
1265 Mo_Write *mw; 1307 Mo_Write *mw;
1266
1267 mw = calloc(1, sizeof(Mo_Write)); 1308 mw = calloc(1, sizeof(Mo_Write));
1268 if (!mw) continue; 1309 if (!mw) continue;
1269 mw->ef = ef; 1310 mw->ef = ef;
1270 mw->mo_entry = &edje_file->mo_dir->mo_entries[i]; 1311 mw->mo_entry = &edje_file->mo_dir->mo_entries[i];
1271 *mo_num += 1; 1312 *mo_num += 1;
1272 pending_threads++; 1313 pending_threads++;
1273 if (threads) 1314
1274 ecore_thread_run(data_thread_mo, data_thread_mo_end, NULL, mw); 1315 po_entry = strdup(mw->mo_entry->mo_src);
1275 else 1316 sub_str = strstr(mw->mo_entry->mo_src, ".po");
1317
1318 if (sub_str)
1276 { 1319 {
1277 data_thread_mo(mw, NULL); 1320 sub_str[1] = 'm';
1278 data_thread_mo_end(mw, NULL); 1321 EINA_LIST_FOREACH(mo_dirs, ll, dir_path)
1322 {
1323 snprintf((char *)mo_path, sizeof(mo_path), "%s/%s/%s", dir_path, mw->mo_entry->locale, mw->mo_entry->mo_src);
1324 snprintf((char *)po_path, sizeof(po_path), "%s/%s/%s", dir_path, mw->mo_entry->locale, po_entry);
1325 if (ecore_file_exists(po_path))
1326 {
1327 snprintf(buf, sizeof(buf), "msgfmt -o %s %s", mo_path, po_path);
1328 mw->mo_path = strdup(mo_path);
1329 mw->exe = ecore_exe_run(buf, mw);
1330 ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
1331 _exe_del_cb, mw);
1332 }
1333 else
1334 error_and_abort(mw->ef, "Invalid .po file.");
1335 }
1336 }
1337 else
1338 {
1339 if (threads)
1340 ecore_thread_run(data_thread_mo, data_thread_mo_end, NULL, mw);
1341 else
1342 {
1343 data_thread_mo(mw, NULL);
1344 data_thread_mo_end(mw, NULL);
1345 }
1279 } 1346 }
1347 free(po_entry);
1280 } 1348 }
1281 } 1349 }
1282} 1350}
diff --git a/src/examples/edje/en_IN/domain_name.mo b/src/examples/edje/en_IN/domain_name.mo
deleted file mode 100644
index 0c1b2fcd16..0000000000
--- a/src/examples/edje/en_IN/domain_name.mo
+++ /dev/null
Binary files differ
diff --git a/src/examples/edje/en_IN/domain_name.po b/src/examples/edje/en_IN/domain_name.po
new file mode 100644
index 0000000000..f461123404
--- /dev/null
+++ b/src/examples/edje/en_IN/domain_name.po
@@ -0,0 +1,11 @@
1msgid "LOADING"
2msgstr "Loading..."
3
4msgid "LANG"
5msgstr "Language English"
6
7msgid "SYSTEM LANGUAGE"
8msgstr "System Language"
9
10msgid "CHANGED"
11msgstr "Changed"
diff --git a/src/examples/edje/hi_IN/domain_name.mo b/src/examples/edje/hi_IN/domain_name.mo
deleted file mode 100644
index 3901b8c2df..0000000000
--- a/src/examples/edje/hi_IN/domain_name.mo
+++ /dev/null
Binary files differ
diff --git a/src/examples/edje/hi_IN/domain_name.po b/src/examples/edje/hi_IN/domain_name.po
new file mode 100644
index 0000000000..809cf6f399
--- /dev/null
+++ b/src/examples/edje/hi_IN/domain_name.po
@@ -0,0 +1,11 @@
1msgid "LOADING"
2msgstr "लोड हो रहा है..."
3
4msgid "LANG"
5msgstr "भाषा हिन्दी"
6
7msgid "SYSTEM LANGUAGE"
8msgstr "सिस्टम भाषा"
9
10msgid "CHANGED"
11msgstr "बदल"
diff --git a/src/examples/edje/text.edc b/src/examples/edje/text.edc
index ed0548d037..75fcaed529 100644
--- a/src/examples/edje/text.edc
+++ b/src/examples/edje/text.edc
@@ -21,15 +21,15 @@ collections {
21 translation { 21 translation {
22 file { 22 file {
23 locale: en_IN; 23 locale: en_IN;
24 source: domain_name.mo; /* Can be either .po file or .mo file */ 24 source: domain_name.po; /* Can be either .po file or .mo file*/
25 } 25 }
26 file { 26 file {
27 locale: hi_IN; 27 locale: hi_IN;
28 source: domain_name.mo; 28 source: domain_name.po;
29 } 29 }
30 file { 30 file {
31 locale: ta_IN; 31 locale: ta_IN;
32 source: domain_name.mo; 32 source: domain_name.po;
33 } 33 }
34 } 34 }
35 styles { 35 styles {
@@ -144,11 +144,11 @@ collections {
144 translation { 144 translation {
145 file { 145 file {
146 locale: en_IN; 146 locale: en_IN;
147 source: domain_name.mo; 147 source: domain_name.po;
148 } 148 }
149 file { 149 file {
150 locale: hi_IN; 150 locale: hi_IN;
151 source: domain_name.mo; 151 source: domain_name.po;
152 } 152 }
153 file { 153 file {
154 locale: ta_IN; 154 locale: ta_IN;
@@ -267,11 +267,11 @@ collections {
267 translation { 267 translation {
268 file { 268 file {
269 locale: en_IN; 269 locale: en_IN;
270 source: domain_name.mo; 270 source: domain_name.po;
271 } 271 }
272 file { 272 file {
273 locale: hi_IN; 273 locale: hi_IN;
274 source: domain_name.mo; 274 source: domain_name.po;
275 } 275 }
276 file { 276 file {
277 locale: ta_IN; 277 locale: ta_IN;
@@ -390,11 +390,11 @@ collections {
390 translation { 390 translation {
391 file { 391 file {
392 locale: en_IN; 392 locale: en_IN;
393 source: domain_name.mo; 393 source: domain_name.po;
394 } 394 }
395 file { 395 file {
396 locale: hi_IN; 396 locale: hi_IN;
397 source: domain_name.mo; 397 source: domain_name.po;
398 } 398 }
399 file { 399 file {
400 locale: ta_IN; 400 locale: ta_IN;
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index add6a1ac18..0457c8157e 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -84,6 +84,8 @@ _edje_extract_mo_files(Edje *ed)
84 Edje_Mo *mo_entry; 84 Edje_Mo *mo_entry;
85 char out[PATH_MAX]; 85 char out[PATH_MAX];
86 char outdir[PATH_MAX]; 86 char outdir[PATH_MAX];
87 char *sub_str;
88 char *mo_src;
87 89
88 mo_entry = &ed->file->mo_dir->mo_entries[i]; 90 mo_entry = &ed->file->mo_dir->mo_entries[i];
89 91
@@ -101,8 +103,14 @@ _edje_extract_mo_files(Edje *ed)
101 "%s/edje/%s/LC_MESSAGES", 103 "%s/edje/%s/LC_MESSAGES",
102 cache_path, mo_entry->locale); 104 cache_path, mo_entry->locale);
103 ecore_file_mkpath(outdir); 105 ecore_file_mkpath(outdir);
106 mo_src = strdup(mo_entry->mo_src);
107 sub_str = strstr(mo_src, ".po");
108
109 if (sub_str)
110 sub_str[1] = 'm';
111
104 snprintf(out, sizeof(out), "%s/%s-%s", 112 snprintf(out, sizeof(out), "%s/%s-%s",
105 outdir, ed->file->fid, mo_entry->mo_src); 113 outdir, ed->file->fid, mo_src);
106 if (ecore_file_exists(out)) 114 if (ecore_file_exists(out))
107 { 115 {
108 if (ed->file->mtime > ecore_file_mod_time(out)) 116 if (ed->file->mtime > ecore_file_mod_time(out))
@@ -122,6 +130,7 @@ _edje_extract_mo_files(Edje *ed)
122 else 130 else
123 ERR("Could not open for writing mo: %s: %s", out, strerror(errno)); 131 ERR("Could not open for writing mo: %s: %s", out, strerror(errno));
124 } 132 }
133 free(mo_src);
125 } 134 }
126 135
127 eina_strbuf_reset(mo_id_str); 136 eina_strbuf_reset(mo_id_str);
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index d888c36559..3b41699627 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -695,7 +695,7 @@ struct _Edje_Sound_Directory
695struct _Edje_Mo /*Mo Sample*/ 695struct _Edje_Mo /*Mo Sample*/
696{ 696{
697 const char *locale; /* the nominal name of the Mo */ 697 const char *locale; /* the nominal name of the Mo */
698 const char *mo_src; /* Mo source file */ 698 char *mo_src; /* Mo source file */
699 int id; /* the id no. of the Mo file */ 699 int id; /* the id no. of the Mo file */
700}; 700};
701 701