Skip to content

Reference

Chad-Vine-Doll edited this page Oct 3, 2023 · 7 revisions

This section holds the reference to the classes

Class

L10n

L10n is the main class that translate keys to current language.

  • Load(): Load the localization data and/or given region.
  • Reload(): Reload current language. Useful when L10n data changed in editor.
  • Tr(): Direct translate given key to current language.

Interfaces

ILocalizable

ILocalizable is the common interface for all objects that can print localized messages.

All methods of the interface have been predefined.

        /// <summary>
        /// Get the base localization key of the object, default as full name of the type
        /// </summary>
        string BaseKey { get; }

        /// <summary>
        /// Get the key represent for this localizable object
        /// <br></br>
        /// Override to get keys from the object
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        string GetLocalizationKey(params string[] param);

        /// <summary>
        /// Get the raw content, override this for creating custom format of localized content
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        string GetRawContent(params string[] param);
        

        /// <summary>
        /// Get escape value from the object
        /// </summary>
        /// <param name="escapeKey"></param>
        /// <returns></returns>
        string GetEscapeValue(string escapeKey, params string[] param);

ILocalizer

A localizer translates given key to a translated value.

        /// <summary>
        /// Get localized content with extra parameters
        /// </summary>
        /// <param name="param">extra parameters</param>
        /// <returns>localized content</returns>
        string Tr(params string[] param);
Clone this wiki locally