summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/edje/edje_cc_handlers.c20
-rwxr-xr-xsrc/bin/edje/edje_cc_out.c80
2 files changed, 85 insertions, 15 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}