Skip to content

Locale Changer

eisclimber edited this page Feb 15, 2024 · 1 revision

Locale Changer

class in ExPresSXR.Localization / Extends MonoBehavior
Component added via Component Menu

Description

Allows switching the games locales (language) and initializes the language server if not initialized.

Members

Editor Properties

  • int _currentLocaleIdx: (Readonly) Returns the index of the current selected locale or -1 if not initialized.
  • int _numLocales: (Readonly) Returns the index of the current selected locale or -1 if not initialized. Default: 1
  • bool _initialized: (Readonly) If the language server was initialized, meaning locales are replaced and can be switched.

Pubic Methods

  • void CircleLocale(bool cycleForward): Circles the locale by 1 either forward or backwards by increasing the locale index. The function handles rotation over the bounds of the array by starting at the other site. The order is determined by the order of enabled locales.
  • void SetLocale(Locale locale): Sets the locale using a Locale object, if it is available.
  • void SetLocale(string identifierCode): Sets the locale using its identifierCode, if it is available.
  • void SetLocale(int localeIdx): Sets the current locale using its index from the Localization Settings.
  • int FindLocaleIndex(Locale desiredLocale): Finds the index of the desired locale in the LocalizationSettings.
  • int FindLocaleIndex(string languageCode): Finds the index of the desired locale in the LocalizationSettings using its language code.

Events

  • UnityEvent<int, string, string> OnLocaleChanged: Event emitted when the locale changes. The parameters are: locale_idx, locale_name, locale_code
  • UnityEvent<string> OnLocaleNameChanged: Event emitted when the locale changes. The parameters are: locale_name
  • UnityEvent<bool> OnInitialized: Emitted once the LocalizationSettings is initialized. The parameter is true if there were was more than one locale configured.

Enums

  • ScrollDirection: Direction in which the rect is scrolled. The values reflect the delta direction: Up = 1 and Down = -1.

ExPresS XR Wiki

Tutorial Pages

Code Documentation

Clone this wiki locally