Class LocalizedTextServiceExtensions
Extension methods for ILocalizedTextService
Inheritance
Namespace: Umbraco.Extensions
Assembly: Umbraco.Core.dll
Syntax
public static class LocalizedTextServiceExtensions
Methods
View SourceLocalize(ILocalizedTextService, string?, string?)
Localizes a key using the current thread culture.
Declaration
public static string Localize(this ILocalizedTextService manager, string? area, string? alias)
Parameters
| Type | Name | Description |
|---|---|---|
| ILocalizedTextService | manager | The localized text service. |
| string | area | The area/category of the localization key. |
| string | alias | The alias/key to localize. |
Returns
| Type | Description |
|---|---|
| string | The localized string. |
Localize(ILocalizedTextService, string, string, CultureInfo, string?[])
Localize a key without any variables
Declaration
public static string Localize(this ILocalizedTextService manager, string area, string alias, CultureInfo culture, string?[] tokens)
Parameters
| Type | Name | Description |
|---|---|---|
| ILocalizedTextService | manager | |
| string | area | |
| string | alias | |
| CultureInfo | culture | |
| string[] | tokens |
Returns
| Type | Description |
|---|---|
| string |
Localize(ILocalizedTextService, string?, string, string?[]?)
Localize using the current thread culture
Declaration
public static string Localize(this ILocalizedTextService manager, string? area, string alias, string?[]? tokens)
Parameters
| Type | Name | Description |
|---|---|---|
| ILocalizedTextService | manager | |
| string | area | |
| string | alias | |
| string[] | tokens |
Returns
| Type | Description |
|---|---|
| string |
Localize<T>(ILocalizedTextService, string, T)
Localizes a key using an enum value and the current thread culture.
Declaration
public static string Localize<T>(this ILocalizedTextService manager, string area, T key) where T : Enum
Parameters
| Type | Name | Description |
|---|---|---|
| ILocalizedTextService | manager | The localized text service. |
| string | area | The area/category of the localization key. |
| T | key | The enum value representing the localization key. |
Returns
| Type | Description |
|---|---|
| string | The localized string. |
Type Parameters
| Name | Description |
|---|---|
| T | The enum type. |
UmbracoDictionaryTranslate(ILocalizedTextService, ICultureDictionary, string?)
Translates text using the Umbraco dictionary, falling back to localized text service.
Declaration
public static string? UmbracoDictionaryTranslate(this ILocalizedTextService manager, ICultureDictionary cultureDictionary, string? text)
Parameters
| Type | Name | Description |
|---|---|---|
| ILocalizedTextService | manager | The localized text service. |
| ICultureDictionary | cultureDictionary | The culture dictionary. |
| string | text | The text to translate. If it starts with '#', it will be looked up in the dictionary. |
Returns
| Type | Description |
|---|---|
| string | The translated text, or the original text if no translation is found. |