Class LocalesProvider
Responsible for providing the list of locales that are currently available to this application.
Namespace: UnityEngine.Localization.Settings
Syntax
public class LocalesProvider : object, ILocalesProvider, IPreloadRequired, IReset
Properties
Locales
The list of all supported locales.
Declaration
public List<Locale> Locales { get; }
Property Value
Type | Description |
---|---|
List<Locale> |
Implements
PreloadOperation
The Locales loading operation. When set to isDone then all locales have been loaded. Can be Null if the operation has not started yet.
Declaration
public AsyncOperationHandle PreloadOperation { get; }
Property Value
Type | Description |
---|---|
AsyncOperationHandle |
Implements
Methods
AddLocale(Locale)
Add a Locale to allow support for a specific language.
Declaration
public void AddLocale(Locale locale)
Parameters
Type | Name | Description |
---|---|---|
Locale | locale |
Implements
GetLocale(String)
Attempt to retrieve a Locale using a Code.
Declaration
public Locale GetLocale(string code)
Parameters
Type | Name | Description |
---|---|---|
String | code | If no Locale can be found then null is returned. |
Returns
Type | Description |
---|---|
Locale |
GetLocale(SystemLanguage)
Attempt to retrieve a Locale using a
Declaration
public Locale GetLocale(SystemLanguage systemLanguage)
Parameters
Type | Name | Description |
---|---|---|
SystemLanguage | systemLanguage |
Returns
Type | Description |
---|---|
Locale | If no Locale can be found then null is returned. |
GetLocale(LocaleIdentifier)
Attempt to retrieve a Locale using the identifier.
Declaration
public Locale GetLocale(LocaleIdentifier id)
Parameters
Type | Name | Description |
---|---|---|
LocaleIdentifier | id | LocaleIdentifier to find. |
Returns
Type | Description |
---|---|
Locale | If no Locale can be found then null is returned. |
Implements
RemoveLocale(Locale)
Removes support for a specific Locale.
Declaration
public bool RemoveLocale(Locale locale)
Parameters
Type | Name | Description |
---|---|---|
Locale | locale | The locale that should be removed if possible. |
Returns
Type | Description |
---|---|
Boolean | true if the locale was removed or false if the locale did not exist. |
Implements
ResetState()
Resets the state of the provider by removing all the Locales and clearing the preload operation.
Declaration
public void ResetState()