Mod Localisation – Arma Reforger

From Bohemia Interactive Community
Jump to navigation Jump to search
(Added link to String Editor documentation, expanded description of runtime table and rearranged fragment about manual localization.)
m (Fix Debug Menu → Diag Menu + link)
Line 1: Line 1:
{{TOC|side}}
{{TOC|side}}
[[Image:armareforger-localization-logo.png|400px|center]]


[[Image:armareforger-localization-logo.png|400px|center]]
{{Clear}}
== Introduction ==
This page describes process of adding localization to addons. It's recommended to go through [[Arma_Reforger:String_Editor|String Editor documentation]] first since most of the procedures are shared.
This page describes process of adding localization to addons. It's recommended to go through [[Arma_Reforger:String_Editor|String Editor documentation]] first since most of the procedures are shared.


== Creating new localization table ==
== Creating new localization table ==
Creating of new string table (.st) file is described on String Editor - New *.st file page and below is quick rehearsal of those instructions
Creating of new string table (.st) file is described on String Editor - New *.st file page and below is quick rehearsal of those instructions


=== Creating new string stable ===
=== Creating new string stable ===
{| class="wikitable"
{| class="wikitable"
|+
| [[Image:armareforger-localization-create-stringtable.png]]
|[[Image:armareforger-localization-create-stringtable.png]]
| 1. In '''Resource Browser''' select a folder where you want to create a new '''*.st''' file - In this example it is '''SampleMod_NewCar/Language folder.'''
|1. In '''Resource Browser''' select a folder where you want to create a new '''*.st''' file - In this example it is '''SampleMod_NewCar/Language folder.'''
Next, either click with ''Right Mouse Button'' on '''Resource Manager''' field '''(1a)''' or use '''Create''' button '''(1b)'''
Next, either click with ''Right Mouse Button'' on '''Resource Manager''' field '''(1a)''' or use '''Create''' button '''(1b)'''


In both cases, new context menu should appear - pick "'''GUI string table'''" '''(2)''' from that list.
In both cases, new context menu should appear - pick "'''GUI string table'''" '''(2)''' from that list.
|-
|-
|[[Image:armareforger-localization-set-filename.png]]
| [[Image:armareforger-localization-set-filename.png]]
|2. Set the name of the file
| 2. Set the name of the file
|-
|-
|[[Image:armareforger-localization-set-class.png]]  
| [[Image:armareforger-localization-set-class.png]]
|3. Choose '''StringTable''' class and confirm by clicking once on it '''StringTable''' entry with ''Left Mouse Button''
| 3. Choose '''StringTable''' class and confirm by clicking once on it '''StringTable''' entry with ''Left Mouse Button''
|}
|}


=== Setting basic parameters ===
=== Setting basic parameters ===
If those steps above were performed successfully, a new '''localization_MyAddon.st''' should be now visible in '''Resource Manager''' asset browser.
If those steps above were performed successfully, a new '''localization_MyAddon.st''' should be now visible in '''Resource Manager''' asset browser.


[[Image:armareforger-localization-open-stringtable.png]]
[[Image:armareforger-localization-open-stringtable.png]]


Click on newly created localization.st file with ''Right Mouse Button'' and select '''Open File in New Tab (1)''' option from context menu. This should open that string table in new tab, where some of the internal bits of string table class can be changed.
Click on newly created localization.st file with ''Right Mouse Button'' and select '''Open File in New Tab (1)''' option from context menu. This should open that string table in new tab, where some of the internal bits of string table class can be changed.


By default, newly created string tables are using platform agnostic settings and both '''Target Prefix''' & '''Item Class Name''' parameter have to be changed in order to be used in '''String Editor'''. Following values must be used
By default, newly created string tables are using platform agnostic settings and both '''Target Prefix''' & '''Item Class Name''' parameter have to be changed in order to be used in '''String Editor'''. Following values must be used
Line 37: Line 38:
* ''Item Class Name'': '''CustomStringTableItem'''
* ''Item Class Name'': '''CustomStringTableItem'''


After that, '''localization'''.'''st''' file should be ready to be used by '''String Editor'''. Simple test can be performed by either double clicking with ''Left Mouse Button'' on localization.st resource in '''Resource Browser''' (this will open that file in String Editor) or by manually opening '''String Editor''' (''Editors → String Editor) '' and then using File → Open option.
After that, '''localization'''.'''st''' file should be ready to be used by '''String Editor'''. Simple test can be performed by either double clicking with ''Left Mouse Button'' on localization.st resource in '''Resource Browser''' (this will open that file in String Editor) or by manually opening '''String Editor''' (''Editors → String Editor) '' and then using File → Open option.


[[Image:armareforger-localization-stringtable-empty.png]]
[[Image:armareforger-localization-stringtable-empty.png]]
Line 55: Line 56:


=== Localization targets table ===
=== Localization targets table ===
=== MISSING TABLE TITLE ===
{| class="wikitable"
{| class="wikitable"
|}
| '''en_us'''
{| class="wikitable"
| English (United States)
|'''en_us'''
|English (United States)


Serves as a source for translated texts.
Serves as a source for translated texts.
Line 65: Line 67:
If proofreading or translation is in progress, use 'Target_en_us_edited' instead.
If proofreading or translation is in progress, use 'Target_en_us_edited' instead.
|-
|-
|'''en_us_edited'''
| '''en_us_edited'''
|English (United States)
| English (United States)


Use this when the string is being processed by proofreaders or translators.
Use this when the string is being processed by proofreaders or translators.


Once it's done, the Localization Manager will move this text to 'Target_en_us'
Once it is done, the Localization Manager will move this text to 'Target_en_us'
|-
|-
|'''fr_fr'''
| '''fr_fr'''
|French (France)
| French (France)
|-
|-
|'''it_it'''
| '''it_it'''
|Italian (Italy)
| Italian (Italy)
|-
|-
|'''de_de'''
| '''de_de'''
|German (Germany)
| German (Germany)
|-
|-
|'''es_es'''
| '''es_es'''
|Spanish (Spain)
| Spanish (Spain)
|-
|-
|'''cs_cz'''
| '''cs_cz'''
|Czech (Czech Republic)
| Czech (Czech Republic)
|-
|-
|'''pl_pl'''
| '''pl_pl'''
|Polish (Poland)
| Polish (Poland)
|-
|-
|'''ru_ru'''
| '''ru_ru'''
|Russian (Russia)
| Russian (Russia)
|-
|-
| colspan="1" |'''ja_jp'''
| '''ja_jp'''
| colspan="1" |Japanese (Japan)
| Japanese (Japan)
|-
|-
| colspan="1" |'''ko_kr'''
| '''ko_kr'''
| colspan="1" |Korean (South Korea)
| Korean (South Korea)
|-
|-
| colspan="1" |'''pt_br'''
| '''pt_br'''
| colspan="1" |Portuguese (Brazil)
| Portuguese (Brazil)
|-
|-
| colspan="1" |'''zh_cn'''
| '''zh_cn'''
| colspan="1" |Chinese (China)
| Chinese (China)
|}
|}
{{Clear}}
{{Clear}}
== Registering localization table ==


== Registering localization table ==
Next step is registering of localization table in game project file. To do so, navigate to '''Workbench → Options'''
Next step is registering of localization table in game project file. To do so, navigate to '''Workbench → Options'''


Line 114: Line 118:
[[Image:armareforger-localization-workbench-options-add.png|right]]
[[Image:armareforger-localization-workbench-options-add.png|right]]


# Make sure that you are editing correct game project by checking which addon is shown in '''drop down menu (1).''' In this case it's '''SampleMod_NewCar'''
# Make sure that you are editing correct game project by checking which addon is shown in '''drop down menu (1)'''. In this case it's '''SampleMod_NewCar'''
# Navigate to '''Widget Manager Settings (2)'''
# Navigate to '''Widget Manager Settings (2)'''
# Locate '''String Tables (3)''' entry and expand it by pressing on little blue arrow on the left side
# Locate '''String Tables (3)''' entry and expand it by pressing on little blue arrow on the left side
# Add new element to '''String Tables''' array by clicking on small plus sign '''(4).''' This will be a new entry holding information about string table file created previously
# Add new element to '''String Tables''' array by clicking on small plus sign '''(4)'''. This will be a new entry holding information about string table file created previously
# Locate previously created '''string table (.st) file''' by clicking on three small dots '''(5)''' and then selecting that file
# Locate previously created '''string table (.st) file''' by clicking on three small dots '''(5)''' and then selecting that file
# Add new element to '''Languages''' array by clicking on dot on the right side '''(6)'''
# Add new element to '''Languages''' array by clicking on dot on the right side '''(6)'''
Line 128: Line 132:


Restart of the workbench might be necessary to initialize new string tables properly.
Restart of the workbench might be necessary to initialize new string tables properly.


== Localizing assets ==
== Localizing assets ==
In this chapter, name of Sample New Car visible in in-game Editor will be localized.
In this chapter, name of Sample New Car visible in in-game Editor will be localized.


=== Localizing asset via plugin ===
=== Localizing asset via plugin ===
[[Image:armareforger-localization-plugin.png|right]]
[[Image:armareforger-localization-plugin.png|right]]
Alternative method involves using '''Resource Manager''' plugin called "'''Localize Selected Assets'''".
Alternative method involves using '''Resource Manager''' plugin called "'''Localize Selected Assets'''".
Line 158: Line 165:


=== Localizing asset manually ===
=== Localizing asset manually ===
It is also possible to manually change '''Name''' property in '''Editable Component''' and then add that string to string table. To do so, it is necessary to replace '''Name''' property in '''Editable Component''' with variant containing # prefix - i.e. ''#SampleMod-EditableEntity_SampleCar_01_Base_Name''. Next, it possible to add that string to '''String Tabl'''e by following instructions on [[Arma_Reforger:String_Editor#Add_a_New_Localised_String|String Editor page]].
 
It is also possible to manually change '''Name''' property in '''Editable Component''' and then add that string to string table. To do so, it is necessary to replace '''Name''' property in '''Editable Component''' with variant containing # prefix - i.e. ''#SampleMod-EditableEntity_SampleCar_01_Base_Name''. Next, it possible to add that string to '''String Tabl'''e by following instructions on [[Arma_Reforger:String_Editor#Add_a_New_Localised_String|String Editor page]].


=== Regenerating runtime tables ===
=== Regenerating runtime tables ===
If all strings were properly added to string table then it's time to '''generate runtime tables'''. Without '''runtime tables''', game will be not able to see strings located in string table file. Only after string table is parsed to optimized, game ready format, strings will be ready to use. To do so, head to String Editor and select from top bar '''Table → Build Runtime Table''' (''also accessible under Ctrl+B shortcut''). That's it - process should take just few seconds and runtime string table should be ready to go.  
 
If all strings were properly added to string table then it's time to '''generate runtime tables'''. Without '''runtime tables''', game will be not able to see strings located in string table file. Only after string table is parsed to optimized, game ready format, strings will be ready to use. To do so, head to String Editor and select from top bar '''Table → Build Runtime Table''' (''also accessible under Ctrl+B shortcut''). That's it - process should take just few seconds and runtime string table should be ready to go.


{{Feature|important|Don't forget to regenerate runtime tables every time you are done with tweaking string table file!}}
{{Feature|important|Don't forget to regenerate runtime tables every time you are done with tweaking string table file!}}


== Localizing scripts ==
== Localizing scripts ==
By default, any engine will try to localize any string (''LocalizedString'' ) in '''UI''' if it is starting with '''hash (#) sign'''. There is no equivalent of Arma 3 Localize script command.
By default, any engine will try to localize any string (''LocalizedString'' ) in '''UI''' if it is starting with '''hash (#) sign'''. There is no equivalent of Arma 3 Localize script command.


Line 174: Line 184:


== Testing result in-game ==
== Testing result in-game ==
String can be verified in game by launching i.e. in game editor and checking if strings are showing proper data instead of hashtag prefixed strings.
String can be verified in game by launching i.e. in game editor and checking if strings are showing proper data instead of hashtag prefixed strings.


It is also possible to verify if strings are localized by selecting from '''Debug Menu UI Disable Disable Loc''' option. This debug will disable automatic localization of strings and will show names in their original, with hash tag prefix, form.
It is also possible to verify if strings are localized by selecting from '''[[Arma Reforger:Debug Menu|Debug Menu]] → UI → Disable → Disable Loc''' option. This debug will disable automatic localization of strings and will show names in their original, with hash tag prefix, form.


''Debug menu is accessible by pressing either '''Left Ctrl + Windows''' key or '''Left Alt & Windows''' key. Options in that menu are changed via left & right arrow key''
{{Feature|informative|See [[Arma Reforger:Debug Menu|Debug Menu]] for more information.}}


[[Image:armareforger-localization-results.jpg]]
[[Image:armareforger-localization-results.jpg]]


{{GameCategory|armaR|Modding|Tutorials}}
{{GameCategory|armaR|Modding|Tutorials}}

Revision as of 10:19, 27 June 2022

armareforger-localization-logo.png

This page describes process of adding localization to addons. It's recommended to go through String Editor documentation first since most of the procedures are shared.


Creating new localization table

Creating of new string table (.st) file is described on String Editor - New *.st file page and below is quick rehearsal of those instructions

Creating new string stable

armareforger-localization-create-stringtable.png 1. In Resource Browser select a folder where you want to create a new *.st file - In this example it is SampleMod_NewCar/Language folder.

Next, either click with Right Mouse Button on Resource Manager field (1a) or use Create button (1b)

In both cases, new context menu should appear - pick "GUI string table" (2) from that list.

armareforger-localization-set-filename.png 2. Set the name of the file
armareforger-localization-set-class.png 3. Choose StringTable class and confirm by clicking once on it StringTable entry with Left Mouse Button

Setting basic parameters

If those steps above were performed successfully, a new localization_MyAddon.st should be now visible in Resource Manager asset browser.

armareforger-localization-open-stringtable.png

Click on newly created localization.st file with Right Mouse Button and select Open File in New Tab (1) option from context menu. This should open that string table in new tab, where some of the internal bits of string table class can be changed.

By default, newly created string tables are using platform agnostic settings and both Target Prefix & Item Class Name parameter have to be changed in order to be used in String Editor. Following values must be used

  • Target Prefix: Target_
  • Item Class Name: CustomStringTableItem

After that, localization.st file should be ready to be used by String Editor. Simple test can be performed by either double clicking with Left Mouse Button on localization.st resource in Resource Browser (this will open that file in String Editor) or by manually opening String Editor (Editors → String Editor) and then using File → Open option.

armareforger-localization-stringtable-empty.png

Adding runtime string tables

armareforger-localization-create-config.png

Runtime string tables are files which are used by the game itself and they are created in very similar way to regular string tables.

Main difference is fact that instead of selecting GUI string table context menu, you should pick Config file (2) option instead of GUI string table.

In next dialog, fill name of that new run time string table (i.e. samplenewcar_localization.en_us.conf). Once that step is completed, a new window will appear, asking you to choose a class of new config - this time StringTableRuntime should be used.

Depending on how many languages are supposed to be translated, repeat above steps till all translation variants are created.

Below is small table showing various localization targets shortcuts

Localization targets table

MISSING TABLE TITLE

en_us English (United States)

Serves as a source for translated texts.

If proofreading or translation is in progress, use 'Target_en_us_edited' instead.

en_us_edited English (United States)

Use this when the string is being processed by proofreaders or translators.

Once it is done, the Localization Manager will move this text to 'Target_en_us'

fr_fr French (France)
it_it Italian (Italy)
de_de German (Germany)
es_es Spanish (Spain)
cs_cz Czech (Czech Republic)
pl_pl Polish (Poland)
ru_ru Russian (Russia)
ja_jp Japanese (Japan)
ko_kr Korean (South Korea)
pt_br Portuguese (Brazil)
zh_cn Chinese (China)


Registering localization table

Next step is registering of localization table in game project file. To do so, navigate to Workbench → Options

armareforger-localization-workbench-settings.png

armareforger-localization-workbench-options-add.png
  1. Make sure that you are editing correct game project by checking which addon is shown in drop down menu (1). In this case it's SampleMod_NewCar
  2. Navigate to Widget Manager Settings (2)
  3. Locate String Tables (3) entry and expand it by pressing on little blue arrow on the left side
  4. Add new element to String Tables array by clicking on small plus sign (4). This will be a new entry holding information about string table file created previously
  5. Locate previously created string table (.st) file by clicking on three small dots (5) and then selecting that file
  6. Add new element to Languages array by clicking on dot on the right side (6)
  7. Type code of new language (see table above for available codes) to field marked with number 7 on the picture
  8. Select runtime stringtable file (8) appropriate to the language code which was created in previous step. In this case code is en_us, so String Table Runtime is samplenewcar_localization.en_us.conf

If all steps were performed correctly, new string table should be now ready to be used!


Restart of the workbench might be necessary to initialize new string tables properly.


Localizing assets

In this chapter, name of Sample New Car visible in in-game Editor will be localized.

Localizing asset via plugin

armareforger-localization-plugin.png

Alternative method involves using Resource Manager plugin called "Localize Selected Assets".

This plugin automates most of the process by searching for strings defined by a config file. Localization parser configs (selected through Config Path parameter in Localize Selected plugin) contain various look up rules, default string table where to store changes & prefix settings. While having string table & prefix defined in config might be quite useful when working on projects involving multiple people, it is also possible to override String Table Path & Prefix parameters, so it is also possible to utilize existing Arma Reforger configs in smaller addons.

armareforger-localization-asset-string.png

Vehicles in-game Editor display name is defined in SCR_EditableVehicleComponent - there, in Visualization section, a Name parameter can be found. In this case, Name parameter was set to Sample New Car (Black) and goal is to have that string present in runtime string table.

To do so, select in Resource Browser assets to localize and then navigate to Plugins → Localize Selected Files in top navigation bar or use Ctrl+Alt+L shortcut.

Localize Selected File plugin window should now appear. Following changes to default parameter values need to be performed:

  • Changing Config Path param to Editor.conf - this config will ensure that all editor related strings (like this vehicle display name) will be properly localize
  • Changing String Table Override - by default plugin is storing all changes to the string table defined in config file itself. Since duplicating this config file might be an overkill for localizing 2 assets, it is possible to change string table which is used by selecting another string table in plugin itself. In this case localization.st in SampleMod_NewCar is selected
  • Changing Prefix Override - similar to string table, string prefix is stored in config file. In this case, prefix is changed to SampleMod- to ensure that those new string tables will not clash with vanilla data.

Once parameters are adjusted, it is possible to localize those files - to do so, press Localize button.

After that, plugin will open String Editor (if it's not open already), open string table defined in String Table Override property, perform scan for any editor related entries & then finally store it in string table.

armareforger-localization-using-plugin.gif

Localizing asset manually

It is also possible to manually change Name property in Editable Component and then add that string to string table. To do so, it is necessary to replace Name property in Editable Component with variant containing # prefix - i.e. #SampleMod-EditableEntity_SampleCar_01_Base_Name. Next, it possible to add that string to String Table by following instructions on String Editor page.

Regenerating runtime tables

If all strings were properly added to string table then it's time to generate runtime tables. Without runtime tables, game will be not able to see strings located in string table file. Only after string table is parsed to optimized, game ready format, strings will be ready to use. To do so, head to String Editor and select from top bar Table → Build Runtime Table (also accessible under Ctrl+B shortcut). That's it - process should take just few seconds and runtime string table should be ready to go.

Don't forget to regenerate runtime tables every time you are done with tweaking string table file!

Localizing scripts

By default, any engine will try to localize any string (LocalizedString ) in UI if it is starting with hash (#) sign. There is no equivalent of Arma 3 Localize script command.

Please utilize LocaleEditBox when exposing variables in script
[Attribute(uiwidget: UIWidgets.LocaleEditBox, defvalue: "#AR-Editor_Hint_Intro_Title")]
protected LocalizedString m_sIntroHintTitle;

Testing result in-game

String can be verified in game by launching i.e. in game editor and checking if strings are showing proper data instead of hashtag prefixed strings.

It is also possible to verify if strings are localized by selecting from Debug Menu → UI → Disable → Disable Loc option. This debug will disable automatic localization of strings and will show names in their original, with hash tag prefix, form.

See Debug Menu for more information.

armareforger-localization-results.jpg