static Edje_Program *sequencing = NULL;
static Eina_List *sequencing_lookups = NULL;
+Eina_List *po_files;
+
struct _Edje_Cc_Handlers_Hierarchy_Info
{ /* Struct that keeps globals value to impl hierarchy */
Edje_Part_Collection_Directory_Entry *current_de;
..
file {
locale: "en_IN";
- source: "domain_name.mo";
+ source: "domain_name.po";
}
file {
locale: "en_US";
- source: "domain_name.mo";
+ source: "domain_name.po";
}
}
@description
- The file block defines the mo file.
+ The file block defines the po or mo file.
@endblock
@property
name
@parameters
[locale name]
@effect
- Used to include each mo file. The full path to the directory holding
- the mo file can be defined later with edje_cc's "-md" option.
+ Used to include each po or mo file. The full path to the directory holding
+ the po or mo file can be defined later with edje_cc's "-md" option.
@since 1.15
@endproperty
@property
source
@parameters
- [mo file name]
+ [po file name or Mo file name]
@effect
- The mo source file name (Source should be a valid mo file.
- Only mo files are supported now)
+ The po or mo source file name (Source should be a valid po or mo file.
+ Only po or mo files are supported now)
@since 1.15
@endproperty
*/
st_collections_group_translation_file_source(void)
{
Edje_Mo *mo_entry;
-
+ char *mo_path_str;
check_arg_count(1);
if (!edje_file->mo_dir->mo_entries)
{
Eet_File *ef;
Edje_Mo *mo_entry;
+ char *mo_path;
+ Ecore_Exe *exe;
char *errstr;
};
static 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));
+extern Eina_List *po_files;
+
Edje_File *edje_file = NULL;
Eina_List *edje_collections = NULL;
Eina_Hash *edje_collections_lookup = NULL;
eina_file_map_free(f, m);
}
eina_file_close(f);
+ if (mw->mo_path)
+ ecore_file_remove(mo_path);
INF("Wrote %9i bytes (%4iKb) for \"%s\" %s mo entry \"%s\"",
bytes, (bytes + 512) / 1024, moid_str, "RAW PCM", mw->mo_entry->locale);
error_and_abort(mw->ef, mw->errstr);
free(mw->errstr);
}
+ if (mw->mo_path)
+ free(mw->mo_path);
free(mw);
}
+Eina_Bool
+_exe_del_cb(void *data EINA_UNUSED, int evtype EINA_UNUSED, void *evinfo)
+{
+ Mo_Write *mw = data;
+ Ecore_Exe_Event_Del *ev = evinfo;
+ if (!ev->exe) return ECORE_CALLBACK_RENEW;
+ if (ecore_exe_data_get(ev->exe) != mw) return ECORE_CALLBACK_RENEW;
+ if (ev->exit_code != 0)
+ {
+ error_and_abort(mw->ef, "Creation of .mo from .po failed.");
+ return ECORE_CALLBACK_CANCEL;
+ }
+ if (ecore_file_exists(mw->mo_path))
+ {
+ if (threads)
+ ecore_thread_run(data_thread_mo, data_thread_mo_end, NULL, mw);
+ else
+ {
+ data_thread_mo(mw, NULL);
+ data_thread_mo_end(mw, NULL);
+ }
+ }
+ else
+ return ECORE_CALLBACK_RENEW;
+ if (pending_threads <= 0) ecore_main_loop_quit();
+ return ECORE_CALLBACK_CANCEL;
+}
static void
data_write_mo(Eet_File *ef, int *mo_num)
if ((edje_file) && (edje_file->mo_dir))
{
int i;
+ char *po_entry;
+ char *sub_str;
+ char buf[PATH_MAX];
+ Eina_List *ll;
+ char *dir_path = NULL;
+ char mo_path[PATH_MAX];
+ char po_path[PATH_MAX];
for (i = 0; i < (int)edje_file->mo_dir->mo_entries_count; i++)
{
Mo_Write *mw;
-
mw = calloc(1, sizeof(Mo_Write));
if (!mw) continue;
mw->ef = ef;
mw->mo_entry = &edje_file->mo_dir->mo_entries[i];
*mo_num += 1;
pending_threads++;
- if (threads)
- ecore_thread_run(data_thread_mo, data_thread_mo_end, NULL, mw);
- else
+
+ po_entry = strdup(mw->mo_entry->mo_src);
+ sub_str = strstr(mw->mo_entry->mo_src, ".po");
+
+ if (sub_str)
{
- data_thread_mo(mw, NULL);
- data_thread_mo_end(mw, NULL);
+ sub_str[1] = 'm';
+ EINA_LIST_FOREACH(mo_dirs, ll, dir_path)
+ {
+ snprintf((char *)mo_path, sizeof(mo_path), "%s/%s/%s", dir_path, mw->mo_entry->locale, mw->mo_entry->mo_src);
+ snprintf((char *)po_path, sizeof(po_path), "%s/%s/%s", dir_path, mw->mo_entry->locale, po_entry);
+ if (ecore_file_exists(po_path))
+ {
+ snprintf(buf, sizeof(buf), "msgfmt -o %s %s", mo_path, po_path);
+ mw->mo_path = strdup(mo_path);
+ mw->exe = ecore_exe_run(buf, mw);
+ ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
+ _exe_del_cb, mw);
+ }
+ else
+ error_and_abort(mw->ef, "Invalid .po file.");
+ }
+ }
+ else
+ {
+ if (threads)
+ ecore_thread_run(data_thread_mo, data_thread_mo_end, NULL, mw);
+ else
+ {
+ data_thread_mo(mw, NULL);
+ data_thread_mo_end(mw, NULL);
+ }
}
+ free(po_entry);
}
}
}
translation {
file {
locale: en_IN;
- source: domain_name.mo; /* Can be either .po file or .mo file */
+ source: domain_name.po; /* Can be either .po file or .mo file*/
}
file {
locale: hi_IN;
- source: domain_name.mo;
+ source: domain_name.po;
}
file {
locale: ta_IN;
- source: domain_name.mo;
+ source: domain_name.po;
}
}
styles {
translation {
file {
locale: en_IN;
- source: domain_name.mo;
+ source: domain_name.po;
}
file {
locale: hi_IN;
- source: domain_name.mo;
+ source: domain_name.po;
}
file {
locale: ta_IN;
translation {
file {
locale: en_IN;
- source: domain_name.mo;
+ source: domain_name.po;
}
file {
locale: hi_IN;
- source: domain_name.mo;
+ source: domain_name.po;
}
file {
locale: ta_IN;
translation {
file {
locale: en_IN;
- source: domain_name.mo;
+ source: domain_name.po;
}
file {
locale: hi_IN;
- source: domain_name.mo;
+ source: domain_name.po;
}
file {
locale: ta_IN;
Edje_Mo *mo_entry;
char out[PATH_MAX];
char outdir[PATH_MAX];
+ char *sub_str;
+ char *mo_src;
mo_entry = &ed->file->mo_dir->mo_entries[i];
"%s/edje/%s/LC_MESSAGES",
cache_path, mo_entry->locale);
ecore_file_mkpath(outdir);
+ mo_src = strdup(mo_entry->mo_src);
+ sub_str = strstr(mo_src, ".po");
+
+ if (sub_str)
+ sub_str[1] = 'm';
+
snprintf(out, sizeof(out), "%s/%s-%s",
- outdir, ed->file->fid, mo_entry->mo_src);
+ outdir, ed->file->fid, mo_src);
if (ecore_file_exists(out))
{
if (ed->file->mtime > ecore_file_mod_time(out))
else
ERR("Could not open for writing mo: %s: %s", out, strerror(errno));
}
+ free(mo_src);
}
eina_strbuf_reset(mo_id_str);