Make your game easier to support multiple languages
How to install:
- put Language.cs inside your unity 3D project content.
- Put Dictionary_INA.json & Dictionary_ENG.json inside Resources folder inside your unity project content, if there is no Resources folder available, you need to create it manually.
- You can add your own custom language json file dictionary, just look at files Dictionary_INA.json & Dictionary_ENG.json for example.
- Please remember to name your json file with this format "Dictionary_LanguageCode.json" , and use "LanguageCode" as code to call your language dictionary json file.
How to use:
private void Awake()
{
CAP.Language.DefaultLanguage = "INA"; //Set your default language code
string checkDefaultLanguage = CAP.Language.DefaultLanguage; //To get current language code
string translatedWords = CAP.Language.Translate("C_LANG"); //put your key inside json file to get translated words
}
With this code you can easily support multiple language, without wasting time to create your own localization manager.
Clean, Simple & using Unity Default API, this script might never get old except unity restructured their resources folder
Credit my name if my code help your game.
Tips: Pair this script with Google's Noto font family for wide range support for multiple language and culture also you can add Unity's Text Mesh Pro for easy font callback support.