Jump to content

[Question] MultiLanguage


Recommended Posts

Hi people

I've been looking for a way to make a Multilingual Resource that you could assign certain dialogs to for example a number.

Let's say this a dialog in an external resource:

        triggerClientEvent(source, "makeMessage", root, "Your username/password was incorrect.", "Login Error")

Now i want to assign a ID to this dialog "Your username/password was incorrect." that could be used to call it from Lang Resource.

This is all i could figure out , i would really appreciate a solution.

with regards

Link to comment

You can replace string with function, that will return string. Then with use of exports, conditions and tables you can make very reliable multi-language system. Or you can use only tables and identify language by key.

Example of second method (using only tables):

-- you have to define table with all strings in all supported languages
language_strings = {
	['EN'] = {
		"Your username/password was incorrect.",
		"Login Error",
	},
	['CZ'] = {
		"Tvé jméno/heslo je neplatné.",
		"Chyba při přihlášení",
	}
}

-- then you can do this in your function, after you get "lang" variable for example from getElementData
triggerClientEvent(source, "makeMessage", root, language_strings[lang][1], language_strings[lang][2]) 

 

Edited by Rataj
Added example
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...