mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-04-29 14:56:21 +00:00
Fix language selection on Windows and MacOSX
This commit is contained in:
parent
cb878f6c00
commit
44cdea0cfd
2 changed files with 4 additions and 31 deletions
|
|
@ -1200,12 +1200,7 @@ static void linphone_gtk_fill_langs(GtkWidget *pb){
|
||||||
int i=0,index=0;
|
int i=0,index=0;
|
||||||
int cur_lang_index=-1;
|
int cur_lang_index=-1;
|
||||||
char text[256]={0};
|
char text[256]={0};
|
||||||
const char *cur_lang;
|
const char *cur_lang = g_getenv("LANGUAGE");
|
||||||
#if defined(WIN32) || defined(__APPLE__)
|
|
||||||
cur_lang=getenv("LANG");
|
|
||||||
#else
|
|
||||||
cur_lang=getenv("LANGUAGE");
|
|
||||||
#endif
|
|
||||||
if (cur_lang==NULL) cur_lang="C";
|
if (cur_lang==NULL) cur_lang="C";
|
||||||
/* glade creates a combo box without list model and text renderer,
|
/* glade creates a combo box without list model and text renderer,
|
||||||
unless we fill it with a dummy text.
|
unless we fill it with a dummy text.
|
||||||
|
|
@ -1227,12 +1222,7 @@ static void linphone_gtk_fill_langs(GtkWidget *pb){
|
||||||
void linphone_gtk_lang_changed(GtkComboBox *combo){
|
void linphone_gtk_lang_changed(GtkComboBox *combo){
|
||||||
const char *selected=gtk_combo_box_get_active_text(combo);
|
const char *selected=gtk_combo_box_get_active_text(combo);
|
||||||
char code[10];
|
char code[10];
|
||||||
const char *cur_lang;
|
const char *cur_lang=g_getenv("LANGUAGE");
|
||||||
#if defined(WIN32) || defined(__APPLE__)
|
|
||||||
cur_lang=getenv("LANG");
|
|
||||||
#else
|
|
||||||
cur_lang=getenv("LANGUAGE");
|
|
||||||
#endif
|
|
||||||
if (selected!=NULL){
|
if (selected!=NULL){
|
||||||
sscanf(selected,"%s",code);
|
sscanf(selected,"%s",code);
|
||||||
if (cur_lang==NULL) cur_lang="C";
|
if (cur_lang==NULL) cur_lang="C";
|
||||||
|
|
|
||||||
|
|
@ -155,30 +155,13 @@ const char *linphone_gtk_get_lang(const char *config_file){
|
||||||
|
|
||||||
void linphone_gtk_set_lang(const char *code){
|
void linphone_gtk_set_lang(const char *code){
|
||||||
LpConfig *cfg=linphone_core_get_config(linphone_gtk_get_core());
|
LpConfig *cfg=linphone_core_get_config(linphone_gtk_get_core());
|
||||||
const char *curlang;
|
const char *curlang=g_getenv("LANGUAGE");
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
char tmp[128];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(WIN32) || defined(__APPLE__)
|
|
||||||
curlang=getenv("LANG");
|
|
||||||
#else
|
|
||||||
curlang=getenv("LANGUAGE");
|
|
||||||
#endif
|
|
||||||
if (curlang!=NULL && strncmp(curlang,code,2)==0) {
|
if (curlang!=NULL && strncmp(curlang,code,2)==0) {
|
||||||
/* do not loose the _territory@encoding part*/
|
/* do not loose the _territory@encoding part*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lp_config_set_string(cfg,"GtkUi","lang",code);
|
lp_config_set_string(cfg,"GtkUi","lang",code);
|
||||||
#ifdef WIN32
|
g_setenv("LANGUAGE",code,1);
|
||||||
snprintf(tmp,sizeof(tmp),"LANG=%s",code);
|
|
||||||
_putenv(tmp);
|
|
||||||
#elif __APPLE__
|
|
||||||
setenv("LANG",code,1);
|
|
||||||
#else
|
|
||||||
setenv("LANGUAGE",code,1);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const gchar *linphone_gtk_get_ui_config(const char *key, const char *def){
|
const gchar *linphone_gtk_get_ui_config(const char *key, const char *def){
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue