Search Results for

    Show / Hide Table of Contents
    View Source

    Class LocalizedTextServiceExtensions

    Extension methods for ILocalizedTextService

    Inheritance
    object
    Namespace: Umbraco.Extensions
    Assembly: Umbraco.Core.dll
    Syntax
    public static class LocalizedTextServiceExtensions

    Methods

    View Source

    Localize(ILocalizedTextService, string?, string?)

    Localizes a key using the current thread culture.

    Declaration
    public static string Localize(this ILocalizedTextService manager, string? area, string? alias)
    Parameters
    Type Name Description
    ILocalizedTextService manager

    The localized text service.

    string area

    The area/category of the localization key.

    string alias

    The alias/key to localize.

    Returns
    Type Description
    string

    The localized string.

    View Source

    Localize(ILocalizedTextService, string, string, CultureInfo, string?[])

    Localize a key without any variables

    Declaration
    public static string Localize(this ILocalizedTextService manager, string area, string alias, CultureInfo culture, string?[] tokens)
    Parameters
    Type Name Description
    ILocalizedTextService manager
    string area
    string alias
    CultureInfo culture
    string[] tokens
    Returns
    Type Description
    string
    View Source

    Localize(ILocalizedTextService, string?, string, string?[]?)

    Localize using the current thread culture

    Declaration
    public static string Localize(this ILocalizedTextService manager, string? area, string alias, string?[]? tokens)
    Parameters
    Type Name Description
    ILocalizedTextService manager
    string area
    string alias
    string[] tokens
    Returns
    Type Description
    string
    View Source

    Localize<T>(ILocalizedTextService, string, T)

    Localizes a key using an enum value and the current thread culture.

    Declaration
    public static string Localize<T>(this ILocalizedTextService manager, string area, T key) where T : Enum
    Parameters
    Type Name Description
    ILocalizedTextService manager

    The localized text service.

    string area

    The area/category of the localization key.

    T key

    The enum value representing the localization key.

    Returns
    Type Description
    string

    The localized string.

    Type Parameters
    Name Description
    T

    The enum type.

    View Source

    UmbracoDictionaryTranslate(ILocalizedTextService, ICultureDictionary, string?)

    Translates text using the Umbraco dictionary, falling back to localized text service.

    Declaration
    public static string? UmbracoDictionaryTranslate(this ILocalizedTextService manager, ICultureDictionary cultureDictionary, string? text)
    Parameters
    Type Name Description
    ILocalizedTextService manager

    The localized text service.

    ICultureDictionary cultureDictionary

    The culture dictionary.

    string text

    The text to translate. If it starts with '#', it will be looked up in the dictionary.

    Returns
    Type Description
    string

    The translated text, or the original text if no translation is found.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX