LocalTextRegistry class
namespace: Serenity.Localization assembly: Serenity.Net.Core
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 ILocalTextContext interface, and registering it through the service locator. |
GetAllAvailableTextsInLanguage(…) | Gets all available text keys (that has a translation in language or any of its language fallbacks) and their local texts. |
GetAllTextKeys(…) | Gets all text keys that is currently registered in any language |
GetAllTexts(…) | |
GetLanguageFallbacks() | |
RemoveAll() | Removes all cached texts |
SetLanguageFallback(…) | |
TryGet(…) | Converts the local text key to its representation in requested language. Looks up text in requested language, its Fallbacks and 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 to 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