Search Results for

    Show / Hide Table of Contents

    Class LocalizedTextService

    Inheritance
    System.Object
    Namespace: Umbraco.Cms.Core.Services.Implement
    Assembly: cs.temp.dll.dll
    Syntax
    public class LocalizedTextService : ILocalizedTextService

    Constructors

    LocalizedTextService(IDictionary<CultureInfo, IDictionary<String, IDictionary<String, String>>>, ILogger<LocalizedTextService>)

    Declaration
    [Obsolete("Use other ctor with IDictionary<CultureInfo, Lazy<IDictionary<string, IDictionary<string, string>>>> as input parameter.")]
    public LocalizedTextService(IDictionary<CultureInfo, IDictionary<string, IDictionary<string, string>>> source, ILogger<LocalizedTextService> logger)
    Parameters
    Type Name Description
    System.Collections.Generic.IDictionary<CultureInfo, System.Collections.Generic.IDictionary<System.String, System.Collections.Generic.IDictionary<System.String, System.String>>> source
    ILogger<LocalizedTextService> logger

    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
    System.Collections.Generic.IDictionary<CultureInfo, System.Lazy<System.Collections.Generic.IDictionary<System.String, System.Collections.Generic.IDictionary<System.String, System.String>>>> source
    ILogger<LocalizedTextService> logger

    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
    System.Collections.Generic.IDictionary<CultureInfo, System.Lazy<XDocument>> source
    ILogger<LocalizedTextService> logger

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

    Initializes with a file sources instance

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

    Methods

    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

    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
    System.Collections.Generic.IDictionary<System.String, System.String>

    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
    System.Collections.Generic.IDictionary<System.String, System.Collections.Generic.IDictionary<System.String, System.String>>

    GetSupportedCultures()

    Returns a list of all currently supported cultures

    Declaration
    public IEnumerable<CultureInfo> GetSupportedCultures()
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<CultureInfo>

    Localize(String, CultureInfo, IDictionary<String, String>)

    Declaration
    public string Localize(string key, CultureInfo culture, IDictionary<string, string> tokens = null)
    Parameters
    Type Name Description
    System.String key
    CultureInfo culture
    System.Collections.Generic.IDictionary<System.String, System.String> tokens
    Returns
    Type Description
    System.String

    Localize(String, String, CultureInfo, IDictionary<String, String>)

    Declaration
    public string Localize(string area, string alias, CultureInfo culture, IDictionary<string, string> tokens = null)
    Parameters
    Type Name Description
    System.String area
    System.String alias
    CultureInfo culture
    System.Collections.Generic.IDictionary<System.String, System.String> tokens
    Returns
    Type Description
    System.String
    In This Article
    • Constructors
      • LocalizedTextService(IDictionary<CultureInfo, IDictionary<String, IDictionary<String, String>>>, ILogger<LocalizedTextService>)
      • LocalizedTextService(IDictionary<CultureInfo, Lazy<IDictionary<String, IDictionary<String, String>>>>, ILogger<LocalizedTextService>)
      • LocalizedTextService(IDictionary<CultureInfo, Lazy<XDocument>>, ILogger<LocalizedTextService>)
      • LocalizedTextService(Lazy<LocalizedTextServiceFileSources>, ILogger<LocalizedTextService>)
    • Methods
      • ConvertToSupportedCultureWithRegionCode(CultureInfo)
      • GetAllStoredValues(CultureInfo)
      • GetAllStoredValuesByAreaAndAlias(CultureInfo)
      • GetSupportedCultures()
      • Localize(String, CultureInfo, IDictionary<String, String>)
      • Localize(String, String, CultureInfo, IDictionary<String, String>)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX