multilingual in asp core

0

I'm using Globalization and location in asp core to be able to translate the texts, until here I managed to make it work, but my doubt is, if it is possible to direct the text path to the database, in this case Globalization and Asp core location use the resource to get the texts in the .resx files, I wanted to get the texts directly from my database (I already have the table with the text and the translations).

Follow the code below:

Class Startup:

services.AddMvc()
                .AddXmlSerializerFormatters()
                .AddViewLocalization(
                    LanguageViewLocationExpanderFormat.Suffix,
                    opts => { opts.ResourcesPath = "Resources"; });
services.AddLocalization(options => options.ResourcesPath = "Resources");

        services.Configure<RequestLocalizationOptions>(options =>
        {
            var supportedCultures = new[]
            {
                 new CultureInfo("en-US"),
                 new CultureInfo("pt-BR")
            };

            options.DefaultRequestCulture = new RequestCulture(culture: "en-US", uiCulture: "en-US");
            options.SupportedCultures = supportedCultures;
            options.SupportedUICultures = supportedCultures;

        });

 var options = app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>();
            app.UseRequestLocalization(options.Value);

Controller Login:

 public IActionResult Login()
    {

        ViewData["email"] = _localizer["chave"];
        ViewData["PortalAprendizagem"] = _localizer["PortalAprendizagem"];
        ViewData["senha"] = _localizer["senha"];
        ViewData["Logar"] = _localizer["logar"];

        return View();
    }

.resx file

    
asked by anonymous 12.06.2018 / 17:48

0 answers