Mytz_321 Posted April 30, 2019 Posted April 30, 2019 function awal() local t = { ['en_US'] = 'en','Welcome', ['in'] = 'id','Selamat datang' } local z = gg.getLocale() local zz = t[z] gg.alert(zz[2]) help me pls
maulz Posted April 30, 2019 Posted April 30, 2019 3 hours ago, Mytz_321 said: function awal() local t = { ['en_US'] = 'en','Welcome', ['in'] = 'id','Selamat datang' } local z = gg.getLocale() local zz = t[z] gg.alert(zz[2]) help me pls You can add another words if you want local currentLang = gg.getLocale() local eng = {"Welcome!", "Another words"} local ind = {"Selamat Datang!", "Kata-kata lain"} if currentLang == "en_US" then lang = eng elseif currentLang == "in" then lang = ind end gg.alert(lang[1]) print(lang[2]) Btw, you can set default lang if user use another lang with adding "else" like this if currentLang == "en_US" then lang = eng elseif currentLang == "in" then lang = ind else lang = eng end Sorry for my bad English
Administrators Enyby Posted April 30, 2019 Administrators Posted April 30, 2019 @Mytz_321 need table brackets around string options, like this: ['en_US'] = {'en','Welcome'},
Mytz_321 Posted April 30, 2019 Author Posted April 30, 2019 thx you but i aleardy find it before you comment @Enyby @maulz
Question
Mytz_321
function awal()
local t = {
['en_US'] = 'en','Welcome',
['in'] = 'id','Selamat datang'
}
local z = gg.getLocale()
local zz = t[z]
gg.alert(zz[2])
help me pls
3 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.