C# Class Bloom.Api.I18NHandler

This class handles requests for internationalization. It uses the L10NSharp LocalizationManager to look up values.
Show file Open project: BloomBooks/BloomDesktop Class Usage Examples

Public Methods

Method Description
GetTranslationDefaultMayNotBeEnglish ( string key, string defaultCurrent ) : string

We want the translation of the specified key in the current UI language. The normal LocalizationManager call expects to be passed an English default, which it will return if the language is English or if it has no translation for the string in the target language. The current default passed as an argument typically comes from the content of the element whose data-i18n attribute is the key in this method. However, this string may come from an earlier loclization and therefore NOT be English. If we pass it as the english default, we will get it back unchanged if the UI language has changed (back) to English. We will also get something other than English as a default for any langauge in which we don't have the localization.

HandleRequest ( string localPath, IRequestInfo info, CollectionSettings currentCollectionSettings ) : bool

Private Methods

Method Description
IsInteger ( string key ) : bool
ReportL10NMissingString ( string id, string englishText ) : void

Method Details

GetTranslationDefaultMayNotBeEnglish() public static method

We want the translation of the specified key in the current UI language. The normal LocalizationManager call expects to be passed an English default, which it will return if the language is English or if it has no translation for the string in the target language. The current default passed as an argument typically comes from the content of the element whose data-i18n attribute is the key in this method. However, this string may come from an earlier loclization and therefore NOT be English. If we pass it as the english default, we will get it back unchanged if the UI language has changed (back) to English. We will also get something other than English as a default for any langauge in which we don't have the localization.
public static GetTranslationDefaultMayNotBeEnglish ( string key, string defaultCurrent ) : string
key string
defaultCurrent string
return string

HandleRequest() public static method

public static HandleRequest ( string localPath, IRequestInfo info, CollectionSettings currentCollectionSettings ) : bool
localPath string
info IRequestInfo
currentCollectionSettings Bloom.Collection.CollectionSettings
return bool