Interface ILocalizedTextService
The entry point to localize any key in the text storage source for a given culture
Namespace: Umbraco.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface ILocalizedTextService
Remarks
This class is created to be as simple as possible so that it can be replaced very easily, all other methods are extension methods that simply call the one underlying method in this class
Methods
View SourceConvertToSupportedCultureWithRegionCode(CultureInfo)
Tries to resolve a full 4 letter culture from a 2 letter culture name
Declaration
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 |
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.
GetAllStoredValues(CultureInfo)
Returns all key/values in storage for the given culture
Declaration
IDictionary<string, string> GetAllStoredValues(CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.CultureInfo | culture |
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.String> |
GetSupportedCultures()
Returns a list of all currently supported cultures
Declaration
IEnumerable<CultureInfo> GetSupportedCultures()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Globalization.CultureInfo> |
Localize(String, CultureInfo, IDictionary<String, String>)
Localize a key with variables
Declaration
[Obsolete("Use LocalizedTextServiceExtensions.Localize or ILocalizedTextService2.Localize instead")]
string Localize(string key, CultureInfo culture, IDictionary<string, string> tokens = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | |
System.Globalization.CultureInfo | culture | |
System.Collections.Generic.IDictionary<System.String, System.String> | tokens | This can be null |
Returns
Type | Description |
---|---|
System.String |