Exemplo n.º 1
0
        private static void RegisterTranslationAccessor(this II18NServiceCollection services)
        {
            var tagFactory = new DefaultLanguageTagFactory(LanguageTag.Current.ToString);

            services.AddDependency(register => register.AddSingleton <ICoreScopedLanguageTagFactory>(tagFactory));
            services.AddDependency(register => register.AddScoped <ITranslationAccessor, DefaultTranslationAccessor>());
        }
Exemplo n.º 2
0
 private static void RegisterTranslationProviders(this II18NServiceCollection services)
 {
     services.AddDependency(s => {
         s.AddSingleton <ITextProvider, TextProvider>();
         s.AddSingleton <ILanguageServiceProvider, ConsoleLanguageServiceProvider>();
     });
 }
 public static void AppendOrOverride(this II18NServiceCollection services)
 {
     services.AddDependency(s => {
         s.AddSingleton <ICoreScopedLanguageTagFactory, HostedLanguageTagFactory>();
         s.AddScoped <IRequestedLanguageTagAccessor, RequestedLanguageTagAccessor>();
     });
 }
Exemplo n.º 4
0
        private static void RegisterAllPackages(this II18NServiceCollection services, I18NOptions options)
        {
            var translationManager = new TranslationManager();
            var translationSetter  = (ITranslationManSetter)translationManager;

            foreach (var package in options.TranslationPackages)
            {
                var translationPackage = package.Value;
                translationSetter.RegisterPackage(translationPackage);
                services.AddDependency(register => register.AddSingleton(translationPackage));
            }


            services.AddDependency(register => register.AddSingleton(translationManager));
            services.AddDependency(register => register.AddSingleton <ITranslationManager>(translationManager));
        }
Exemplo n.º 5
0
        private static void RegisterAllPackages(this II18NServiceCollection services)
        {
            var translationManager = services.ExposeTranslationManager;
            var translationSetter  = (ITranslationManSetter)translationManager;

            foreach (var package in services.ExposeOptions.TranslationPackages)
            {
                var translationPackage = package.Value;
                translationSetter.RegisterPackage(translationPackage);
                services.AddDependency(s => s.AddSingleton(translationPackage));
            }

            services.AddDependency(s => {
                s.AddSingleton(translationManager);
                s.AddSingleton <ITranslationManager>(translationManager);
            });
        }
Exemplo n.º 6
0
 private static void RegisterTranslationProcessor(this II18NServiceCollection services)
 {
     services.AddDependency(s => s.AddSingleton <TranslationProcessor>());
 }
Exemplo n.º 7
0
 private static void RegisterTranslationProviders(this II18NServiceCollection services)
 {
     services.AddDependency(register => register.AddSingleton <ITextProvider, TextProvider>());
     services.AddDependency(register => register.AddSingleton <ILanguageServiceProvider, AspectCoreLanguageServiceProvider>());
 }