Nested Local Texts
This definitions allow you to reference localized texts with intellisense support, without having to memorize string keys.
These embedded translation definitions are commonly used to define default translations in invariant language (ultimate fallbacks).
Here is a table of translations that are defined with this Texts class:
Local text keys are generated from nested static class names with a dot inserted between. Topmost static class (Texts) name is ignored though it is a good idea to name it something like Texts for consistency.
Unless otherwise stated, language ID for these texts are considered to be the invariant language (empty string).
It has two optional attributes, LanguageID and Prefix.
LanguageID allows you to define what language translations are in.
If we used it like:
Prefix attribute value is used as a prefix for local text keys:
NestedLocalTextRegistration Class
[namespace: Serenity.Localization, assembly: Serenity.Core]
For nested local text definitions to be registered, you need to call NestedLocalTextRegistration.Initialize() method in your application start:
CommonInitialization.Run and CommonInitialization.InitializeLocalTexts methods call it by default.
Once it is run, all translations with auto generated keys are added to current ILocalTextRegistry provider and LocalText instances in nested static classes are replaced with actual LocalText instances containing generated keys (they are set through reflection).