mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-20 04:42:18 +02:00
allow loading of other locals on top of the current locale (to enable unfilled strings to default to english if necessary)
This commit is contained in:
parent
cb3426ae20
commit
50666040e5
@ -357,24 +357,33 @@ static inline bool lookup_getstring(const char *lookup_val,
|
||||
|
||||
lookup_t text_lookup_create(const char *path)
|
||||
{
|
||||
struct text_lookup *lookup;
|
||||
struct text_lookup *lookup = bmalloc(sizeof(struct text_lookup));
|
||||
memset(lookup, 0, sizeof(struct text_lookup));
|
||||
|
||||
if (!text_lookup_add(lookup, path)) {
|
||||
bfree(lookup);
|
||||
lookup = NULL;
|
||||
}
|
||||
|
||||
return lookup;
|
||||
}
|
||||
|
||||
bool text_lookup_add(lookup_t lookup, const char *path)
|
||||
{
|
||||
struct dstr file_str;
|
||||
char *temp = NULL;
|
||||
FILE *file;
|
||||
|
||||
file = os_fopen(path, "rb");
|
||||
if (!file)
|
||||
return NULL;
|
||||
return false;
|
||||
|
||||
os_fread_utf8(file, &temp);
|
||||
dstr_init_move_array(&file_str, temp);
|
||||
fclose(file);
|
||||
|
||||
if (!file_str.array)
|
||||
return NULL;
|
||||
|
||||
lookup = bmalloc(sizeof(struct text_lookup));
|
||||
memset(lookup, 0, sizeof(struct text_lookup));
|
||||
return false;
|
||||
|
||||
lookup->top = bmalloc(sizeof(struct text_node));
|
||||
memset(lookup->top, 0, sizeof(struct text_node));
|
||||
@ -383,7 +392,7 @@ lookup_t text_lookup_create(const char *path)
|
||||
lookup_addfiledata(lookup, file_str.array);
|
||||
dstr_free(&file_str);
|
||||
|
||||
return lookup;
|
||||
return true;
|
||||
}
|
||||
|
||||
void text_lookup_destroy(lookup_t lookup)
|
||||
|
@ -43,6 +43,7 @@ typedef struct text_lookup *lookup_t;
|
||||
|
||||
/* functions */
|
||||
EXPORT lookup_t text_lookup_create(const char *path);
|
||||
EXPORT bool text_lookup_add(lookup_t lookup, const char *path);
|
||||
EXPORT void text_lookup_destroy(lookup_t lookup);
|
||||
EXPORT bool text_lookup_getstr(lookup_t lookup, const char *lookup_val,
|
||||
const char **out);
|
||||
|
Loading…
Reference in New Issue
Block a user