-
-
Notifications
You must be signed in to change notification settings - Fork 0
Plugin Structure
Galahane Rouillé-Poirel edited this page Jun 19, 2023
·
3 revisions
The scripts are under the namespace "SinGala.Plugins.Localization", as well as "SinGala.Plugins.Localization.SaveSystem" for the example save system.
Enum of the different supported languages
- public static Language Language {get; private set;} : The current language
- public static event Action OnLanguageChanged : The event that is called when the current language is updated. All the Localizers are subscribing to it
- public static void LanguageChanged() : Calls the OnLanguageChanged event
- public static T GetLocalizedValue(Translations translationDatas) : Returns the correct Localized Value from the given Translations Datas depending on the current language
- public static TranslationDatas GetLocalizedDatas(Translations translationDatas) : Returns the full translations datas corresponding to the current language
- public static Language SetBaseLanguage() : Set the current language to the Application.systemLanguage of the device or to the default you set if the language isn't supported
- public static void SetLanguage(Language newLanguage) : Set the current language to the specified one
- [SerializeField] protected Translations _translationsDatas : The Translations Scriptable Object - used by the Localizer to know what are the possible localization values
- public abstract void UpdateValue() : Update the value of the needed component (Image, Sprite, TextMeshProUGUI, etc.) with the correct localized data
- public void SetNewTranslationsDatas(Translations translations) : Update the possible translations datas values of this specific localizer
Used with strings and TextMeshProUGUI
Used with Sprites and Image
Used with Sprites and SpriteRenderer
Used with strings and TMP_Dropdown
Used with Sprites and TMP_Dropdown
Scriptable Object
- [field: SerializeField] public virtual TranslationDatas[] Datas { get; protected set; } : The translations datas of a specific content (text, image)
Used for strings
Used for Sprites
- [field: SerializeField] public virtual List<Translations> Datas { get; protected set; }
Used for Dropdowns that uses strings
Used for Dropdowns that uses Sprites
- [field: SerializeField] public Language Language { get; private set; } : The language that the datas are linked to
- [field: SerializeField] public T LocalizedDatas { get; private set; } : The strings or Sprites needed for this specific language
- [field: SerializeField] public bool IsRTL { get; private set; } : Used on strings to switch between RTL and LTR languages