DGS Multilingual: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
*3. DGS Multilingul system will specify the structure of '''Translation Table''' (Dictionary).
*3. DGS Multilingul system will specify the structure of '''Translation Table''' (Dictionary).


==<span style="color:#000000;text-shadow:0.05em 0.05em 0.2em #00000099;">Usage</span>==
==<span style="color:#000000;text-shadow:0.05em 0.05em 0.2em #00000099;">Usage 1</span>==
*0. Don't forget to '''import DGS Head''' or use '''export.dgs:'''.
*1. A '''Translation Table''' (Dictionary) should be specified:
*1. A '''Translation Table''' (Dictionary) should be specified:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Dict = {
Dict = {
TestText1="Welcome To %rep%",
TestText1="Welcome To %rep%",
}
}
</syntaxhighlight>
 
*2. And, send the dictionary into DGS:
<syntaxhighlight lang="lua">
dgsSetTranslationTable("testDict",Dict) --Name,Dictionary.
</syntaxhighlight>
 
*3. Now, DGS knows that dictionary, we need to tell DGS we want to use it:
<syntaxhighlight lang="lua">
dgsSetAttachTranslation("testDict") --This is global setting to one resource
</syntaxhighlight>
 
*3. Create a label:
<syntaxhighlight lang="lua">
label = dgsCreateLabel (0.51, 0.54, 0.16, 0.14, {"TestText","DGS"}, true )
</syntaxhighlight>
</syntaxhighlight>

Revision as of 06:00, 11 December 2020

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 %rep%",
}
  • 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","DGS"}, true )