Jump to content

Multi Language


ezzzyxs

Recommended Posts

  • Moderators

You need to store translations in a table, like this.

 

-- shared script (You can use this table both on client and server side)

languages = {
	["exampleTranslateID"] = {
		["en"] = "The text.", -- English translate
		["de"] = "Der Text.", -- German translate
		["hu"] = "A szöveg.", -- Hungarian translate
	},
}

function getTranslate(translateID, languageID)
	if languages[translateID] and languages[translateID][languageID] then
    	return languages[translateID][languageID]
    end
	return "#ERROR"
end

outputChatBox(getTranslate("exampleTranslateID", "en"))

 

Link to comment
  • Scripting Moderators

dgs has built-in multi language support :D

This makes it easier for developer to script multilanguage gui with dgs

Edited by thisdp
Link to comment
9 hours ago, thisdp said:

dgs has built-in multi language support :D

This makes it easier for developer to script multilanguage gui with dgs

What the dgs?

 

On 31/12/2018 at 19:06, Patrick2562 said:

You need to store translations in a table, like this.

 


-- shared script (You can use this table both on client and server side)

languages = {
	["exampleTranslateID"] = {
		["en"] = "The text.", -- English translate
		["de"] = "Der Text.", -- German translate
		["hu"] = "A szöveg.", -- Hungarian translate
	},
}

function getTranslate(translateID, languageID)
	if languages[translateID] and languages[translateID][languageID] then
    	return languages[translateID][languageID]
    end
	return "#ERROR"
end

outputChatBox(getTranslate("exampleTranslateID", "en"))

 

 

And how can I make a choice of language in freeroam using the example code?

Edited by ezzzyxs
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...