summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hirt <daniel.hirt@samsung.com>2015-11-15 11:31:32 +0200
committerDaniel Hirt <daniel.hirt@samsung.com>2015-11-17 16:20:21 +0200
commit4c086b6e1bebc8e2c6c06115f1dcfd061f65bfbe (patch)
treeb882671e30bd9808ecd7f521475180402ba57a75
parent59ffefb9c1aa187435341d75f5811971ab917b2d (diff)
Evas language: add full locale language getter
evas_common_language_from_locale_get truncates the country letters in the language. We don't always want that (one example is dictionaries).
-rw-r--r--src/lib/evas/common/language/evas_language_utils.c25
-rw-r--r--src/lib/evas/common/language/evas_language_utils.h3
2 files changed, 28 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 7d13965..737b510 100644
--- a/src/lib/evas/common/language/evas_language_utils.c
+++ b/src/lib/evas/common/language/evas_language_utils.c
@@ -156,6 +156,31 @@ evas_common_language_from_locale_get(void)
156 return ""; 156 return "";
157} 157}
158 158
159const char *
160evas_common_language_from_locale_full_get(void)
161{
162 static char lang[32];
163 if (*lang) return lang;
164
165 const char *locale;
166 locale = setlocale(LC_MESSAGES, NULL);
167 if (locale && *locale)
168 {
169 size_t i;
170 for (i = 0 ; locale[i] ; i++)
171 {
172 const char c = locale[i];
173 if ((c == '.') || (c == '@') || (c == ' ')) /* Looks like en_US.UTF8 or de_DE@euro or aa_ER UTF-8*/
174 break;
175 }
176 strncpy(lang, locale, i);
177 lang[i] = '\0';
178 return lang;
179 }
180
181 return "";
182}
183
159/* 184/*
160 * @} 185 * @}
161 */ 186 */
diff --git a/src/lib/evas/common/language/evas_language_utils.h b/src/lib/evas/common/language/evas_language_utils.h
index fa795ec..5e24912 100644
--- a/src/lib/evas/common/language/evas_language_utils.h
+++ b/src/lib/evas/common/language/evas_language_utils.h
@@ -128,5 +128,8 @@ evas_common_language_char_script_get(Eina_Unicode unicode);
128 128
129const char * 129const char *
130evas_common_language_from_locale_get(void); 130evas_common_language_from_locale_get(void);
131
132const char *
133evas_common_language_from_locale_full_get(void);
131#endif 134#endif
132 135