public static class RunicViewsTranslationsServiceCollectionExtensions Registers Runic's own English and German text (RunicViewsTranslations).
Methods
AddRunicViewsTranslations
public static IServiceCollection AddRunicViewsTranslations(this IServiceCollection services) Adds the runic-views catalog to the application's Translations context (Runic.Translations.Hosting), gives the built-in validation attributes its text (RunicValidationOptions.TextFor), and keeps DesktopPlatformTexts.Current in the application's locale from the first window on.
Parameters
servicesThe application's services.
Returns
services.
Exceptions
ArgumentNullExceptionservicesisnull.
Remarks
The catalog switches with the application's: let the context follow the application's locale, as for any catalog (locale.Follow(services.GetRequiredService<ITranslationContext>().SetLocaleAsync)). Calling this more than once registers once.
A RunicValidationOptions that the application registers itself wins; give it RunicViewsTranslations.ValidationText as the last TextFor. The platform texts are process-wide: with a singleton context, the Runic.Translations.Hosting default, they follow it. With a scoped context (options.Lifetime = ServiceLifetime.Scoped), a context per window or request, they follow an application-wide context of their own from ITranslationContextFactory, which follows IRunicApplicationLocale. A text the platform refuses is logged as event 1260 PlatformTextsRejected (category Runic.Application.Views.Translations) and the previous texts stay.
The catalog has English and German, and ITranslationContext.SupportedLocales lists the locales every catalog has, so with this package it lists at most en and de. When the application's catalogs have locales that this catalog lacks, the first window logs them as event 1261 LocalesWithoutRunicViewsText; an override file per locale (translations/overrides/runic-views/<locale>.rmf2) adds them.