2017-12-29 06:13:28 +01:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#include <platform.h>
|
|
|
|
#endif
|
|
|
|
|
2014-06-14 16:52:32 +02:00
|
|
|
#include "bind_locale.h"
|
|
|
|
#include "util/language.h"
|
2015-11-27 15:14:25 +01:00
|
|
|
#include "direction.h"
|
2014-06-14 16:52:32 +02:00
|
|
|
|
|
|
|
void locale_create(const char *lang) {
|
2014-06-16 07:17:08 +02:00
|
|
|
get_or_create_locale(lang);
|
2014-06-14 16:52:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void locale_set(const char *lang, const char *key, const char *str) {
|
2014-06-16 07:17:08 +02:00
|
|
|
struct locale *loc = get_locale(lang);
|
2014-06-14 16:52:32 +02:00
|
|
|
if (loc) {
|
|
|
|
locale_setstring(loc, key, str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const char * locale_get(const char *lang, const char *key) {
|
2014-06-16 07:17:08 +02:00
|
|
|
struct locale *loc = get_locale(lang);
|
2014-06-14 16:52:32 +02:00
|
|
|
if (loc) {
|
|
|
|
return locale_getstring(loc, key);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2015-11-27 15:14:25 +01:00
|
|
|
|
|
|
|
int locale_direction(const char *lang, const char *str) {
|
|
|
|
struct locale *loc = get_locale(lang);
|
|
|
|
if (loc) {
|
|
|
|
return get_direction(str, loc);
|
|
|
|
}
|
|
|
|
return NODIRECTION;
|
|
|
|
}
|