Interface ILocalizationService
Defines the Localization Service, which is an easy access to operations involving Languages and Dictionary
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
[Obsolete("Please use ILanguageService and IDictionaryItemService for localization. Will be removed in V15.")]
public interface ILocalizationService : IService
Methods
View SourceAddOrUpdateDictionaryValue(IDictionaryItem, ILanguage?, string)
Adds or updates a translation for a dictionary item and language
Declaration
[Obsolete("Please use IDictionaryItemService for dictionary item operations. Will be removed in V15.")]
void AddOrUpdateDictionaryValue(IDictionaryItem item, ILanguage? language, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| IDictionaryItem | item | |
| ILanguage | language | |
| string | value |
CreateDictionaryItemWithIdentity(string, Guid?, string?)
Creates and saves a new dictionary item and assigns a value to all languages if defaultValue is specified.
Declaration
[Obsolete("Please use IDictionaryItemService for dictionary item operations. Will be removed in V15.")]
IDictionaryItem CreateDictionaryItemWithIdentity(string key, Guid? parentId, string? defaultValue = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | |
| Guid? | parentId | |
| string | defaultValue |
Returns
| Type | Description |
|---|---|
| IDictionaryItem |
Delete(IDictionaryItem, int)
Deletes a IDictionaryItem object and its related translations as well as its children.
Declaration
[Obsolete("Please use IDictionaryItemService for dictionary item operations. Will be removed in V15.")]
void Delete(IDictionaryItem dictionaryItem, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IDictionaryItem | dictionaryItem | IDictionaryItem to delete |
| int | userId | Optional id of the user deleting the dictionary item |
Delete(ILanguage, int)
Deletes a ILanguage by removing it and its usages from the db
Declaration
[Obsolete("Please use ILanguageService for language operations. Will be removed in V15.")]
void Delete(ILanguage language, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| ILanguage | language | ILanguage to delete |
| int | userId | Optional id of the user deleting the language |
DictionaryItemExists(string)
Checks if a IDictionaryItem with given key exists
Declaration
[Obsolete("Please use IDictionaryItemService for dictionary item operations. Will be removed in V15.")]
bool DictionaryItemExists(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | Key of the IDictionaryItem |
Returns
| Type | Description |
|---|---|
| bool | True if a IDictionaryItem exists, otherwise false |
GetAllLanguages()
Gets all available languages
Declaration
[Obsolete("Please use ILanguageService for language operations. Will be removed in V15.")]
IEnumerable<ILanguage> GetAllLanguages()
Returns
| Type | Description |
|---|---|
| IEnumerable<ILanguage> | An enumerable list of ILanguage objects |
GetAllLanguagesPaged(int, int)
Declaration
[Obsolete("Please use ILanguageService for language operations. Will be removed in V15.")]
PagedModel<ILanguage> GetAllLanguagesPaged(int skip, int take)
Parameters
| Type | Name | Description |
|---|---|---|
| int | skip | |
| int | take |
Returns
| Type | Description |
|---|---|
| PagedModel<ILanguage> |
GetDefaultLanguageId()
Gets the default language identifier.
Declaration
[Obsolete("Please use ILanguageService for language operations. Will be removed in V15.")]
int? GetDefaultLanguageId()
Returns
| Type | Description |
|---|---|
| int? |
Remarks
This can be optimized and bypass all deep cloning.
GetDefaultLanguageIsoCode()
Gets the default language ISO code.
Declaration
[Obsolete("Please use ILanguageService for language operations. Will be removed in V15.")]
string GetDefaultLanguageIsoCode()
Returns
| Type | Description |
|---|---|
| string |
Remarks
This can be optimized and bypass all deep cloning.
GetDictionaryItemById(Guid)
Gets a IDictionaryItem by its System.Guid id
Declaration
[Obsolete("Please use IDictionaryItemService for dictionary item operations. Will be removed in V15.")]
IDictionaryItem? GetDictionaryItemById(Guid id)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | id | Id of the IDictionaryItem |
Returns
| Type | Description |
|---|---|
| IDictionaryItem |
GetDictionaryItemById(int)
Gets a IDictionaryItem by its int id
Declaration
[Obsolete("Please use IDictionaryItemService for dictionary item operations. Will be removed in V15.")]
IDictionaryItem? GetDictionaryItemById(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | Id of the IDictionaryItem |
Returns
| Type | Description |
|---|---|
| IDictionaryItem |
GetDictionaryItemByKey(string)
Gets a IDictionaryItem by its key
Declaration
[Obsolete("Please use IDictionaryItemService for dictionary item operations. Will be removed in V15.")]
IDictionaryItem? GetDictionaryItemByKey(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | Key of the IDictionaryItem |
Returns
| Type | Description |
|---|---|
| IDictionaryItem |
GetDictionaryItemChildren(Guid)
Gets a list of children for a IDictionaryItem
Declaration
[Obsolete("Please use IDictionaryItemService for dictionary item operations. Will be removed in V15.")]
IEnumerable<IDictionaryItem> GetDictionaryItemChildren(Guid parentId)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | parentId | Id of the parent |
Returns
| Type | Description |
|---|---|
| IEnumerable<IDictionaryItem> | An enumerable list of IDictionaryItem objects |
GetDictionaryItemDescendants(Guid?)
Gets a list of descendants for a IDictionaryItem
Declaration
[Obsolete("Please use IDictionaryItemService for dictionary item operations. Will be removed in V15.")]
IEnumerable<IDictionaryItem> GetDictionaryItemDescendants(Guid? parentId)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid? | parentId | Id of the parent, null will return all dictionary items |
Returns
| Type | Description |
|---|---|
| IEnumerable<IDictionaryItem> | An enumerable list of IDictionaryItem objects |
GetDictionaryItemKeyMap()
Gets the full dictionary key map.
Declaration
[Obsolete("Please use IDictionaryItemService for dictionary item operations. Will be removed in V15.")]
Dictionary<string, Guid> GetDictionaryItemKeyMap()
Returns
| Type | Description |
|---|---|
| Dictionary<string, Guid> | The full dictionary key map. |
GetDictionaryItemsByIds(params Guid[])
Gets a collection of IDictionaryItem by their System.Guid ids
Declaration
[Obsolete("Please use IDictionaryItemService for dictionary item operations. Will be removed in V15.")]
IEnumerable<IDictionaryItem> GetDictionaryItemsByIds(params Guid[] ids)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid[] | ids | Ids of the IDictionaryItem |
Returns
| Type | Description |
|---|---|
| IEnumerable<IDictionaryItem> | A collection of IDictionaryItem |
GetDictionaryItemsByKeys(params string[])
Gets a collection of IDictionaryItem by their keys
Declaration
[Obsolete("Please use IDictionaryItemService for dictionary item operations. Will be removed in V15.")]
IEnumerable<IDictionaryItem> GetDictionaryItemsByKeys(params string[] keys)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | keys | Keys of the IDictionaryItem |
Returns
| Type | Description |
|---|---|
| IEnumerable<IDictionaryItem> | A collection of IDictionaryItem |
GetLanguageById(int)
Gets a ILanguage by its id
Declaration
[Obsolete("Please use ILanguageService for language operations. Will be removed in V15.")]
ILanguage? GetLanguageById(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | Id of the ILanguage |
Returns
| Type | Description |
|---|---|
| ILanguage |
GetLanguageByIsoCode(string?)
Gets a ILanguage by its iso code
Declaration
[Obsolete("Please use ILanguageService for language operations. Will be removed in V15.")]
ILanguage? GetLanguageByIsoCode(string? isoCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | isoCode | Iso Code of the language (ie. en-US) |
Returns
| Type | Description |
|---|---|
| ILanguage |
GetLanguageIdByIsoCode(string)
Gets a language identifier from its ISO code.
Declaration
[Obsolete("Please use ILanguageService for language operations. Will be removed in V15.")]
int? GetLanguageIdByIsoCode(string isoCode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | isoCode |
Returns
| Type | Description |
|---|---|
| int? |
Remarks
This can be optimized and bypass all deep cloning.
GetLanguageIsoCodeById(int)
Gets a language ISO code from its identifier.
Declaration
[Obsolete("Please use ILanguageService for language operations. Will be removed in V15.")]
string? GetLanguageIsoCodeById(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id |
Returns
| Type | Description |
|---|---|
| string |
Remarks
This can be optimized and bypass all deep cloning.
GetRootDictionaryItems()
Gets the root/top IDictionaryItem objects
Declaration
[Obsolete("Please use IDictionaryItemService for dictionary item operations. Will be removed in V15.")]
IEnumerable<IDictionaryItem> GetRootDictionaryItems()
Returns
| Type | Description |
|---|---|
| IEnumerable<IDictionaryItem> | An enumerable list of IDictionaryItem objects |
Save(IDictionaryItem, int)
Saves a IDictionaryItem object
Declaration
[Obsolete("Please use IDictionaryItemService for dictionary item operations. Will be removed in V15.")]
void Save(IDictionaryItem dictionaryItem, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IDictionaryItem | dictionaryItem | IDictionaryItem to save |
| int | userId | Optional id of the user saving the dictionary item |
Save(ILanguage, int)
Saves a ILanguage object
Declaration
[Obsolete("Please use ILanguageService for language operations. Will be removed in V15.")]
void Save(ILanguage language, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| ILanguage | language | ILanguage to save |
| int | userId | Optional id of the user saving the language |