View Source
Class LocalizedTextService
The entry point to localize any key in the text storage source for a given culture
Inheritance
System.Object
Assembly: Umbraco.Core.dll
Syntax
public class LocalizedTextService : ILocalizedTextService
Constructors
View Source
LocalizedTextService(IDictionary<CultureInfo, IDictionary<String, IDictionary<String, String>>>, ILogger<LocalizedTextService>)
Declaration
public LocalizedTextService(IDictionary<CultureInfo, IDictionary<string, IDictionary<string, string>>> source, ILogger<LocalizedTextService> logger)
Parameters
Type |
Name |
Description |
IDictionary<System.Globalization.CultureInfo, IDictionary<System.String, IDictionary<System.String, System.String>>> |
source |
|
ILogger<LocalizedTextService> |
logger |
|
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<System.Globalization.CultureInfo, Lazy<IDictionary<System.String, IDictionary<System.String, System.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<System.Globalization.CultureInfo, Lazy<System.Xml.Linq.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
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 |
System.Globalization.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 |
System.Globalization.CultureInfo |
|
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 |
System.Globalization.CultureInfo |
culture |
|
Returns
Type |
Description |
IDictionary<System.String, System.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 |
System.Globalization.CultureInfo |
culture |
|
Returns
Type |
Description |
IDictionary<System.String, IDictionary<System.String, System.String>> |
|
View Source
GetSupportedCultures()
Returns a list of all currently supported cultures
Declaration
public IEnumerable<CultureInfo> GetSupportedCultures()
Returns
Type |
Description |
IEnumerable<System.Globalization.CultureInfo> |
|
View Source
Localize(String, CultureInfo, Nullable<IDictionary<String, String>>)
Declaration
public string Localize(string key, CultureInfo culture, IDictionary<string, string>? tokens = null)
Parameters
Type |
Name |
Description |
System.String |
key |
|
System.Globalization.CultureInfo |
culture |
|
System.Nullable<IDictionary<System.String, System.String>> |
tokens |
|
Returns
Type |
Description |
System.String |
|
View Source
Localize(String, String, CultureInfo, Nullable<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 |
|
System.Globalization.CultureInfo |
culture |
|
System.Nullable<IDictionary<System.String, System.String>> |
tokens |
|
Returns
Type |
Description |
System.String |
|