summaryrefslogtreecommitdiff
path: root/src/lib/evas/common
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2017-06-13 13:15:12 +0300
committerDaniel Hirt <hirt.danny@gmail.com>2017-06-15 08:59:17 +0300
commitcbea6e438698c27755754049d35158336ca6daeb (patch)
tree76c5016c035945e68fd48434ba6614c4641dbb40 /src/lib/evas/common
parent73651cef71abe47792def4794607505ab7f01adb (diff)
evas textblock: add align=locale option to respect locale's direction
Summary: There are many requests to add a new feature for handling horizontal align according to current locale. For example, in RTL locale setting, users want to see right aligned text for every list's item. Even if some of list's items only contain LTR characters! It is useful for the needs. @feature Test Plan: N/A Reviewers: herdsman, tasn, woohyun, raster, cedric Reviewed By: herdsman, raster Subscribers: z-wony, jpeg Differential Revision: https://phab.enlightenment.org/D4664
Diffstat (limited to 'src/lib/evas/common')
-rw-r--r--src/lib/evas/common/language/evas_language_utils.c19
-rw-r--r--src/lib/evas/common/language/evas_language_utils.h3
2 files changed, 22 insertions, 0 deletions
diff --git a/src/lib/evas/common/language/evas_language_utils.c b/src/lib/evas/common/language/evas_language_utils.c
index ce075a1534..8eda465480 100644
--- a/src/lib/evas/common/language/evas_language_utils.c
+++ b/src/lib/evas/common/language/evas_language_utils.c
@@ -22,6 +22,7 @@
22 22
23#include <stdlib.h> 23#include <stdlib.h>
24#include <locale.h> 24#include <locale.h>
25#include <libintl.h>
25 26
26#ifdef HAVE_EVIL 27#ifdef HAVE_EVIL
27# include <Evil.h> 28# include <Evil.h>
@@ -47,6 +48,7 @@
47 48
48static char lang[6]; /* FIXME: Maximum length I know about */ 49static char lang[6]; /* FIXME: Maximum length I know about */
49static char lang_full[32]; 50static char lang_full[32];
51static Evas_BiDi_Direction lang_dir = EVAS_BIDI_DIRECTION_NEUTRAL;
50 52
51static Evas_Script_Type 53static Evas_Script_Type
52_evas_common_language_char_script_search(Eina_Unicode unicode) 54_evas_common_language_char_script_search(Eina_Unicode unicode)
@@ -194,10 +196,27 @@ evas_common_language_from_locale_full_get(void)
194 return ""; 196 return "";
195} 197}
196 198
199Evas_BiDi_Direction
200evas_common_language_direction_get(void)
201{
202 if (lang_dir == EVAS_BIDI_DIRECTION_NEUTRAL)
203 {
204 const char *dir_str = dgettext(PACKAGE, "default:LTR");
205
206 if (dir_str && !strcmp(dir_str, "default:RTL"))
207 lang_dir = EVAS_BIDI_DIRECTION_RTL;
208 else
209 lang_dir = EVAS_BIDI_DIRECTION_LTR;
210 }
211
212 return lang_dir;
213}
214
197void 215void
198evas_common_language_reinit(void) 216evas_common_language_reinit(void)
199{ 217{
200 *lang = *lang_full = '\0'; 218 *lang = *lang_full = '\0';
219 lang_dir = EVAS_BIDI_DIRECTION_NEUTRAL;
201} 220}
202 221
203/* 222/*
diff --git a/src/lib/evas/common/language/evas_language_utils.h b/src/lib/evas/common/language/evas_language_utils.h
index 8c7529a572..1ecde84967 100644
--- a/src/lib/evas/common/language/evas_language_utils.h
+++ b/src/lib/evas/common/language/evas_language_utils.h
@@ -132,6 +132,9 @@ evas_common_language_from_locale_get(void);
132const char * 132const char *
133evas_common_language_from_locale_full_get(void); 133evas_common_language_from_locale_full_get(void);
134 134
135Evas_BiDi_Direction
136evas_common_language_direction_get(void);
137
135void 138void
136evas_common_language_reinit(void); 139evas_common_language_reinit(void);
137#endif 140#endif