Jump to content

Language menu


JanKy

Recommended Posts

Hi guys.
I just opened a MTA DayZ Server ( In my language ) and i want to make a setting for english. ( i mean i have translated the inventory and everything ) 
Any ideas how to implement this script to translate everything?
I think about adding a function in every script, for example, in the dayz inventory : if someone choosed english language, the inventory is shown in english, and so on for every script.

Any ideas? Thanks in advance ^^

Link to comment

I guess everytime when you have to use outputChatBox there should be an "if" to check player's chosen language.

if language = "English" then
	outputChatBox("Something in English")
elseif language == "Russian" then
	outputChatBox("Rush B")
end

You might also use some tables like this:

Language = {}
Language.quit = {
"You left",	-- English has value 1
"Wyszedłeś", -- Second language with value 2
"Any other language"} -- etc.


function leaving ()
	outputChatBox(Language.quit[getElementData(localPlayer, "Language")])
end

But you have to keep the texts in correct order

Link to comment

You wont need a language menu, you can use the getLocalization function to get the players selected language.
Of course you can also have a language menu but considering you just need a window with a combo box and a text telling the player to select his language...

Also, I recommend extending the table with a language key so you can't confuse the order e.g.:

language = {}
language.en_US.quit = "Quit"

language.de_DE.quit = "Verlassen"

To get the correct language you probably want to write a wrapper function that handles falling back to English if the players selected language isn't available as well as any string:format stuff.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...