LocalTextRegistry class
namespace: Serenity.Localization assembly: Serenity.Net.Core
The default ILocalTextRegistry implementation.
public class LocalTextRegistry : IGetAllTexts, ILanguageFallbacks, ILocalTextRegistry, IRemoveAll
Public Members
| name | description |
|---|---|
| LocalTextRegistry() | The default constructor. |
| Add(…) | Adds a local text entry to the registry. |
| AddPending(…) | Adds a pending approval local text entry to the registry. These texts can only be seen while moderators are browsing the site. You can determine which users are moderators by implementing the ILocalTextContext interface and registering it through the service locator. |
| GetAllAvailableTextsInLanguage(…) | Gets all available text keys (that have a translation in the language or any of its language fallbacks) and their local texts. |
| GetAllTextKeys(…) | Gets all text keys that are currently registered in any language. |
| GetAllTexts(…) | |
| GetLanguageFallbacks(…) | |
| RemoveAll() | Removes all cached texts. |
| SetLanguageFallback(…) | |
| TryGet(…) | Converts the local text key to its representation in the requested language. Looks up the text in the requested language, its fallbacks, and the invariant language in order. If not found in any, null is returned. See SetLanguageFallback for information about language fallbacks. |
Remarks
This implementation also supports a "pending approval" mode. If your site needs some moderator approval before translations are published, you may put your site into this mode when some moderator is using the site by registering an ILocalTextContext provider. Thus, moderators can see unapproved texts while they are logged in to the site.
See Also
- interface ILocalTextRegistry
- interface IRemoveAll
- interface IGetAllTexts
- interface ILanguageFallbacks
- Source: LocalTextRegistry.cs