Search Results for

    Show / Hide Table of Contents
    View Source

    Class LocalizedTextServiceFileSources

    Exposes the XDocument sources from files for the default localization text service and ensure caching is taken care of

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

    Constructors

    View Source

    LocalizedTextServiceFileSources(ILogger<LocalizedTextServiceFileSources>, AppCaches, DirectoryInfo)

    Initializes a new instance of the LocalizedTextServiceFileSources class with default settings.

    Declaration
    public LocalizedTextServiceFileSources(ILogger<LocalizedTextServiceFileSources> logger, AppCaches appCaches, DirectoryInfo fileSourceFolder)
    Parameters
    Type Name Description
    ILogger<LocalizedTextServiceFileSources> logger

    The logger.

    AppCaches appCaches

    The application caches.

    DirectoryInfo fileSourceFolder

    The directory containing the localization files.

    View Source

    LocalizedTextServiceFileSources(ILogger<LocalizedTextServiceFileSources>, AppCaches, DirectoryInfo, IEnumerable<LocalizedTextServiceSupplementaryFileSource>, IDirectoryContents)

    Initializes a new instance of the LocalizedTextServiceFileSources class. This is used to configure the file sources with the main file sources shipped with Umbraco and also including supplemental/plugin based localization files. The supplemental files will be loaded in and merged in after the primary files. The supplemental files must be named with the 4 letter culture name with a hyphen such as : en-AU.xml

    Declaration
    public LocalizedTextServiceFileSources(ILogger<LocalizedTextServiceFileSources> logger, AppCaches appCaches, DirectoryInfo fileSourceFolder, IEnumerable<LocalizedTextServiceSupplementaryFileSource> supplementFileSources, IDirectoryContents directoryContents)
    Parameters
    Type Name Description
    ILogger<LocalizedTextServiceFileSources> logger

    The logger.

    AppCaches appCaches

    The application caches.

    DirectoryInfo fileSourceFolder

    The directory containing the primary localization files.

    IEnumerable<LocalizedTextServiceSupplementaryFileSource> supplementFileSources

    The supplementary file sources to merge with primary files.

    IDirectoryContents directoryContents

    The directory contents provider.

    Methods

    View Source

    GetXmlSources()

    Returns all xml sources for all culture files found in the folder.

    Declaration
    public IDictionary<CultureInfo, Lazy<XDocument>> GetXmlSources()
    Returns
    Type Description
    IDictionary<CultureInfo, Lazy<XDocument>>
    View Source

    TryConvert2LetterCultureTo4Letter(string)

    Attempts to convert a 2-letter culture code to its 4-letter equivalent.

    Declaration
    public Attempt<CultureInfo?> TryConvert2LetterCultureTo4Letter(string twoLetterCulture)
    Parameters
    Type Name Description
    string twoLetterCulture

    The 2-letter culture code to convert.

    Returns
    Type Description
    Attempt<CultureInfo>

    An attempt containing the 4-letter culture info if successful.

    Remarks

    This is a workaround because language files are stored with 2-letter culture names that actually contain 4-letter cultures.

    View Source

    TryConvert4LetterCultureTo2Letter(CultureInfo)

    Attempts to convert a 4-letter culture to its 2-letter equivalent.

    Declaration
    public Attempt<string?> TryConvert4LetterCultureTo2Letter(CultureInfo culture)
    Parameters
    Type Name Description
    CultureInfo culture

    The culture to convert.

    Returns
    Type Description
    Attempt<string>

    An attempt containing the 2-letter culture code if successful.

    Remarks

    This is a workaround because language files are stored with 2-letter culture names that actually contain 4-letter cultures.

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