HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Warcraft Language Detection

05-16-2009, 04:39 PM#1
TriggerHappy
I don't know what languages are supported on warcraft so if anyone wants to help complete this.

Collapse JASS:
library Language

    globals
        constant integer LANGUAGE_UNDEFINED = 0
        constant integer LANGUAGE_ENGLISH = 1
        constant integer LANGUAGE_SPANISH = 2
        private integer array PLAYER_LANGUAGE
    endglobals
    
    function GetPlayerLanguage takes player p returns integer
        local unit u = CreateUnit(p, 'hfoo', 0, 0, 0)
        local string s = GetUnitName(u)
        local integer id = GetPlayerId(p)
        call RemoveUnit(u)
        set u = null
        if PLAYER_LANGUAGE[id] != LANGUAGE_UNDEFINED then
            return PLAYER_LANGUAGE[id]
        elseif s == "Footman" then
            set PLAYER_LANGUAGE[id] = LANGUAGE_ENGLISH
            return LANGUAGE_ENGLISH
        elseif s == "lacayo" then
            set PLAYER_LANGUAGE[id] = LANGUAGE_SPANISH
            return LANGUAGE_SPANISH   
        endif
        return LANGUAGE_UNDEFINED
    endfunction
    
endlibrary
05-16-2009, 06:11 PM#2
Opossum
Anitarf already started something like that before knowing that someone else already did that.

Can't wait to some day make a long chain out of this.

Btw: German footies are "Soldat"s.
05-16-2009, 06:13 PM#3
Feroc1ty
Quote:
Chinese -> "步兵"
Czech -> "Pěšák"
English -> "Footman"
French -> "Fantassin"
German -> "Soldat"
Italian -> "Fante"
Korean -> "풋맨"
Polish -> "Piechur"
Russian -> "Пехотинец"
Spanish -> "Soldado raso"

Taken from Troll Brains post on the helper.
05-16-2009, 06:28 PM#4
Troll-Brain
Using the length strings of localised strings is a better idea, however i guess we will never add all the answers to let us finish it.
http://www.wc3c.net/showthread.php?t=103915
05-17-2009, 03:09 PM#5
fX_
y not use an initializer on PLAYER_LANGUAGE if its in-game static and youre gonna store it.

if it's in-game static then you might as well store the result for future references, so there's PLAYER_LANGUAGE[]. but also, if it's in-game static then why don't you just initialize it instead of running the
Collapse JASS:
if ItIsAlreadyEvaluated then
endif
all the time w/c seems redundant in the context of this system with in-game static stuff.
05-17-2009, 03:20 PM#6
Troll-Brain
It's definitely static.
And also creating an unit is totally useless.
But anyway unless you force all users of each war3 language to do my test map, we won't be able to finish it.
So just forget it ...
05-17-2009, 03:47 PM#7
DioD
This return local data, its much more better idia to asq player for his location.

i hate russian in games, and system like this with "forced" setting will make me sad.
05-17-2009, 04:07 PM#8
Troll-Brain
Quote:
Originally Posted by DioD
This return local data, its much more better idia to asq player for his location.

i hate russian in games, and system like this with "forced" setting will make me sad.
The idea is just be able to detect the war3 language installed for each player, not to force anything, but i'm agree it's just for fun, not really useful.

If one day we will get all the needed answers, i would use it for nothing more than simply display the player war3 language installed somewhere in the map.
05-17-2009, 07:07 PM#9
Feroc1ty
Quote:
Originally Posted by Troll-Brain
The idea is just be able to detect the war3 language installed for each player, not to force anything, but i'm agree it's just for fun, not really useful.

If one day we will get all the needed answers, i would use it for nothing more than simply display the player war3 language installed somewhere in the map.

There could be uses as to displaying all game messages in their language, instead of only English.
05-17-2009, 07:14 PM#10
TriggerHappy
Quote:
Originally Posted by Feroc1ty
There could be uses as to displaying all game messages in their language, instead of only English.

They had multi-language support in risk devolution.
05-17-2009, 07:29 PM#11
Troll-Brain
But for that you can play with localised .wts (external strings).