Search Results for

    Show / Hide Table of Contents
    View Source

    Class LocalizedTextService

    Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.

    Inheritance
    object
    Namespace: Umbraco.Cms.Core.Services
    Assembly: Umbraco.Core.dll
    Syntax
    public class LocalizedTextService : ILocalizedTextService

    Constructors

    View Source

    LocalizedTextService(IDictionary<CultureInfo, Lazy<IDictionary<string, IDictionary<string, string>>>>, ILogger<LocalizedTextService>)

    Initializes with a source of a dictionary of culture -> areas -> sub dictionary of keys/values

    Declaration
    public LocalizedTextService(IDictionary<CultureInfo, Lazy<IDictionary<string, IDictionary<string, string>>>> source, ILogger<LocalizedTextService> logger)
    Parameters
    Type Name Description
    IDictionary<CultureInfo, Lazy<IDictionary<string, IDictionary<string, string>>>> source
    ILogger<LocalizedTextService> logger
    View Source

    LocalizedTextService(IDictionary<CultureInfo, Lazy<XDocument>>, ILogger<LocalizedTextService>)

    Initializes with an XML source

    Declaration
    public LocalizedTextService(IDictionary<CultureInfo, Lazy<XDocument>> source, ILogger<LocalizedTextService> logger)
    Parameters
    Type Name Description
    IDictionary<CultureInfo, Lazy<XDocument>> source
    ILogger<LocalizedTextService> logger
    View Source

    LocalizedTextService(Lazy<LocalizedTextServiceFileSources>, ILogger<LocalizedTextService>)

    Initializes with a file sources instance

    Declaration
    public LocalizedTextService(Lazy<LocalizedTextServiceFileSources> fileSources, ILogger<LocalizedTextService> logger)
    Parameters
    Type Name Description
    Lazy<LocalizedTextServiceFileSources> fileSources
    ILogger<LocalizedTextService> logger

    Methods

    View Source

    ConvertToSupportedCultureWithRegionCode(CultureInfo)

    Tries to resolve a full 4 letter culture from a 2 letter culture name

    Declaration
    public CultureInfo ConvertToSupportedCultureWithRegionCode(CultureInfo currentCulture)
    Parameters
    Type Name Description
    CultureInfo currentCulture

    The culture to determine if it is only a 2 letter culture, if so we'll try to convert it, otherwise it will just be returned

    Returns
    Type Description
    CultureInfo
    Remarks

    TODO: This is just a hack due to the way we store the language files, they should be stored with 4 letters since that is what they reference but they are stored with 2, further more our user's languages are stored with 2. So this attempts to resolve the full culture if possible. This only works when this service is constructed with the LocalizedTextServiceFileSources

    View Source

    GetAllStoredValues(CultureInfo)

    Returns all key/values in storage for the given culture

    Declaration
    public IDictionary<string, string> GetAllStoredValues(CultureInfo culture)
    Parameters
    Type Name Description
    CultureInfo culture
    Returns
    Type Description
    IDictionary<string, string>
    View Source

    GetAllStoredValuesByAreaAndAlias(CultureInfo)

    Returns all key/values in storage for the given culture

    Declaration
    public IDictionary<string, IDictionary<string, string>> GetAllStoredValuesByAreaAndAlias(CultureInfo culture)
    Parameters
    Type Name Description
    CultureInfo culture
    Returns
    Type Description
    IDictionary<string, IDictionary<string, string>>
    View Source

    GetSupportedCultures()

    Returns a list of all currently supported cultures

    Declaration
    public IEnumerable<CultureInfo> GetSupportedCultures()
    Returns
    Type Description
    IEnumerable<CultureInfo>
    View Source

    Localize(string, CultureInfo, IDictionary<string, string?>?)

    Declaration
    public string Localize(string key, CultureInfo culture, IDictionary<string, string?>? tokens = null)
    Parameters
    Type Name Description
    string key
    CultureInfo culture
    IDictionary<string, string> tokens
    Returns
    Type Description
    string
    View Source

    Localize(string?, string?, CultureInfo?, IDictionary<string, string?>?)

    Localize a key with variables

    Declaration
    public string Localize(string? area, string? alias, CultureInfo? culture, IDictionary<string, string?>? tokens = null)
    Parameters
    Type Name Description
    string area
    string alias
    CultureInfo culture
    IDictionary<string, string> tokens

    This can be null

    Returns
    Type Description
    string
    • Edit this page
    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX