The LocalizationManager class can be used if your game is going to support localization (multiple languages). The LocalizationManager stores a Dictionary of string IDs and their corresponding values for different languages.
Typically the LocalizationManager uses localization CSVs which are set up in the FlatRedBall Editor. For information on how to create a localization CSV, see the IsDatabaseForLocalizing page. Assuming you have set up your localization properly, the following code shows how to access localized files in code:
The Translate method returns a string based on the current language. This language can be set by assigning the CurrentLanguage
property. This is a 0-based integer representing the current column in the localization database. Typically the value of 0 represents the string ID column, so the first language is usually index 1. For example, the following code sets the language to the first index:
Assigning the language by setting CurrentLanguage is useful so you do not need to pass the language in every Translate call. If you would like to translate to a specific language regardless of the value of CurrentLanguage
you can use the TranslateForLanguage
method: