Localization
We divide localization into the following three types:
- Localization of content (not yet available)
- Localization of the Confinity author area
- Localization of the host application
Localization of content
This feature is not yet finished. Read about the current state in Content Localization
Localization of the Confinity author area
The author area is available in multiple languages. When you create new functionality for authors, like a form for ConfinityContent or an Entity App, you can provide all your texts in multiple languages. To accomplish this, we use the .NET localization APIs.
Register your translations
Follow these steps to translate your strings for the author area.
- In your project create a new directory with the name
Resources. - Create a new
*.resxfile inside this directory. Your IDE might assist you and should create a*.Designer.csfile. - With the resource manager of your IDE, you can now add new translations.
- Now you can register either all translations of a
ResouceManageror add a single translation using the Module API (IModuleConfiguration) from Confinity.
public void AddModule(IModuleContext module)
{
module.Translation.AddAll(MyTestResources.ResourceManager);
module.Translation.Add(CultureInfo.GetCultureInfo("DE-CH"), "Hello", "Grüezi");
}
Localization of the host application
If you know the ResouceManager that contains the translation, use the
.NET localization APIs for this. Otherwise, you can inject the Confinity.Localization.ITranslationManager and use it to get all registered translations (including translations defined by Confinity).
public string GetGreeting()
{
return _translationManager.GetText("Hello", CultureInfo.GetCultureInfo("DE-CH"));
}