DGS Multilingual

From Multi Theft Auto: Wiki
Revision as of 06:08, 11 December 2020 by Thisdp (talk | contribs) (→‎Usage 2)
Jump to navigation Jump to search

Description

  • 1. DGS has a built-in multilingul (multi-languae) system.
  • 2. Multilingul allows dynamic language changing and prevents non-essential GUI recreating or text reset by code.
  • 3. DGS Multilingul system will specify the structure of Translation Table (Dictionary).

Usage 1

  • 0. Don't forget to import DGS Head or use export.dgs:.
  • 1. A Translation Table (Dictionary) should be specified:
Dict = {
	TestText1="Welcome To DGS",
}
  • 2. And, send the dictionary into DGS:
dgsSetTranslationTable("testDict",Dict) --Name,Dictionary.
  • 3. Now, DGS knows that dictionary, we need to tell DGS we want to use it:
dgsSetAttachTranslation("testDict") --This is global setting to one resource
  • 3. Create a label:
label = dgsCreateLabel (0.51, 0.54, 0.16, 0.14, {"TestText"}, true )

Usage 2

  • 0. Don't forget to import DGS Head or use export.dgs:.
  • 1. A Translation Table (Dictionary) should be specified:
Dict = {
	TestText1="Welcome To DGS",
}
  • 2. And, send the dictionary into DGS:
dgsSetTranslationTable("testDict",Dict) --Name,Dictionary.
  • 3. Now, DGS knows that dictionary, we can create a label and attach its text to the dictionary:
label = dgsCreateLabel (0.51, 0.54, 0.16, 0.14, {"TestText"}, true )
dgsAttachToTranslation(label,"testDict") --Only attach one element to the dictionary.

Or you can also do:

label = dgsCreateLabel (0.51, 0.54, 0.16, 0.14, "", true )
dgsAttachToTranslation(label,"testDict") --Only attach one element to the dictionary.
dgsSetText(label,{"TestText"})