Class LocalizationSettings
The localization settings is the core component to the localization system.
It provides the entry point to all player based localization features.
Inheritance
LocalizationSettings
Syntax
public class LocalizationSettings : ScriptableObject
Properties
AssetDatabase
The asset database is responsible for providing localized assets.
Declaration
public static LocalizedAssetDatabase AssetDatabase { get; set; }
Property Value
AvailableLocales
Declaration
public static ILocalesProvider AvailableLocales { get; set; }
Property Value
HasSettings
Indicates if there is a LocalizationSettings present. If one is not found then it will attempt to find one however
unlike Instance it will not create a default, if one can not be found.
Declaration
public static bool HasSettings { get; }
Property Value
Type |
Description |
Boolean |
true if has settings; otherwise, false .
|
HasStringDatabase
Does the LocalizationSettings exist and contain a string database?
Declaration
public static bool HasStringDatabase { get; }
Property Value
Type |
Description |
Boolean |
true if has string database; otherwise, false .
|
InitializationOperation
The localization system may not be immediately ready. Loading Locales, preloading assets etc.
This operation can be used to check when the system is ready. You can yield on this in a coroutine to wait.
Declaration
public static AsyncOperationHandle<LocalizationSettings> InitializationOperation { get; }
Property Value
Instance
Singleton instance for the Localization Settings.
Declaration
public static LocalizationSettings Instance { get; set; }
Property Value
SelectedLocale
The current selected Locale. This is the Locale that will be used by default when localizing assets and strings.
If you are calling this before InitializationOperation has been completed then a null value may be returned.
See SelectedLocaleAsync for a version that will ensure the Locale is not null(when possible).
Declaration
public static Locale SelectedLocale { get; set; }
Property Value
SelectedLocaleAsync
The current selected Locale. This is the Locale that will be used by default when localizing assets and strings.
If InitializationOperation has not been completed yet then this will wait for the AvailableLocales part to complete first.
It will not wait for the entire InitializationOperation but just the part that initializes the Locales.
Declaration
public static AsyncOperationHandle<Locale> SelectedLocaleAsync { get; }
Property Value
StartupLocaleSelectors
Declaration
public static List<IStartupLocaleSelector> StartupLocaleSelectors { get; }
Property Value
StringDatabase
The string database is responsible for providing localized string assets.
Declaration
public static LocalizedStringDatabase StringDatabase { get; set; }
Property Value
Methods
GetAssetDatabase()
Declaration
public virtual LocalizedAssetDatabase GetAssetDatabase()
Returns
GetAvailableLocales()
Declaration
public ILocalesProvider GetAvailableLocales()
Returns
GetInitializationOperation()
Declaration
public virtual AsyncOperationHandle<LocalizationSettings> GetInitializationOperation()
Returns
GetInstanceDontCreateDefault()
Returns the singleton of the LocalizationSettings but does not create a default one if no active settings are found.
Declaration
public static LocalizationSettings GetInstanceDontCreateDefault()
Returns
GetSelectedLocale()
Declaration
public virtual Locale GetSelectedLocale()
Returns
GetSelectedLocaleAsync()
Declaration
public virtual AsyncOperationHandle<Locale> GetSelectedLocaleAsync()
Returns
GetStartupLocaleSelectors()
Declaration
public List<IStartupLocaleSelector> GetStartupLocaleSelectors()
Returns
GetStringDatabase()
Returns the string database being used to localize all strings.
Declaration
public virtual LocalizedStringDatabase GetStringDatabase()
Returns
OnLocaleRemoved(Locale)
Declaration
public void OnLocaleRemoved(Locale locale)
Parameters
Type |
Name |
Description |
Locale |
locale |
|
SelectLocale()
Declaration
protected virtual Locale SelectLocale()
Returns
SetAssetDatabase(LocalizedAssetDatabase)
Declaration
public void SetAssetDatabase(LocalizedAssetDatabase database)
Parameters
SetAvailableLocales(ILocalesProvider)
Declaration
public void SetAvailableLocales(ILocalesProvider available)
Parameters
SetSelectedLocale(Locale)
Declaration
public void SetSelectedLocale(Locale locale)
Parameters
Type |
Name |
Description |
Locale |
locale |
|
SetStringDatabase(LocalizedStringDatabase)
Sets the string database to be used for localizing all strings.
Declaration
public void SetStringDatabase(LocalizedStringDatabase database)
Parameters
Events
OnSelectedLocaleChanged
Declaration
public event Action<Locale> OnSelectedLocaleChanged
Event Type
SelectedLocaleChanged
Declaration
public static event Action<Locale> SelectedLocaleChanged
Event Type
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.