ui: Add starter of a translation reference example
This commit is contained in:
parent
557f42bf31
commit
95c0ffad65
|
@ -1 +1,3 @@
|
|||
build
|
||||
*.pot
|
||||
|
||||
|
|
|
@ -9,4 +9,5 @@ efl = dependency('efl-ui', version : '>=1.20.99')
|
|||
|
||||
inc = include_directories('.')
|
||||
subdir('src')
|
||||
subdir('po')
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
src/ui_translation.c
|
|
@ -0,0 +1,4 @@
|
|||
i18n = import('i18n')
|
||||
i18n.gettext('example_translation',
|
||||
args : '--keyword=efl_ui_translatable_text_set:2')
|
||||
|
|
@ -13,3 +13,11 @@ executable('efl_reference_ui_container',
|
|||
include_directories : inc,
|
||||
install : true
|
||||
)
|
||||
|
||||
executable('efl_reference_ui_translation',
|
||||
files(['ui_translation.c']),
|
||||
dependencies : deps,
|
||||
include_directories : inc,
|
||||
install : true
|
||||
)
|
||||
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
#define EFL_EO_API_SUPPORT 1
|
||||
#define EFL_BETA_API_SUPPORT 1
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Eina.h>
|
||||
#include <Elementary.h>
|
||||
#include <Efl_Ui.h>
|
||||
|
||||
/*
|
||||
* Efl.Ui translation exmaples.
|
||||
*
|
||||
* Efl.Ui contains a way to manage translations provided by gettext or
|
||||
* other translation provider. This example shows how to set it up and to
|
||||
* extract strings for translation. (see src/meson.build).
|
||||
*
|
||||
* The gettext extraction command is:
|
||||
* "xgettext --keyword=efl_ui_translatable_text_set:2 --from-code=utf-8 --foreign-user"
|
||||
*
|
||||
* In this project you can go to build/ and execute "ninja example_translation-pot"
|
||||
*/
|
||||
#define _TEXT_DOMAIN "example_translation"
|
||||
|
||||
EAPI_MAIN void
|
||||
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
||||
{
|
||||
Efl_Ui_Win *win, *box;
|
||||
|
||||
win = efl_add(EFL_UI_WIN_CLASS, NULL,
|
||||
efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC),
|
||||
efl_ui_translatable_text_set(efl_added, "Translations",
|
||||
_TEXT_DOMAIN),
|
||||
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
|
||||
|
||||
box = efl_add(EFL_UI_BOX_CLASS, win,
|
||||
efl_content_set(win, efl_added));
|
||||
|
||||
efl_add(EFL_UI_BUTTON_CLASS, win,
|
||||
efl_ui_translatable_text_set(efl_added, "Translations", _TEXT_DOMAIN),
|
||||
efl_pack_end(box, efl_added));
|
||||
|
||||
efl_add(EFL_UI_BUTTON_CLASS, win,
|
||||
efl_ui_translatable_text_set(efl_added, "Help", _TEXT_DOMAIN),
|
||||
efl_pack_end(box, efl_added));
|
||||
|
||||
efl_add(EFL_UI_BUTTON_CLASS, win,
|
||||
efl_ui_translatable_text_set(efl_added, "Quit", _TEXT_DOMAIN),
|
||||
efl_pack_end(box, efl_added),
|
||||
efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(100, 100)));
|
||||
|
||||
efl_gfx_size_set(win, EINA_SIZE2D(320, 320));
|
||||
}
|
||||
EFL_MAIN()
|
||||
|
Loading…
Reference in New Issue