Popcorning Guinea Pig
Search Results for

    Show / Hide Table of Contents

    Interface ILocalizationService

    Defines the contract for a localization service that provides translated strings and manages fonts for different languages.

    Namespace: PopcorningGuineaPig.Engine.services
    Assembly: PopcorningGuineaPig.Engine.dll
    Syntax
    public interface ILocalizationService

    Properties

    | Edit this page View Source

    AvailableLanguages

    Gets the list of available language codes.

    Declaration
    IEnumerable<string> AvailableLanguages { get; }
    Property Value
    Type Description
    IEnumerable<string>
    | Edit this page View Source

    CurrentFontPath

    Gets the font path for the current language.

    Declaration
    string CurrentFontPath { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    CurrentLanguage

    Gets the currently selected language code (e.g., "en", "zh").

    Declaration
    string CurrentLanguage { get; }
    Property Value
    Type Description
    string

    Methods

    | Edit this page View Source

    GetFontPathForLanguage(string)

    Gets the font path for a specific language.

    Declaration
    string? GetFontPathForLanguage(string languageCode)
    Parameters
    Type Name Description
    string languageCode

    The language code.

    Returns
    Type Description
    string

    The font path for the language, or null if not configured.

    | Edit this page View Source

    GetString(string)

    Gets the translated string for the specified key in the current language.

    Declaration
    string GetString(string key)
    Parameters
    Type Name Description
    string key

    The localization key.

    Returns
    Type Description
    string

    The translated string, or the key if no translation is found.

    | Edit this page View Source

    LoadLocalization(string)

    Loads localization data from a CSV file.

    Declaration
    void LoadLocalization(string filePath)
    Parameters
    Type Name Description
    string filePath

    The path to the CSV file.

    | Edit this page View Source

    SetFontPaths(Dictionary<string, string>)

    Sets the font paths for different languages.

    Declaration
    void SetFontPaths(Dictionary<string, string> languageToFontMap)
    Parameters
    Type Name Description
    Dictionary<string, string> languageToFontMap

    Dictionary mapping language codes to font file paths.

    | Edit this page View Source

    SetLanguage(string)

    Sets the current language.

    Declaration
    void SetLanguage(string languageCode)
    Parameters
    Type Name Description
    string languageCode

    The ISO 639-1 language code.

    Events

    | Edit this page View Source

    FontChanged

    Event raised when the current font changes (usually when language changes).

    Declaration
    event Action FontChanged
    Event Type
    Type Description
    Action
    | Edit this page View Source

    LanguageChanged

    Event raised when the current language changes.

    Declaration
    event Action LanguageChanged
    Event Type
    Type Description
    Action
    • Edit this page
    • View Source
    In this article
    Back to top © 2024 Popcorning Guinea Pig Game Engine. A custom C# game engine for indie developers.