+
+void MWindow::check_language()
+{
+ char curr_lang[BCTEXTLEN]; curr_lang[0] = 0;
+ const char *env_lang = getenv("LANGUAGE");
+ if( !env_lang ) env_lang = getenv("LC_ALL");
+ if( !env_lang ) env_lang = getenv("LANG");
+ if( !env_lang ) {
+ snprintf(curr_lang, sizeof(curr_lang), "%s_%s-%s",
+ BC_Resources::language, BC_Resources::region, BC_Resources::encoding);
+ env_lang = curr_lang;
+ }
+ char last_lang[BCTEXTLEN]; last_lang[0] = 0;
+ defaults->get("LAST_LANG",last_lang);
+ if( strcmp(env_lang,last_lang)) {
+ printf("lang changed from '%s' to '%s'\n", last_lang, env_lang);
+ defaults->update("LAST_LANG",env_lang);
+ char plugin_path[BCTEXTLEN];
+ create_defaults_path(plugin_path, PLUGIN_FILE);
+ ::remove(plugin_path);
+ char ladspa_path[BCTEXTLEN];
+ create_defaults_path(ladspa_path, LADSPA_FILE);
+ ::remove(ladspa_path);
+ defaults->save();
+ }
+ if( strlen(env_lang) > 1 &&
+ ( env_lang[2] == 0 || env_lang[2] == '_' || env_lang[2] == '.' ) ) {
+ cin_lang[0] = env_lang[0]; cin_lang[1] = env_lang[1]; cin_lang[2] = 0;
+ }
+ else
+ strcpy(cin_lang, "en");
+}
+