Giter Club home page Giter Club logo

localization's Introduction

Localization

A simple way to translate strings in a project

A more detailed description can be found on my blog: https://www.anton.website/a-simple-localization-system/ and https://www.anton.website/upgrading-the-localization-system/. These posts are describing earlier versions of this system.

Initial setup

  1. Open Localization window from the Localization -> Show Localization menu.
  2. Click to Load localization file button a) If exists, Localization.csv file will be loaded from StreamingAssets folder b) If not a default localization data will be loaded

Read Localzation File

3. Add new strings with + button on the left side of a string.

Read Localzation File

4. Reset a string with R button on the left side if a string.

Read Localzation File

5. Click E to edit a string.

Read Localzation File

a) Edit ids and translations for each language (ids have to be unique)

Read Localzation File

b) Save or delete a string with corresponding buttons

Read Localzation File

6. Add a new language with "+ New Language" button in the right bottom corner

Read Localzation File

7. Click "X" button on the right side of a language to remove the language

Read Localzation File

8. Click "Save file" button in the left bottom corner to save the csv file (if a Localization.csv file already exits, it will be renamed to Localization_backup.csv)

Read Localzation File

9. Click "Generate Translation.cs" button in the bottom center to generate Translation enum (default one is in Scripts/Localization)

Read Localzation File

10. Click "Close" button in the top right corner to unload the localization data

Read Localzation File

UI Localization

  1. Add StringLocalizer.cs script to a game object with TMPro.TextMeshProUGI component attached
  2. Set the relevant string id

Read Localzation File

  1. Add DropdownLocalizer.cs script to a game object with TMPro.TMP_Dropdown component attached
  2. Set the "Label" field with the label of the dropdown object
  3. Set the relevant ids for each option

Read Localzation File

Localization from a script

  1. Use Localizer.Get(Translation id) method to get a translation for the current language
  2. Use Localizer.Get(string language, Translation id) method to get a translation for a specific language
  3. Use Localizer.CurrentLanguage to get or set the current language a) Localizer.languageChanged action is fired whenever current language is changed
  4. Use Localizer.Languages to get a list of all languages

Escape charcter

You are free to use semicolon (;) in the custom editor UI. The asset can handle it. However, if you want to edit the Localization.csv with an external editor add backslash () before the semicolon. If you need to have the backslash at the end of a string, add another one before it.

escapeCharacterExample_1;To add semicolon write it like this \; <-. It will work;Noktalı virgü bu şekilde eklenebilir \; <-.

escapeCharacterExample_2;To add the escape character to the end of a string do this: \\;İşaretini satırın sonunda şu şekilde kullanabilirsiniz: \\

localization's People

Contributors

antonsem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

belzecue hengle

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.