Make Everything's plugins and action names translatable v2

This is a more straight solution than r79723.

SVN revision: 82291
This commit is contained in:
Igor Murzov 2013-01-05 22:51:43 +00:00 committed by Tom Hacohen
parent 21877e2f01
commit 7a0c1d0744
2 changed files with 31 additions and 32 deletions

View File

@ -8,8 +8,7 @@ subdir = po
top_builddir = .. top_builddir = ..
# These options get passed to xgettext. # These options get passed to xgettext.
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=ACTION_NEW:1 \ XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --from-code=UTF-8 --foreign-user
--from-code=UTF-8 --foreign-user
# This is the copyright holder that gets inserted into the header of the # This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding

View File

@ -169,12 +169,12 @@ static void _json_data_free(Json_Data *d);
/***************************************************************************/ /***************************************************************************/
static void static void
_send_notification(unsigned int id, const char *icon, const char *function, _send_notification(unsigned int id, const char *icon, const char *summary,
const char *body, int timeout) const char *body, int timeout)
{ {
E_Notification *n; E_Notification *n;
n = e_notification_full_new("Everything", id, icon, function, body, timeout); n = e_notification_full_new("Everything", id, icon, summary, body, timeout);
e_notification_send(n, NULL, NULL); e_notification_send(n, NULL, NULL);
e_notification_unref(n); e_notification_unref(n);
} }
@ -584,7 +584,7 @@ _send_request(void *data)
query = evry->util_url_escape(p->input, 0); query = evry->util_url_escape(p->input, 0);
if (!strcmp(p->base.name, N_("Translate"))) if (!strcmp(p->base.name, "Translate"))
snprintf(buf, sizeof(buf), p->request, _conf->translate, query); snprintf(buf, sizeof(buf), p->request, _conf->translate, query);
else else
snprintf(buf, sizeof(buf), p->request, _conf->lang, query); snprintf(buf, sizeof(buf), p->request, _conf->lang, query);
@ -733,7 +733,7 @@ _youtube_dl_finish(Youtube_Data *yd, int abort)
if (abort) if (abort)
{ {
_send_notification(yd->id, "emblem-sound", N_("Abort download"), _send_notification(yd->id, "emblem-sound", _("Abort download"),
yd->label, -1); yd->label, -1);
if (yd->exe1) ecore_exe_kill(yd->exe1); if (yd->exe1) ecore_exe_kill(yd->exe1);
@ -778,7 +778,7 @@ _youtube_dl_timer(void *d)
} }
char buf[128]; char buf[128];
snprintf(buf, sizeof(buf), N_("Got %d kbytes of"), snprintf(buf, sizeof(buf), _("Got %d kbytes of"),
((unsigned int)s.st_size / 1024)); ((unsigned int)s.st_size / 1024));
_send_notification(yd->id, "emblem-sound", buf, yd->label, 5000); _send_notification(yd->id, "emblem-sound", buf, yd->label, 5000);
@ -792,18 +792,18 @@ _youtube_dl_timer(void *d)
f->mime = eina_stringshare_add("audio/"); f->mime = eina_stringshare_add("audio/");
if ((yd->method == YOUTUBE_DL_ENQ) && if ((yd->method == YOUTUBE_DL_ENQ) &&
(act = evry->action_find(N_("Enqueue in Playlist")))) (act = evry->action_find("Enqueue in Playlist")))
{ {
act->it1.item = EVRY_ITEM(f); act->it1.item = EVRY_ITEM(f);
act->action(act); act->action(act);
_send_notification(yd->id, "emblem-sound", N_("Enqueue"), yd->label, -1); _send_notification(yd->id, "emblem-sound", _("Enqueue"), yd->label, -1);
} }
if ((yd->method == YOUTUBE_DL_PLAY) && if ((yd->method == YOUTUBE_DL_PLAY) &&
(act = evry->action_find(N_("Play File")))) (act = evry->action_find("Play File")))
{ {
act->it1.item = EVRY_ITEM(f); act->it1.item = EVRY_ITEM(f);
act->action(act); act->action(act);
_send_notification(yd->id, "emblem-sound", N_("Play"), yd->label, -1); _send_notification(yd->id, "emblem-sound", _("Play"), yd->label, -1);
} }
IF_RELEASE(f->path); IF_RELEASE(f->path);
IF_RELEASE(f->mime); IF_RELEASE(f->mime);
@ -833,7 +833,7 @@ _youtube_dl_cb_del(void *data, int type __UNUSED__, void *event)
yd->exe1 = NULL; yd->exe1 = NULL;
yd->exe2 = NULL; yd->exe2 = NULL;
_send_notification(yd->id, "emblem-sound", N_("Finished download"), _send_notification(yd->id, "emblem-sound", _("Finished download"),
yd->label, -1); yd->label, -1);
_youtube_dl_finish(yd, 0); _youtube_dl_finish(yd, 0);
@ -919,7 +919,7 @@ _youtube_dl_data_cb(Url_Data *dd)
download_handlers = eina_list_append(download_handlers, yd); download_handlers = eina_list_append(download_handlers, yd);
_send_notification(yd->id, "emblem-sound", N_("Start download"), yd->label, -1); _send_notification(yd->id, "emblem-sound", _("Start download"), yd->label, -1);
} }
_json_data_free(rsp); _json_data_free(rsp);
@ -1001,7 +1001,7 @@ _youtube_dl_action(Evry_Action *act)
(method == YOUTUBE_DL_ENQ)) && (method == YOUTUBE_DL_ENQ)) &&
(youtube_dl_active > 1)) (youtube_dl_active > 1))
{ {
_send_notification(1337, "emblem-sound", N_("Enqueue files for download"), "", -1); _send_notification(1337, "emblem-sound", _("Enqueue files for download"), "", -1);
youtube_dl_queue = eina_list_append(youtube_dl_queue, yd); youtube_dl_queue = eina_list_append(youtube_dl_queue, yd);
} }
else else
@ -1059,12 +1059,12 @@ _upload_data(Url_Data *dd)
len = strlen(d->value); len = strlen(d->value);
ecore_x_selection_primary_set(ecore_x_window_root_first_get(), d->value, len); ecore_x_selection_primary_set(ecore_x_window_root_first_get(), d->value, len);
ecore_x_selection_clipboard_set(ecore_x_window_root_first_get(), d->value, len); ecore_x_selection_clipboard_set(ecore_x_window_root_first_get(), d->value, len);
_send_notification(ud->id, "image", N_("Upload Image"), N_("Link copied to clipboard") , -1); _send_notification(ud->id, "image", _("Upload Image"), _("Link copied to clipboard") , -1);
_open_url(d->value); _open_url(d->value);
} }
else else
{ {
_send_notification(ud->id, "image", N_("Upload Image"), N_("Something went wrong :("), -1); _send_notification(ud->id, "image", _("Upload Image"), _("Something went wrong :("), -1);
} }
_json_data_free(rsp); _json_data_free(rsp);
@ -1089,9 +1089,9 @@ _upload_progress(Url_Data *dd, Ecore_Con_Event_Url_Progress *ev)
char buf[128]; char buf[128];
ud->progress = up; ud->progress = up;
snprintf(buf, sizeof(buf), N_("Completed %1.1f%% of %s"), up * 5.0, ud->file); snprintf(buf, sizeof(buf), _("Completed %1.1f%% of %s"), up * 5.0, ud->file);
_send_notification(ud->id, "image", N_("Upload Image"), buf, -1); _send_notification(ud->id, "image", _("Upload Image"), buf, -1);
} }
return 1; return 1;
@ -1152,7 +1152,7 @@ _action_upload(Evry_Action *act)
/* ecore_con_url_http_post_send(ud->dd->con_url, post); */ /* ecore_con_url_http_post_send(ud->dd->con_url, post); */
_send_notification(ud->id, "image", N_("Upload Image"), ud->file, -1); _send_notification(ud->id, "image", _("Upload Image"), ud->file, -1);
return 0; return 0;
} }
@ -1237,22 +1237,22 @@ _plugins_init(const Evry_API *_api)
pc->trigger_only = EINA_TRUE; \ pc->trigger_only = EINA_TRUE; \
pc->trigger = eina_stringshare_add(_trigger); }} \ pc->trigger = eina_stringshare_add(_trigger); }} \
PLUGIN_NEW("Google", EVRY_TYPE_TEXT, "google", PLUGIN_NEW(N_("Google"), EVRY_TYPE_TEXT, "google",
_begin, _finish, _fetch, &_complete, _begin, _finish, _fetch, &_complete,
_request_goolge, _google_data_cb, _request_goolge, _google_data_cb,
NULL, _trigger_google); NULL, _trigger_google);
PLUGIN_NEW("Wikipedia", EVRY_TYPE_TEXT, "wikipedia", PLUGIN_NEW(N_("Wikipedia"), EVRY_TYPE_TEXT, "wikipedia",
_begin, _finish, _fetch, &_complete, _begin, _finish, _fetch, &_complete,
_request_wiki, _wikipedia_data_cb, _request_wiki, _wikipedia_data_cb,
NULL, _trigger_wiki); NULL, _trigger_wiki);
PLUGIN_NEW("Youtube", WEBLINK, "youtube", PLUGIN_NEW(N_("Youtube"), WEBLINK, "youtube",
_begin, _finish, _fetch, &_complete, _begin, _finish, _fetch, &_complete,
_request_youtube, _youtube_data_cb, _request_youtube, _youtube_data_cb,
"gdata.youtube.com", _trigger_youtube); "gdata.youtube.com", _trigger_youtube);
PLUGIN_NEW("Translate", EVRY_TYPE_TEXT, "text-html", PLUGIN_NEW(N_("Translate"), EVRY_TYPE_TEXT, "text-html",
_begin, _finish, _fetch, NULL, _begin, _finish, _fetch, NULL,
_request_gtranslate, _gtranslate_data_cb, _request_gtranslate, _gtranslate_data_cb,
"ajax.googleapis.com", _trigger_gtranslate); "ajax.googleapis.com", _trigger_gtranslate);
@ -1265,33 +1265,33 @@ _plugins_init(const Evry_API *_api)
evry->action_register(act, 1); \ evry->action_register(act, 1); \
actions = eina_list_append(actions, act); \ actions = eina_list_append(actions, act); \
ACTION_NEW("Google for it", EVRY_TYPE_TEXT, "google", ACTION_NEW(N_("Google for it"), EVRY_TYPE_TEXT, "google",
_action, NULL, ACT_GOOGLE); _action, NULL, ACT_GOOGLE);
ACTION_NEW("Wikipedia Page", EVRY_TYPE_TEXT, "wikipedia", ACTION_NEW(N_("Wikipedia Page"), EVRY_TYPE_TEXT, "wikipedia",
_action, NULL, ACT_WIKIPEDIA); _action, NULL, ACT_WIKIPEDIA);
ACTION_NEW("Feeling Lucky", EVRY_TYPE_TEXT, "feeling-lucky", ACTION_NEW(N_("Feeling Lucky"), EVRY_TYPE_TEXT, "feeling-lucky",
_action, NULL, ACT_FEELING_LUCKY); _action, NULL, ACT_FEELING_LUCKY);
ACTION_NEW("Watch on Youtube", WEBLINK, "youtube", ACTION_NEW(N_("Watch on Youtube"), WEBLINK, "youtube",
_action, _youtube_dl_check, ACT_YOUTUBE); _action, _youtube_dl_check, ACT_YOUTUBE);
#if 0 #if 0
ACTION_NEW("Download as Audio", WEBLINK, "youtube", ACTION_NEW(N_("Download as Audio"), WEBLINK, "youtube",
_youtube_dl_action, _youtube_dl_check, YOUTUBE_DL); _youtube_dl_action, _youtube_dl_check, YOUTUBE_DL);
ACTION_NEW("Play Video", WEBLINK, "youtube", ACTION_NEW(N_("Play Video"), WEBLINK, "youtube",
_youtube_dl_action, _youtube_dl_check, YOUTUBE_PLAY); _youtube_dl_action, _youtube_dl_check, YOUTUBE_PLAY);
ACTION_NEW("Download and enqueue", WEBLINK, "youtube", ACTION_NEW(N_("Download and enqueue"), WEBLINK, "youtube",
_youtube_dl_action, _youtube_dl_check, YOUTUBE_DL_ENQ); _youtube_dl_action, _youtube_dl_check, YOUTUBE_DL_ENQ);
ACTION_NEW("Download and play", WEBLINK, "youtube", ACTION_NEW(N_("Download and play"), WEBLINK, "youtube",
_youtube_dl_action, _youtube_dl_check, YOUTUBE_DL_PLAY); _youtube_dl_action, _youtube_dl_check, YOUTUBE_DL_PLAY);
#endif #endif
ACTION_NEW("Upload Image", EVRY_TYPE_FILE, "image", ACTION_NEW(N_("Upload Image"), EVRY_TYPE_FILE, "image",
_action_upload, _action_upload_check, ACT_UPLOAD_IMGUR); _action_upload, _action_upload_check, ACT_UPLOAD_IMGUR);
act->remember_context = EINA_TRUE; act->remember_context = EINA_TRUE;