Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
Trigger strings are stored in the war3map.wts file. You can add support for multiple localizations by importing a separate war3map.wts for each language. This can be done with Ladislav's MPQ Editor by right clicking your file and choosing "Set File Locale". With this method you can translate much of your map, including the map name and descriptions.
You can also use some JASS tricks to get the clients language:
JASS:
function GetLocalLanguage takes nothing returns string
local string s = GetLocalizedString("CHEATENABLED")
if (s == "Cheat enabled!") then
return "English"
else if (s == "Cheat aktiviert!") then
return "German"
endif
return s
endfunction
The above function checks a localized string to determine what language the client is using. The downside to this you cannot detect locale, only language.
If you want to detect client locale through JASS, you will have to do something like this:
JASS:
function GetLocale takes nothing returns string
local player p = GetLocalPlayer()
local string s = GetPlayerName(p)
local string locale = ""
call StartCampaignAI(Player(PLAYER_NEUTRAL_AGGRESSIVE), "locale\\detect.ai")
set locale = GetPlayerName(p)
call SetPlayerName(p, s)
if (locale == s) then
return "Unknown"
endif
return locale
endfunction
Along with that function, you will need to add "locale\\detect.ai" to the MPQ for each game locale you want to detect. I uploaded a map as an example which can detect enUS or koKR.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.