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
public interface ILocalizationService : IService
Methods
View SourceAddOrUpdateDictionaryValue(IDictionaryItem, ILanguage, String)
Adds or updates a translation for a dictionary item and language
Declaration
void AddOrUpdateDictionaryValue(IDictionaryItem item, ILanguage language, string value)
Parameters
Type | Name | Description |
---|---|---|
IDictionary |
item | |
ILanguage | language | |
System. |
value |
CreateDictionaryItemWithIdentity(String, Nullable<Guid>, String)
Creates and saves a new dictionary item and assigns a value to all languages if defaultValue is specified.
Declaration
IDictionaryItem CreateDictionaryItemWithIdentity(string key, Guid? parentId, string defaultValue = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
key | |
System. |
parentId | |
System. |
defaultValue |
Returns
Type | Description |
---|---|
IDictionary |
Delete(IDictionaryItem, Int32)
Deletes a IDictionary
Declaration
void Delete(IDictionaryItem dictionaryItem, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
IDictionary |
dictionaryItem | IDictionary |
System. |
userId | Optional id of the user deleting the dictionary item |
Delete(ILanguage, Int32)
Deletes a ILanguage by removing it and its usages from the db
Declaration
void Delete(ILanguage language, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
ILanguage | language | ILanguage to delete |
System. |
userId | Optional id of the user deleting the language |
DictionaryItemExists(String)
Checks if a IDictionary
Declaration
bool DictionaryItemExists(string key)
Parameters
Type | Name | Description |
---|---|---|
System. |
key | Key of the IDictionary |
Returns
Type | Description |
---|---|
System. |
True if a IDictionary |
GetAllLanguages()
Gets all available languages
Declaration
IEnumerable<ILanguage> GetAllLanguages()
Returns
View SourceGetAllLanguagesPaged(Int32, Int32)
Declaration
virtual PagedModel<ILanguage> GetAllLanguagesPaged(int skip, int take)
Parameters
Type | Name | Description |
---|---|---|
System. |
skip | |
System. |
take |
Returns
Type | Description |
---|---|
Paged |
GetDefaultLanguageId()
Gets the default language identifier.
Declaration
int? GetDefaultLanguageId()
Returns
Type | Description |
---|---|
System. |
Remarks
This can be optimized and bypass all deep cloning.
GetDefaultLanguageIsoCode()
Gets the default language ISO code.
Declaration
string GetDefaultLanguageIsoCode()
Returns
Type | Description |
---|---|
System. |
Remarks
This can be optimized and bypass all deep cloning.
GetDictionaryItemById(Guid)
Gets a IDictionary
Declaration
IDictionaryItem GetDictionaryItemById(Guid id)
Parameters
Type | Name | Description |
---|---|---|
Guid | id | Id of the IDictionary |
Returns
Type | Description |
---|---|
IDictionary |
IDictionary |
GetDictionaryItemById(Int32)
Gets a IDictionary
Declaration
IDictionaryItem GetDictionaryItemById(int id)
Parameters
Type | Name | Description |
---|---|---|
System. |
id | Id of the IDictionary |
Returns
Type | Description |
---|---|
IDictionary |
IDictionary |
GetDictionaryItemByKey(String)
Gets a IDictionary
Declaration
IDictionaryItem GetDictionaryItemByKey(string key)
Parameters
Type | Name | Description |
---|---|---|
System. |
key | Key of the IDictionary |
Returns
Type | Description |
---|---|
IDictionary |
IDictionary |
GetDictionaryItemChildren(Guid)
Gets a list of children for a IDictionary
Declaration
IEnumerable<IDictionaryItem> GetDictionaryItemChildren(Guid parentId)
Parameters
Type | Name | Description |
---|---|---|
Guid | parentId | Id of the parent |
Returns
Type | Description |
---|---|
IEnumerable<IDictionary |
An enumerable list of IDictionary |
GetDictionaryItemDescendants(Nullable<Guid>)
Gets a list of descendants for a IDictionary
Declaration
IEnumerable<IDictionaryItem> GetDictionaryItemDescendants(Guid? parentId)
Parameters
Type | Name | Description |
---|---|---|
System. |
parentId | Id of the parent, null will return all dictionary items |
Returns
Type | Description |
---|---|
IEnumerable<IDictionary |
An enumerable list of IDictionary |
GetDictionaryItemKeyMap()
Gets the full dictionary key map.
Declaration
Dictionary<string, Guid> GetDictionaryItemKeyMap()
Returns
Type | Description |
---|---|
Umbraco. |
The full dictionary key map. |
GetDictionaryItemsByIds(Guid[])
Gets a collection of IDictionary
Declaration
virtual IEnumerable<IDictionaryItem> GetDictionaryItemsByIds(params Guid[] ids)
Parameters
Type | Name | Description |
---|---|---|
Guid[] | ids | Ids of the IDictionary |
Returns
Type | Description |
---|---|
IEnumerable<IDictionary |
A collection of IDictionary |
GetDictionaryItemsByKeys(String[])
Gets a collection of IDictionary
Declaration
virtual IEnumerable<IDictionaryItem> GetDictionaryItemsByKeys(params string[] keys)
Parameters
Type | Name | Description |
---|---|---|
System. |
keys | Keys of the IDictionary |
Returns
Type | Description |
---|---|
IEnumerable<IDictionary |
A collection of IDictionary |
GetLanguageById(Int32)
Gets a ILanguage by its id
Declaration
ILanguage GetLanguageById(int id)
Parameters
Type | Name | Description |
---|---|---|
System. |
id | Id of the ILanguage |
Returns
View SourceGetLanguageByIsoCode(String)
Gets a ILanguage by its iso code
Declaration
ILanguage GetLanguageByIsoCode(string isoCode)
Parameters
Type | Name | Description |
---|---|---|
System. |
isoCode | Iso Code of the language (ie. en-US) |
Returns
View SourceGetLanguageIdByIsoCode(String)
Gets a language identifier from its ISO code.
Declaration
int? GetLanguageIdByIsoCode(string isoCode)
Parameters
Type | Name | Description |
---|---|---|
System. |
isoCode |
Returns
Type | Description |
---|---|
System. |
Remarks
This can be optimized and bypass all deep cloning.
GetLanguageIsoCodeById(Int32)
Gets a language ISO code from its identifier.
Declaration
string GetLanguageIsoCodeById(int id)
Parameters
Type | Name | Description |
---|---|---|
System. |
id |
Returns
Type | Description |
---|---|
System. |
Remarks
This can be optimized and bypass all deep cloning.
GetRootDictionaryItems()
Gets the root/top IDictionary
Declaration
IEnumerable<IDictionaryItem> GetRootDictionaryItems()
Returns
Type | Description |
---|---|
IEnumerable<IDictionary |
An enumerable list of IDictionary |
Save(IDictionaryItem, Int32)
Saves a IDictionary
Declaration
void Save(IDictionaryItem dictionaryItem, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
IDictionary |
dictionaryItem | IDictionary |
System. |
userId | Optional id of the user saving the dictionary item |
Save(ILanguage, Int32)
Saves a ILanguage object
Declaration
void Save(ILanguage language, int userId = -1)