mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
Use server language as fallback if client's "lang" key is not defined.
This commit is contained in:
parent
8c591bf065
commit
c03271c856
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user