Ephoto: More localization! Translators: Update your translations and add new ones!

This commit is contained in:
Stephen Houston 2015-08-10 15:58:16 -05:00
parent d9f7185984
commit 2cdf0d8126
5 changed files with 42 additions and 28 deletions

View File

@ -1,5 +1,3 @@
#include <Elementary.h>
#include "config.h"
#include "ephoto.h" #include "ephoto.h"
static void _ephoto_display_usage(void); static void _ephoto_display_usage(void);
@ -19,6 +17,7 @@ elm_main(int argc, char **argv)
#if HAVE_GETTEXT && ENABLE_NLS #if HAVE_GETTEXT && ENABLE_NLS
elm_app_compile_locale_set(LOCALEDIR); elm_app_compile_locale_set(LOCALEDIR);
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
bind_textdomain_codeset(PACKAGE, "UTF-8");
textdomain(PACKAGE); textdomain(PACKAGE);
#endif #endif

View File

@ -21,7 +21,14 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <dirent.h> #include <dirent.h>
#ifdef HAVE_PO
#include <locale.h>
#endif
#ifdef HAVE_GETTEXT
#include "gettext.h" #include "gettext.h"
#endif
typedef struct _Ephoto_Config Ephoto_Config; typedef struct _Ephoto_Config Ephoto_Config;
typedef struct _Ephoto Ephoto; typedef struct _Ephoto Ephoto;

View File

@ -106,6 +106,7 @@ _add_slideshow_config(Evas_Object *parent, Ephoto *ephoto)
Evas_Object *box, *scroller, *table, *label, *spinner, *hoversel, *hbox, *ic, *button; Evas_Object *box, *scroller, *table, *label, *spinner, *hoversel, *hbox, *ic, *button;
const Eina_List *l; const Eina_List *l;
const char *transition; const char *transition;
char buf[PATH_MAX];
box = elm_box_add(parent); box = elm_box_add(parent);
elm_box_horizontal_set(box, EINA_FALSE); elm_box_horizontal_set(box, EINA_FALSE);
@ -124,12 +125,15 @@ _add_slideshow_config(Evas_Object *parent, Ephoto *ephoto)
evas_object_show(table); evas_object_show(table);
label = elm_label_add(table); label = elm_label_add(table);
elm_object_text_set(label, "<b>Slideshow Options:</b>"); snprintf(buf, PATH_MAX, "<b>%s</b>", _("Slideshow Options"));
elm_object_text_set(label, buf);
elm_table_pack(table, label, 0, 0, 2, 1); elm_table_pack(table, label, 0, 0, 2, 1);
evas_object_show(label); evas_object_show(label);
label = elm_label_add(table); label = elm_label_add(table);
elm_object_text_set(label, "<b>Show Each Slide For: </b>"); memset(buf, 0, PATH_MAX);
snprintf(buf, PATH_MAX, "<b>%s:</b>", _("Show Each Slide For"));
elm_object_text_set(label, buf);
evas_object_size_hint_align_set(label, 1.0, EVAS_HINT_FILL); evas_object_size_hint_align_set(label, 1.0, EVAS_HINT_FILL);
elm_table_pack(table, label, 0, 1, 1, 1); elm_table_pack(table, label, 0, 1, 1, 1);
evas_object_show(label); evas_object_show(label);
@ -145,7 +149,9 @@ _add_slideshow_config(Evas_Object *parent, Ephoto *ephoto)
ephoto->config->slide_time = spinner; ephoto->config->slide_time = spinner;
label = elm_label_add(table); label = elm_label_add(table);
elm_object_text_set(label, "<b>Slide Transition:</b>"); memset(buf, 0, PATH_MAX);
snprintf(buf, PATH_MAX, "<b>%s:</b>", _("Slide Transition"));
elm_object_text_set(label, buf);
evas_object_size_hint_align_set(label, 1.0, EVAS_HINT_FILL); evas_object_size_hint_align_set(label, 1.0, EVAS_HINT_FILL);
elm_table_pack(table, label, 0, 2, 1, 1); elm_table_pack(table, label, 0, 2, 1, 1);
evas_object_show(label); evas_object_show(label);
@ -332,12 +338,12 @@ ephoto_config_window(Ephoto *ephoto)
slideshow = _add_slideshow_config(pager, ephoto); slideshow = _add_slideshow_config(pager, ephoto);
sit = elm_naviframe_item_push(pager, NULL, NULL, NULL, slideshow, "overlap"); sit = elm_naviframe_item_push(pager, NULL, NULL, NULL, slideshow, "overlap");
elm_naviframe_item_title_enabled_set(sit, EINA_FALSE, EINA_FALSE); elm_naviframe_item_title_enabled_set(sit, EINA_FALSE, EINA_FALSE);
elm_toolbar_item_append(toolbar, "media-playback-start", "Slideshow", _show_page, sit); elm_toolbar_item_append(toolbar, "media-playback-start", _("Slideshow"), _show_page, sit);
about = _add_about_config(pager, ephoto); about = _add_about_config(pager, ephoto);
ait = elm_naviframe_item_insert_after(pager, sit, NULL, NULL, NULL, about, "overlap"); ait = elm_naviframe_item_insert_after(pager, sit, NULL, NULL, NULL, about, "overlap");
elm_naviframe_item_title_enabled_set(ait, EINA_FALSE, EINA_FALSE); elm_naviframe_item_title_enabled_set(ait, EINA_FALSE, EINA_FALSE);
elm_toolbar_item_append(toolbar, "help-about", "About", _show_page, ait); elm_toolbar_item_append(toolbar, "help-about", _("About"), _show_page, ait);
elm_naviframe_item_promote(sit); elm_naviframe_item_promote(sit);

View File

@ -515,23 +515,23 @@ _ephoto_get_file_size(const char *path)
size_t size = eina_file_size_get(f); size_t size = eina_file_size_get(f);
eina_file_close(f); eina_file_close(f);
double dsize = (double)size; double dsize = (double)size;
if (dsize < 1024.0) snprintf(isize, sizeof(isize), "%'.0f bytes", dsize); if (dsize < 1024.0) snprintf(isize, sizeof(isize), "%'.0f %s", dsize, _("bytes"));
else else
{ {
dsize /= 1024.0; dsize /= 1024.0;
if (dsize < 1024) snprintf(isize, sizeof(isize), "%'.0f KB", dsize); if (dsize < 1024) snprintf(isize, sizeof(isize), "%'.0f %s", dsize, _("KB"));
else else
{ {
dsize /= 1024.0; dsize /= 1024.0;
if (dsize < 1024) snprintf(isize, sizeof(isize), "%'.1f MB", dsize); if (dsize < 1024) snprintf(isize, sizeof(isize), "%'.1f %s", dsize, _("MB"));
else else
{ {
dsize /= 1024.0; dsize /= 1024.0;
if (dsize < 1024) snprintf(isize, sizeof(isize), "%'.1f GB", dsize); if (dsize < 1024) snprintf(isize, sizeof(isize), "%'.1f %s", dsize, _("GB"));
else else
{ {
dsize /= 1024.0; dsize /= 1024.0;
snprintf(isize, sizeof(isize), "%'.1f TB", dsize); snprintf(isize, sizeof(isize), "%'.1f %s", dsize, _("TB"));
} }
} }
} }
@ -613,9 +613,9 @@ _ephoto_single_browser_recalc(Ephoto_Single_Browser *sb)
{ {
evas_object_image_size_get(elm_image_object_get(v->image), &w, &h); evas_object_image_size_get(elm_image_object_get(v->image), &w, &h);
snprintf(image_info, PATH_MAX, snprintf(image_info, PATH_MAX,
"<b>Type:</b> %s <b>Resolution:</b> %dx%d <b>File Size: </b>%s", "<b>%s:</b> %s <b>%s:</b> %dx%d <b>%s:</b> %s",
efreet_mime_type_get(sb->entry->path), w, h, _("Type"), efreet_mime_type_get(sb->entry->path), _("Resolution"), w, h,
_ephoto_get_file_size(sb->entry->path)); _("File Size"), _ephoto_get_file_size(sb->entry->path));
sb->botbox = evas_object_rectangle_add(evas_object_evas_get(sb->table)); sb->botbox = evas_object_rectangle_add(evas_object_evas_get(sb->table));
evas_object_color_set(sb->botbox, 0, 0, 0, 0); evas_object_color_set(sb->botbox, 0, 0, 0, 0);
evas_object_size_hint_min_set(sb->botbox, 0, sb->ephoto->bottom_bar_size); evas_object_size_hint_min_set(sb->botbox, 0, sb->ephoto->bottom_bar_size);
@ -639,12 +639,12 @@ _ephoto_single_browser_recalc(Ephoto_Single_Browser *sb)
{ {
sb->nolabel = elm_label_add(sb->table); sb->nolabel = elm_label_add(sb->table);
elm_label_line_wrap_set(sb->nolabel, ELM_WRAP_WORD); elm_label_line_wrap_set(sb->nolabel, ELM_WRAP_WORD);
elm_object_text_set(sb->nolabel, "This image does not exist or is corrupted"); elm_object_text_set(sb->nolabel, _("This image does not exist or is corrupted!"));
evas_object_size_hint_weight_set(sb->nolabel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(sb->nolabel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(sb->nolabel, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(sb->nolabel, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(sb->table, sb->nolabel, 0, 1, 4, 1); elm_table_pack(sb->table, sb->nolabel, 0, 1, 4, 1);
evas_object_show(sb->nolabel); evas_object_show(sb->nolabel);
ephoto_title_set(sb->ephoto, "Bad Image"); ephoto_title_set(sb->ephoto, _("Bad Image"));
} }
} }
@ -1213,9 +1213,9 @@ _apply_crop(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUS
evas_object_del(sb->botbox); evas_object_del(sb->botbox);
snprintf(image_info, PATH_MAX, snprintf(image_info, PATH_MAX,
"<b>Type:</b> %s <b>Resolution:</b> %dx%d <b>File Size: </b>%s", "<b>%s:</b> %s <b>%s:</b> %dx%d <b>%s:</b> %s",
efreet_mime_type_get(tmp_path), nw, nh, _("Type"), efreet_mime_type_get(tmp_path), _("Resolution"), nw, nh,
_ephoto_get_file_size(tmp_path)); _("File Size"), _ephoto_get_file_size(tmp_path));
sb->botbox = evas_object_rectangle_add(evas_object_evas_get(sb->table)); sb->botbox = evas_object_rectangle_add(evas_object_evas_get(sb->table));
evas_object_color_set(sb->botbox, 0, 0, 0, 0); evas_object_color_set(sb->botbox, 0, 0, 0, 0);
evas_object_size_hint_min_set(sb->botbox, 0, sb->ephoto->bottom_bar_size); evas_object_size_hint_min_set(sb->botbox, 0, sb->ephoto->bottom_bar_size);

View File

@ -676,6 +676,7 @@ _ephoto_thumb_populate_end(void *data, int type EINA_UNUSED, void *event EINA_UN
{ {
if (!tb->nolabel) if (!tb->nolabel)
{ {
char buf[PATH_MAX];
tb->nolabel = elm_label_add(tb->table); tb->nolabel = elm_label_add(tb->table);
elm_label_line_wrap_set(tb->nolabel, ELM_WRAP_WORD); elm_label_line_wrap_set(tb->nolabel, ELM_WRAP_WORD);
elm_object_text_set(tb->nolabel, _("There are no images in this directory")); elm_object_text_set(tb->nolabel, _("There are no images in this directory"));
@ -683,7 +684,8 @@ _ephoto_thumb_populate_end(void *data, int type EINA_UNUSED, void *event EINA_UN
evas_object_size_hint_align_set(tb->nolabel, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(tb->nolabel, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(tb->table, tb->nolabel, 0, 0, 4, 1); elm_table_pack(tb->table, tb->nolabel, 0, 0, 4, 1);
evas_object_show(tb->nolabel); evas_object_show(tb->nolabel);
elm_object_text_set(tb->infolabel, "<b>Total</b> 0 images <b>Size:</b> 0 bytes"); snprintf(buf, PATH_MAX, "<b>%s:</b> 0 %s <b>%s:</b> 0 %s", _("Total"), _("images"), _("Size"), _("bytes"));
elm_object_text_set(tb->infolabel, buf);
} }
} }
else else
@ -697,29 +699,29 @@ _ephoto_thumb_populate_end(void *data, int type EINA_UNUSED, void *event EINA_UN
char isize[PATH_MAX]; char isize[PATH_MAX];
char image_info[PATH_MAX]; char image_info[PATH_MAX];
if (tb->totsize < 1024.0) snprintf(isize, sizeof(isize), "%'.0f bytes", tb->totsize); if (tb->totsize < 1024.0) snprintf(isize, sizeof(isize), "%'.0f %s", tb->totsize, _("bytes"));
else else
{ {
tb->totsize /= 1024.0; tb->totsize /= 1024.0;
if (tb->totsize < 1024) snprintf(isize, sizeof(isize), "%'.0f KB", tb->totsize); if (tb->totsize < 1024) snprintf(isize, sizeof(isize), "%'.0f %s", tb->totsize, _("KB"));
else else
{ {
tb->totsize /= 1024.0; tb->totsize /= 1024.0;
if (tb->totsize < 1024) snprintf(isize, sizeof(isize), "%'.1f MB", tb->totsize); if (tb->totsize < 1024) snprintf(isize, sizeof(isize), "%'.1f %s", tb->totsize, _("MB"));
else else
{ {
tb->totsize /= 1024.0; tb->totsize /= 1024.0;
if (tb->totsize < 1024) snprintf(isize, sizeof(isize), "%'.1f GB", tb->totsize); if (tb->totsize < 1024) snprintf(isize, sizeof(isize), "%'.1f %s", tb->totsize, _("GB"));
else else
{ {
tb->totsize /= 1024.0; tb->totsize /= 1024.0;
snprintf(isize, sizeof(isize), "%'.1f TB", tb->totsize); snprintf(isize, sizeof(isize), "%'.1f %s", tb->totsize, _("TB"));
} }
} }
} }
} }
snprintf(image_info, PATH_MAX, "<b>Total:</b> %d images <b>Size:</b> %s", snprintf(image_info, PATH_MAX, "<b>%s:</b> %d %s <b>%s:</b> %s",
tb->totimages, isize); _("Total"), tb->totimages, _("images"), _("Size"), isize);
elm_object_text_set(tb->infolabel, image_info); elm_object_text_set(tb->infolabel, image_info);
} }
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;