Allow localizaton of more base plugin strings (bug 5120, r=asherkin).

This commit is contained in:
Nicholas Hastings 2013-04-08 08:00:13 -04:00
parent a963427967
commit c0d1aaa8a0
12 changed files with 105 additions and 22 deletions

View File

@ -54,34 +54,41 @@ DisplayGagTypesMenu(client)
if (!g_Muted[target])
{
AddMenuItem(menu, "0", "Mute Player");
AddTranslatedMenuItem(menu, "0", "Mute Player", client);
}
else
{
AddMenuItem(menu, "1", "UnMute Player");
AddTranslatedMenuItem(menu, "1", "UnMute Player", client);
}
if (!g_Gagged[target])
{
AddMenuItem(menu, "2", "Gag Player");
AddTranslatedMenuItem(menu, "2", "Gag Player", client);
}
else
{
AddMenuItem(menu, "3", "UnGag Player");
AddTranslatedMenuItem(menu, "3", "UnGag Player", client);
}
if (!g_Muted[target] || !g_Gagged[target])
{
AddMenuItem(menu, "4", "Silence Player");
AddTranslatedMenuItem(menu, "4", "Silence Player", client);
}
else
{
AddMenuItem(menu, "5", "UnSilence Player");
AddTranslatedMenuItem(menu, "5", "UnSilence Player", client);
}
DisplayMenu(menu, client, MENU_TIME_FOREVER);
}
AddTranslatedMenuItem(Handle:menu, const String:opt[], const String:phrase[], client)
{
decl String:buffer[128];
Format(buffer, sizeof(buffer), "%T", phrase, client);
AddMenuItem(menu, opt, buffer);
}
DisplayGagPlayerMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_GagPlayer);

View File

@ -81,8 +81,8 @@ public OnPluginStart()
OnAdminMenuReady(topmenu);
}
g_MapList = CreateMenu(MenuHandler_ChangeMap);
SetMenuTitle(g_MapList, "Please select a map");
g_MapList = CreateMenu(MenuHandler_ChangeMap, MenuAction_Display);
SetMenuTitle(g_MapList, "%T", "Please select a map", LANG_SERVER);
SetMenuExitBackButton(g_MapList, true);
decl String:mapListPath[PLATFORM_MAX_PATH];

View File

@ -82,6 +82,12 @@ public MenuHandler_ExecCFG(Handle:menu, MenuAction:action, param1, param2)
PerformExec(param1, path);
}
else if (action == MenuAction_Display)
{
decl String:title[128];
Format(title, sizeof(title), "%T", "Choose Config", param1);
SetPanelTitle(Handle:param2, title);
}
}
public Action:Command_ExecCfg(client, args)
@ -115,8 +121,8 @@ ParseConfigs()
CloseHandle(g_ConfigMenu);
}
g_ConfigMenu = CreateMenu(MenuHandler_ExecCFG);
SetMenuTitle(g_ConfigMenu, "Choose Config");
g_ConfigMenu = CreateMenu(MenuHandler_ExecCFG, MenuAction_Display);
SetMenuTitle(g_ConfigMenu, "%T", "Choose Config", LANG_SERVER);
SetMenuExitBackButton(g_ConfigMenu, true);
decl String:configPath[256];

View File

@ -53,7 +53,12 @@ public MenuHandler_ChangeMap(Handle:menu, MenuAction:action, param1, param2)
new Handle:dp;
CreateDataTimer(3.0, Timer_ChangeMap, dp);
WritePackString(dp, map);
}
else if (action == MenuAction_Display)
{
decl String:title[128];
Format(title, sizeof(title), "%T", "Please select a map", param1);
SetPanelTitle(Handle:param2, title);
}
}

View File

@ -118,8 +118,8 @@ public OnPluginStart()
g_SelectedMaps = CreateArray(33);
g_MapList = CreateMenu(MenuHandler_Map, MenuAction_DrawItem);
SetMenuTitle(g_MapList, "Please select a map");
g_MapList = CreateMenu(MenuHandler_Map, MenuAction_DrawItem|MenuAction_Display);
SetMenuTitle(g_MapList, "%T", "Please select a map", LANG_SERVER);
SetMenuExitBackButton(g_MapList, true);
decl String:mapListPath[PLATFORM_MAX_PATH];

View File

@ -84,7 +84,9 @@ ConfirmVote(client)
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
AddMenuItem(menu, "Confirm", "Start the Vote");
decl String:itemtext[256];
Format(itemtext, sizeof(itemtext), "%T", "Start the Vote", client);
AddMenuItem(menu, "Confirm", itemtext);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
}
@ -168,6 +170,12 @@ public MenuHandler_Map(Handle:menu, MenuAction:action, param1, param2)
ConfirmVote(param1);
}
}
else if (action == MenuAction_Display)
{
decl String:title[128];
Format(title, sizeof(title), "%T", "Please select a map", param1);
SetPanelTitle(Handle:param2, title);
}
return 0;
}

View File

@ -335,3 +335,10 @@ public OnAdminMenuReady(Handle:topmenu)
}
}
AddTranslatedMenuItem(Handle:menu, const String:opt[], const String:phrase[], client)
{
decl String:buffer[128];
Format(buffer, sizeof(buffer), "%T", phrase, client);
AddMenuItem(menu, opt, buffer);
}

View File

@ -122,9 +122,9 @@ DisplayAmountMenu(client)
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
AddMenuItem(menu, "255", "Fully blind");
AddMenuItem(menu, "240", "Half blind");
AddMenuItem(menu, "0", "No blind");
AddTranslatedMenuItem(menu, "255", "Fully blind", client);
AddTranslatedMenuItem(menu, "240", "Half blind", client);
AddTranslatedMenuItem(menu, "0", "No blind", client);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
}

View File

@ -83,11 +83,11 @@ DisplayGravityAmountMenu(client)
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
AddMenuItem(menu, "4.0", "Gravity Very High");
AddMenuItem(menu, "2.0", "Gravity High");
AddMenuItem(menu, "1.0", "Gravity Normal");
AddMenuItem(menu, "0.5", "Gravity Low");
AddMenuItem(menu, "0.1", "Gravity Very Low");
AddTranslatedMenuItem(menu, "4.0", "Gravity Very High", client);
AddTranslatedMenuItem(menu, "2.0", "Gravity High", client);
AddTranslatedMenuItem(menu, "1.0", "Gravity Normal", client);
AddTranslatedMenuItem(menu, "0.5", "Gravity Low", client);
AddTranslatedMenuItem(menu, "0.1", "Gravity Very Low", client);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
}

View File

@ -45,4 +45,34 @@
"#format" "{1:t}"
"en" "Unsilenced {1}."
}
"Mute Player"
{
"en" "Mute Player"
}
"UnMute Player"
{
"en" "UnMute Player"
}
"Gag Player"
{
"en" "Gag Player"
}
"UnGag Player"
{
"en" "UnGag Player"
}
"Silence Player"
{
"en" "Silence Player"
}
"UnSilence Player"
{
"en" "UnSilence Player"
}
}

View File

@ -88,4 +88,14 @@
{
"en" "Confirm Vote"
}
"Please select a map"
{
"en" "Please select a map"
}
"Start the Vote"
{
"en" "Start the Vote"
}
}

View File

@ -141,4 +141,14 @@
"#format" "{1:s}"
"en" "Cvar {1} is now protected."
}
"Please select a map"
{
"en" "Please select a map"
}
"Choose Config"
{
"en" "Choose Config"
}
}