Locale.Lookup (Civ5 API)

From Civilization Modding Wiki
Revision as of 20:35, 19 September 2012 by DonQuich (talk | contribs) (Bot update)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This page is a part of the Lua and UI Reference (Civ5).


Function.png This function is a member of Locale.

This is a static method, invoke it with a dot.


Converts a text key into a localized string


Usage

string Locale.Lookup(string key, ...)


Returned Value

Returns the textkey if it cannot be found in the dictionary, or a translated string.

Parameters

key: A valid text key.
...: none or many arguments that are used when composing the final localized string.

Notes

This method does the exact same thing as Locale.ConvertTextKey.
This localized string may or may not be in the user's current language. With support for fall-back language support, the localization system will attempt to search all available languages for the string.


Examples

local foo = Locale.ConvertTextKey("TXT_KEY_MAIN_MENU");
print(foo); -- prints "Main Menu" in English


Source code samples

Too many occurences. Only 50 out of 349 are listed.

Advisors.lua

UI/InGame/WorldView/Advisors.lua
0061
[AdvisorTypes.ADVISOR_ECONOMIC] = Locale.Lookup("TXT_KEY_ADVISOR_ECON_TITLE"),


ChooseReligionPopup.lua (G&K)

DLC/Expansion/UI/InGame/Popups/ChooseReligionPopup.lua
0307
local t = Locale.Lookup("TXT_KEY_CHOOSE_RELIGION_ALREADY_FOUNDED", row.Description, takenReligions[row.ID]);
0361
Controls.FounderBeliefName:SetText(Locale.Lookup(belief.ShortDescription));
0370
Controls.BonusBeliefDescription:SetText(Locale.Lookup(belief.Description));
0565
local customName = Locale.Lookup(g_CurrentReligionName);
0641
t = Locale.Lookup("TXT_KEY_CHOOSE_RELIGION_CONFIRM", g_CurrentReligionName);


CityBannerManager.lua (G&K)

DLC/Expansion/UI/InGame/CityBannerManager.lua
0117
strSpyName = Locale.Lookup(v.Name);


CityStateDiploPopup.lua (G&K)

DLC/Expansion/UI/InGame/Popups/CityStateDiploPopup.lua
0493
local strProtectTT = Locale.Lookup("TXT_KEY_POP_CSTATE_PLEDGE_TT", 10, 10); --antonjs: todo: xml


CityStateStatusHelper.lua (G&K)

DLC/Expansion/UI/CityStateStatusHelper.lua
0395
return Locale.Lookup("TXT_KEY_CITY_STATE_QUEST_NONE");
0484
sToolTipText = sToolTipText .. Locale.Lookup( "TXT_KEY_CITY_STATE_QUEST_CONNECT_RESOURCE_FORMAL", GameInfo.Resources[iQuestData1].Description );
0492
sToolTipText = sToolTipText .. Locale.Lookup( "TXT_KEY_CITY_STATE_QUEST_FIND_PLAYER_FORMAL", Players[iQuestData1]:GetCivilizationShortDescriptionKey() );
0498
sToolTipText = sToolTipText .. Locale.Lookup( "TXT_KEY_CITY_STATE_QUEST_PLEDGE_TO_PROTECT_FORMAL", Players[iQuestData1]:GetCivilizationShortDescriptionKey() );
0511
sToolTipText = sToolTipText .. Locale.Lookup( "TXT_KEY_CITY_STATE_QUEST_CONTEST_FAITH_WINNING_FORMAL", iMajorScore );


CivilopediaScreen.lua (G&K)

DLC/Expansion/UI/Civilopedia/CivilopediaScreen.lua
2473
costString = Locale.Lookup("TXT_KEY_PEDIA_A_OR_B", tostring(cost) .. " [ICON_PRODUCTION]", tostring(faithCost) .. " [ICON_PEACE");
2949
table.insert(defenseEntries, Locale.Lookup("TXT_KEY_PEDIA_DEFENSE_HITPOINTS", iExtraHitPoints));


DiploCorner.lua

UI/InGame/WorldView/DiploCorner.lua
0039
{ text = Locale.Lookup("TXT_KEY_VP_TT"),                     call=function() Popup(ButtonPopupTypes.BUTTONPOPUP_VICTORY_INFO); end };
0040
{ text = Locale.Lookup("TXT_KEY_DEMOGRAPHICS"),                  call=function() Popup(ButtonPopupTypes.BUTTONPOPUP_DEMOGRAPHICS); end };


EspionageOverview.lua (G&K)

DLC/Expansion/UI/InGame/Popups/EspionageOverview.lua
0365
agent.AgentActivity = Locale.Lookup(agent.State);
0407
if (agent.AgentActivity == Locale.Lookup("TXT_KEY_SPY_STATE_UNASSIGNED")) then
0408
strActivityTT = Locale.Lookup("TXT_KEY_EO_SPY_UNASSIGNED_TT", agent.Rank, agent.Name);
0415
elseif (agent.AgentActivity == Locale.Lookup("TXT_KEY_SPY_STATE_RIGGING_ELECTION")) then
0416
strActivityTT = Locale.Lookup("TXT_KEY_EO_SPY_RIGGING_ELECTIONS_TT", agent.Rank, agent.Name, city:GetName());
0441
strActivityTT = strActivityTT .. Locale.Lookup("TXT_KEY_EO_SPY_COUNTER_INTEL_SUM_TT", iFinalChance);
0444
strActivityTT = Locale.Lookup("TXT_KEY_EO_SPY_BUTTON_DISABLED_SPY_DEAD_TT", agent.Rank, agent.Name);
0523
v.AgentActivity = Locale.Lookup(v.State);
0604
elseif (v.AgentActivity == Locale.Lookup("TXT_KEY_SPY_STATE_RIGGING_ELECTION")) then
0842
strTempResult = strTempResult .. Locale.Lookup("TXT_KEY_EO_POTENTIAL_WONDER_MOD_TITLE");
0883
strPolicyTT = strPolicyTT .. Locale.Lookup("TXT_KEY_EO_INCREASED_CHANCE_TO_CATCH_SPY_THEM", strLeaderName, policyInfo.Description, iEspionageMod);
1182
local strCityNameToolTip = Locale.Lookup("TXT_KEY_EO_CITY_NAME_TT", cityInfo.Name, cityInfo.CivilizationNameKey);
1197
strCityStateTT = strCityStateTT .. Locale.Lookup("TXT_KEY_EO_CITY_STATE_ELECTION", Game.GetTurnsBetweenMinorCivElections(), Game.GetTurnsUntilMinorCivElection());
1205
strPotentialToolTip = Locale.Lookup("TXT_KEY_EO_CITY_POTENTIAL_TT", agent.Rank, agent.Name, cityInfo.Potential, cityInfo.Name, cityInfo.Name, cityInfo.BasePotential);
1323
v.CivilizationName = Locale.Lookup(theirCivilization.ShortDescription);


GameplayUtils.lua (G&K)

DLC/Expansion/Scenarios/SteampunkScenario/GameplayUtils.lua
0059
Name = Locale.Lookup("TXT_KEY_STEAMPUNK_SCENARIO_VICTORY_CATEGORY_INDUSTRY"),
0068
Title = Locale.Lookup("TXT_KEY_STEAMPUNK_SCENARIO_VICTORY_CATEGORY_CULTURE_TITLE"),
0069
Help = Locale.Lookup("TXT_KEY_STEAMPUNK_SCENARIO_VICTORY_CATEGORY_CULTURE_HELP"),


InstalledPanel.lua

UI/FrontEnd/Modding/InstalledPanel.lua
0655
dlcTitle = Locale.Lookup("TXT_KEY_" .. packageID .. "_DESCRIPTION");
0745
LuaEvents.ModBrowserSetDeleteButtonState(true, true, Locale.Lookup("TXT_KEY_MODDING_DELETEMOD"));


LoadMenu.lua

UI/FrontEnd/LoadMenu.lua
0351
name = Locale.Lookup(name);


Lobby.lua

UI/FrontEnd/Multiplayer/Lobby.lua
0357
sortData.ServerHasDlc = Locale.Lookup("TXT_KEY_MULTIPLAYER_LOBBY_NO");
0403
local lines = {Locale.Lookup(headerString)};


OptionsMenu.lua (G&K)

DLC/Expansion/UI/Options/OptionsMenu.lua
1355
table.insert(TutorialLevels, Locale.Lookup("TXT_KEY_OPSCREEN_TUTORIAL_MEDIUM"));


ReligionOverview.lua (G&K)

DLC/Expansion/UI/InGame/Popups/ReligionOverview.lua
0116
text = Locale.Lookup("TXT_KEY_RO_STATUS_CAN_CREATE_PANTHEON");
0131
return Locale.Lookup("TXT_KEY_RO_BELIEF_TYPE_PANTHEON");
0428
local gpString = string.format("%s (%i [ICON_PEACE])", Locale.Lookup(GameInfo.Buildings[v2].Description), faithCost);


ReplayViewer.lua

UI/InGame/Popups/ReplayViewer.lua
0758
Tooltip = Locale.Lookup("TXT_KEY_REPLAY_VIEWER_MAP_TT"),


SaveMenu.lua

UI/InGame/Menus/SaveMenu.lua
0538
title = Locale.Lookup("TXT_KEY_RANDOM_LEADER_CIV", leaderDescription, civName );


TechButtonInclude.lua (G&K)

DLC/Expansion/UI/InGame/TechTree/TechButtonInclude.lua
0463
techPediaSearchStrings[tostring(thisButton)] =  Locale.Lookup(thisResourceInfo.Description);


VictoryStatus.lua (G&K)

DLC/Expansion/Scenarios/SteampunkScenario/VictoryStatus.lua
0117
local sCivDesc = Locale.Lookup(Players[iPlayer]:GetCivilizationShortDescriptionKey());
0153
s = s .. "[COLOR_WARNING_TEXT]" .. Locale.Lookup("TXT_KEY_STEAMPUNK_SCENARIO_VICTORY_CATEGORY_TECH_UNLOCK", GameInfo.Technologies[iUnlockTech].Description) .. "[ENDCOLOR]";
0169
s = s .. Locale.Lookup("TXT_KEY_STEAMPUNK_SCENARIO_VICTORY_CATEGORY_MILITARY_TT", GameInfo.UnitClasses[iLandshipClass].Description, GameInfo.UnitClasses[iAirshipClass].Description);



The initial version of this page was created by the Civ5 API Bot, see the Civ5 API Reference FAQ. Some of the texts come from the 2kgames' wiki and most of code samples are copyrighted to Firaxis.
Functions' signatures were either copied from the 2kgames' wiki, or infered from the Lua source files and the binaries. Errors are possible.
Contributors may find help in the Contributors guide to the Civ5 API.