Skip to main content

README

WorldWide Localization Manager

WorldWide package is a Localization Manager.

Installing

  • Import this package using Unity's Package Manager UI.

How to use

  • Make sure to call WorldWide.Instance.Initialize() at the appropriate place.
    • You need to create Translation Sheets and make sure you created appropriate Data Config assets, named Raw Data Store.
    • From these Data Config assets, you need to build appropriate Language files under Streaming Assets.
    • There is only one autogenerated asset, which is LanguageConfig it is needed to start using your translations. See Configuration for detailed information.

Before using

  • Create Raw Data Stores, see "Translation Sheets and How to Create Them" and "Raw Data Stores and How to Create Them" sections

    • Recommendation: Separate your sheets into categories such as "UILocalization", "LevelLocalization", "FeatureXLocalization" etc..
  • Create Language Files, see "Editor Capability" => "Prepare"

Configuration

LanguageConfig is automatically created at initialization. If it is not created already, simply restart your project.

Language Config

​ Go to Assets\MatchinghamGames\Resources\LanguageConfig.asset.

VariableDescription
Log LevelThis is to limit the logs generated by this module.
LocalesAll available locales ready to use. This list is automatically filled once the module is activated. You can create your own custom locale and add here.
Active Locale SettingsThis contains the list of all locales and automatically filled. You have to select which languages you are planning to enable in your application.
Special FontsIf you want to use different font for different languages, you have to define it here. On Language Change, the Font Change event is also triggered accompanied with a designed font.
Md5 HashesMd5 Hash Info of Language files created under StreamingAssets. This is to keep track of the updates in files, so that it can be updated in Persistent Data Path.
Default FontThis is the default font. Make sure you support all languages in this font if you are not planning to use Special Fonts for different languages.
Default LanguageDefault language is automatically selected if the selected Language is not among Active Locale Settings.

Create Sample Language Sheet button can be used to create a sample Translation Sheet, a .tsv file which contains active languages in columns, ready to be filled with keys and appropriate translations. It is created under Assets\MatchinghamGames\Data\Localization\Sheets folder.

Translation Sheets and How to Create Them

Translation Sheets should be in a specific format, we advise you to use Create Sample Language Sheet in Language Config.

Sample Translation Sheet

Raw Data Stores and How to Create Them

To create Raw Data Store asset, use Create menu to go to Create->Matchingham->MG WorldWide-Localization->Raw DataStore in Project Window.

VariableDescription
DataThis contains the localization imported from the translation sheets.
Import PathsThe path of translation sheets comes here. Use comma to add more.

Example Import Paths entry: Assets\MatchinghamGames\Data\Localization\Sheets\SampleSheet1.tsv,Assets\MatchinghamGames\Data\Localization\Sheets\SampleSheet2.tsv

Use Import button to fill the data with the translations in given paths, and Delete to wipe them out.

Export Active Languages as Sheet and Export All Languages as Sheet buttons are to create a single translation sheet file from the data. The former ignores the languages not selected in Language Config. It is better to use single sheet for each different Raw Data Store.

Editor Capability

Matchingham / Localization / Config

To access LanguageConfig file use this menu.

Matchingham / Localization / Prepare

After Raw Data Stores are created, you should use this menu to create final language files. In the EditorWindow;

Fields

  • Raw Data Assets

    From this list, select the Raw Data Stores you would like to have in your final game.

  • Selected Font

    Select font before analysis to also get the information of what characters are missing in this particular font.

  • Character Items

    The list languages and character needs related to each category will be listed here after analysis.

Buttons

  • Analyse Language Files

    After selection, use this button to make an analysis on which characters are used in each locale.

  • Export Final Character List

    After using Analyse Language Files Button, use this button to export the final character list as a report. It creates the file under Assets/ directory.

  • Create Language Files

    After selection, use this button to create language files. We make use of StreamingAssets directory to load files dynamically.

Prepare Menu

API & Details

WorldWide

WorldWide Manager is a Singleton object that is not destroyed in load. In RunTime, it provides a useful dropdown menu where you can change the language.

Events

  • OnLanguageChange(string) : Subscribe to this to keep track of when the active language is changed. It returns the language code of the selected language. The language can be used in LanguageConfig to access the associated locale file.

Methods

  • ChangeLanguage(string languageCode) : Self Explanatory.

Fields

  • Config : LanguageConfig reference.

  • ActiveLocales : Selected Languages which can be found in LanguageConfig.

  • SpecialFont : The font specifically associated with the actively selected language. It is DefaultFont if there is no such definition.

  • IsReady : If the module properly started.

    See Configuration for more information.

Localized View

LocalizedView is a monobehaviour class the can be used attached to your game objects. It can be inherited for your customized settings.

Notes

  • It is important to use proper font assets and atlas files to optimize build size. Consider eliminating duplicate characters across several font assets.