diff --git a/amxmodx/format.cpp b/amxmodx/format.cpp index 749756a8..28543514 100644 --- a/amxmodx/format.cpp +++ b/amxmodx/format.cpp @@ -79,8 +79,12 @@ const char *translate(AMX *amx, cell amxaddr, const char *key) get_amxstring_r(amx, amxaddr, name, 3); pLangName = name; } + if (!pLangName || !isalpha(pLangName[0])) - pLangName = "en"; + { + pLangName = amxmodx_language->string; + } + //next parameter! def = g_langMngr.GetDef(pLangName, key, status); diff --git a/plugins/multilingual.sma b/plugins/multilingual.sma index 6bfb764d..28dbc721 100755 --- a/plugins/multilingual.sma +++ b/plugins/multilingual.sma @@ -20,6 +20,7 @@ new g_coloredMenus new g_cvarDisplayClientMessage; new g_cvarClientLanguages; +new g_cvarServerLanguage; public plugin_init() { @@ -30,6 +31,8 @@ public plugin_init() g_cvarClientLanguages = register_cvar("amx_client_languages", "1") g_cvarDisplayClientMessage = register_cvar("amx_language_display_msg", "1") + g_cvarServerLanguage = get_cvar_pointer("amx_language"); + register_clcmd("amx_langmenu", "cmdLangMenu", ADMIN_ALL) register_menu("Language Menu", 1023, "actionMenu") @@ -65,6 +68,12 @@ public cmdLangMenu(id, level, cid) new buffer[3] get_user_info(id, "lang", buffer, charsmax(buffer)) + + if (buffer[0] == EOS) // if "lang" is not defined, by default it will use server language. + { + get_pcvar_string(g_cvarServerLanguage, buffer, charsmax(buffer)); + } + g_menuLang[id] = get_lang_id(buffer) showMenu(id)