# Multilingual editor support

Behavior attributes and editor extensions can support multiple languages.

# Preparing language files

In order to support multiple languages, it is necessary to add each language file.

Also, register the folder where the language file is placed.

Since language files can only be used in the editor, place them in the Editor folder.

## LanguagePath

Placing a language file To register a folder, place the LanguagePath asset in a folder.

- Select the folder to place in the Project window and click “Create” button.
- Select “Arbor / Editor / LanguagePath”.
- As there are no particular restrictions on the name, please give me the name you like.

## Create language file

If you create a file of “Language name.txt” in the folder where the LanguagePath asset is placed, it will be recognized as a language file.

“Language name” must have the same name as the value of the SystemLanguage enumerator.

Unity ScriptReference : SystemLanguage

## Writing a language file

In the language file, write it in the format of “word key: display character string” line by line.

Also, if the line head is “//” it is regarded as a comment and that line is ignored.

For example, create English.txt and fill in as follows.

    1
    2
    3
    4
    // Boss behavior related
    Menu_ExampleBossAttack: Localization/Boss's attack
    ExampleBossAttack: Boss's attack
    ExampleBossDefense: Boss's defense

## Example of folder structure

- Assets
  - Editor
    - Languages
      - LanguagePath.asset
      - English.txt
      - Japanese.txt

# Language word reference

## Reference from editor extension

To reference from an editor extension, use ArborEditor.Localization.GetWord() or GetTextContent().

### Example script

    1
    2
    EditorGUILayout.LabelField(Localization.GetWord("ExampleBossAttack"));
    EditorGUILayout.LabelField(Localization.GetWord("ExampleBossDefense"));

### Display example

## References in behavior attributes

If you set the localization field to true on AddBehaviourMenu or Behavior Title, it will be referenced from the language file.

### Example script

    1
    2
    3
    4
    5
    6
    7
    8
    9
    using UnityEngine;
    using Arbor;

    [AddComponentMenu("")]
    [AddBehaviourMenu("Menu_ExampleBossAttack",localization=true)]
    [BehaviourTitle("ExampleBossAttack",localization =true)]
    public class ExampleBossAttackBehaviour : StateBehaviour
    {
    }

### Display example

English

Japanese