Exemplo n.º 1
0
        public void Setup()
        {
            SetupBackend();

            var translator = new DefaultTranslator(_backend);

            _i18Next = new I18NextNet(_backend, translator);
        }
Exemplo n.º 2
0
        public II18Next CreateInstance()
        {
            var instance = new I18NextNet(_backend, _translator, _languageDetector)
            {
                Language         = _options.Value.DefaultLanguage,
                DefaultNamespace = _options.Value.DefaultNamespace,
                Logger           = _logger,
                DetectLanguageOnEachTranslation = _options.Value.DetectLanguageOnEachTranslation
            };

            instance.SetFallbackLanguages(_options.Value.FallbackLanguages.ToArray());

            return(instance);
        }
Exemplo n.º 3
0
        private static void SampleOne()
        {
            Console.WriteLine("Sample one: Without Microsoft.Extensions.DependencyInjection");

            var translator = new DefaultTranslator(_backend);

            var i18next = new I18NextNet(_backend, translator);

            Console.WriteLine("English translation:");
            i18next.Language = "en";
            Console.WriteLine(i18next.T("exampleKey"));

            Console.WriteLine("German translation:");
            i18next.Language = "de";
            Console.WriteLine(i18next.T("exampleKey"));

            Console.WriteLine();
        }
Exemplo n.º 4
0
        public static void Main(string[] args)
        {
            SetupBackend();

            var translator = new DefaultTranslator(_backend);

            var i18next = new I18NextNet(_backend, translator);

            Console.WriteLine("English translation:");
            i18next.Language = "en";
            Console.WriteLine(i18next.T("exampleKey"));

            Console.WriteLine("German translation:");
            i18next.Language = "de";
            Console.WriteLine(i18next.T("exampleKey"));

            Console.ReadKey();
        }
Exemplo n.º 5
0
        public static void Main(string[] args)
        {
            SetupBackend();

            var translator = new DefaultTranslator(_backend);

            var i18Next = new I18NextNet(_backend, translator);

            Console.WriteLine("English translation:");
            i18Next.Language = "en";
            Console.WriteLine(i18Next.T("exampleKey"));

            Console.WriteLine("German translation:");
            i18Next.Language = "de";
            Console.WriteLine(i18Next.T("exampleKey"));

            i18Next.SetFallbackLanguages("en");
            Console.WriteLine(i18Next.T("exampleKey2")); // should output "My English text." because of fallback language

            Console.ReadKey();
        }
        public I18NextStringLocalizer(I18NextNet instance, string defaultNamespace)
        {
            _instance = instance;

            _defaultNamespace = defaultNamespace;
        }