Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

InstallationLocalizedService - remove IHttpContextAccessor

KrzysztofPajak79af2ba35873
diff --git a/src/Business/Grand.Business.System/Interfaces/Installation/IInstallationLocalizedService.cs b/src/Business/Grand.Business.System/Interfaces/Installation/IInstallationLocalizedService.cs
index dede77f1d..e59fd7e54 100644
--- a/src/Business/Grand.Business.System/Interfaces/Installation/IInstallationLocalizedService.cs
+++ b/src/Business/Grand.Business.System/Interfaces/Installation/IInstallationLocalizedService.cs
@@ -11,21 +11,17 @@ namespace Grand.Business.System.Interfaces.Installation
/// <summary>
/// Get locale resource value
/// </summary>
+ /// <param name="languageCode">Language code</param>
/// <param name="resourceName">Resource name</param>
/// <returns>Resource value</returns>
- string GetResource(string resourceName);
+ string GetResource(string languageCode, string resourceName);
/// <summary>
/// Get current language for the installation page
/// </summary>
/// <returns>Current language</returns>
- InstallationLanguage GetCurrentLanguage();
-
- /// <summary>
- /// Save a language for the installation page
- /// </summary>
- /// <param name="languageCode">Language code</param>
- void SaveCurrentLanguage(string languageCode);
+ /// <param name="languageCode">Language Code</param>
+ InstallationLanguage GetCurrentLanguage(string languageCode = default);
/// <summary>
/// Get a list of available languages
diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallationLocalizedService.cs b/src/Business/Grand.Business.System/Services/Installation/InstallationLocalizedService.cs
index 5282c6bb1..a7c689d92 100644
--- a/src/Business/Grand.Business.System/Services/Installation/InstallationLocalizedService.cs
+++ b/src/Business/Grand.Business.System/Services/Installation/InstallationLocalizedService.cs
@@ -1,9 +1,6 @@
using Grand.Business.System.Interfaces.Installation;
using Grand.Business.System.Utilities;
-using Grand.Infrastructure.Extensions;
-using Grand.SharedKernel;
using Grand.SharedKernel.Extensions;
-using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.IO;
@@ -18,11 +15,6 @@ namespace Grand.Business.System.Services.Installation
/// </summary>
public partial class InstallationLocalizedService : IInstallationLocalizedService
{
- /// <summary>
- /// Cookie name to language for the installation page
- /// </summary>
- private const string LANGUAGE_COOKIE_NAME = ".Grand.installation.lang";
-
/// <summary>
/// Available languages
/// </summary>
@@ -33,27 +25,28 @@ namespace Grand.Business.System.Services.Installation
/// </summary>
private IList<InstallationCollation> _availableCollation;
- private readonly IHttpContextAccessor _httpContextAccessor;
- public InstallationLocalizedService(IHttpContextAccessor httpContextAccessor)
+ public InstallationLocalizedService()
{
- _httpContextAccessor = httpContextAccessor;
+
}
/// <summary>
/// Get locale resource value
/// </summary>
+ /// <param name="languageCode">Language code</param>
/// <param name="resourceName">Resource name</param>
/// <returns>Resource value</returns>
- public string GetResource(string resourceName)
+ public string GetResource(string languageCode, string resourceName)
{
- var language = GetCurrentLanguage();
+ var language = GetCurrentLanguage(languageCode);
if (language == null)
return resourceName;
var resourceValue = language.Resources
.Where(r => r.Name.Equals(resourceName, StringComparison.OrdinalIgnoreCase))
.Select(r => r.Value)
.FirstOrDefault();
- if (String.IsNullOrEmpty(resourceValue))
+
+ if (string.IsNullOrEmpty(resourceValue))
//return name
return resourceName;
@@ -64,36 +57,20 @@ namespace Grand.Business.System.Services.Installation
/// Get current language for the installation page
/// </summary>
/// <returns>Current language</returns>
- public virtual InstallationLanguage GetCurrentLanguage()
+ /// <param name="languageCode">Language Code</param>
+ public virtual InstallationLanguage GetCurrentLanguage(string languageCode = default)
{
- var httpContext = _httpContextAccessor.HttpContext;
- //try to get cookie
- httpContext.Request.Cookies.TryGetValue(LANGUAGE_COOKIE_NAME, out string cookieLanguageCode);
-
- //ensure it's available (it could be delete since the previous installation)
var availableLanguages = GetAvailableLanguages();
-
- var language = availableLanguages
- .FirstOrDefault(l => l.Code.Equals(cookieLanguageCode, StringComparison.OrdinalIgnoreCase));
- if (language != null)
- return language;
-
- //find by current browser culture
- if (httpContext.Request.Headers.TryGetValue("Accept-Language", out var userLanguages))
+ if(!string.IsNullOrEmpty(languageCode))
{
- var userLanguage = userLanguages.FirstOrDefault().Return(l => l.Split(',')[0], string.Empty);
- if (!string.IsNullOrEmpty(userLanguage))
- {
- //right. we do "StartsWith" (not "Equals") because we have shorten codes (not full culture names)
- language = availableLanguages.FirstOrDefault(l => userLanguage.StartsWith(l.Code, StringComparison.OrdinalIgnoreCase));
- }
+ var selectedlanguage = availableLanguages
+ .FirstOrDefault(l => l.Code.Equals(languageCode, StringComparison.OrdinalIgnoreCase));
+ if (selectedlanguage != null)
+ return selectedlanguage;
}
- if (language != null)
- return language;
-
//return the default one
- language = availableLanguages.FirstOrDefault(l => l.IsDefault);
+ var language = availableLanguages.FirstOrDefault(l => l.IsDefault);
if (language != null)
return language;
@@ -102,23 +79,6 @@ namespace Grand.Business.System.Services.Installation
return language;
}
- /// <summary>
- /// Save a language for the installation page
- /// </summary>
- /// <param name="languageCode">Language code</param>
- public virtual void SaveCurrentLanguage(string languageCode)
- {
- var httpContext = _httpContextAccessor.HttpContext;
-
- var cookieOptions = new CookieOptions
- {
- Expires = DateTime.Now.AddHours(24),
- HttpOnly = true
- };
- httpContext.Response.Cookies.Delete(LANGUAGE_COOKIE_NAME);
- httpContext.Response.Cookies.Append(LANGUAGE_COOKIE_NAME, languageCode, cookieOptions);
- }
-
/// <summary>
/// Get a list of available languages
/// </summary>
@@ -157,8 +117,7 @@ namespace Grand.Business.System.Services.Installation
var isRightToLeft = isRightToLeftAttribute != null && Convert.ToBoolean(isRightToLeftAttribute.InnerText.Trim());
//create language
- var language = new InstallationLanguage
- {
+ var language = new InstallationLanguage {
Code = languageCode,
Name = languageName,
IsDefault = isDefault,
@@ -187,8 +146,7 @@ namespace Grand.Business.System.Services.Installation
continue;
var resourceValue = resValueNode.InnerText.Trim();
- language.Resources.Add(new InstallationLocaleResource
- {
+ language.Resources.Add(new InstallationLocaleResource {
Name = resourceName,
Value = resourceValue
});
@@ -225,8 +183,7 @@ namespace Grand.Business.System.Services.Installation
var resourceName = resNameAttribute.Value.Trim();
var resourceValue = resValueNode.InnerText.Trim();
- _availableCollation.Add(new InstallationCollation()
- {
+ _availableCollation.Add(new InstallationCollation() {
Name = resourceName,
Value = resourceValue,
});
diff --git a/src/Web/Grand.Web/Controllers/InstallController.cs b/src/Web/Grand.Web/Controllers/InstallController.cs
index 00711dab3..90cb46e7c 100644
--- a/src/Web/Grand.Web/Controllers/InstallController.cs
+++ b/src/Web/Grand.Web/Controllers/InstallController.cs
@@ -6,11 +6,13 @@ using Grand.Business.System.Interfaces.Installation;
using Grand.Domain.Data;
using Grand.Domain.Data.Mongo;
using Grand.Infrastructure.Caching;
+using Grand.Infrastructure.Extensions;
using Grand.Infrastructure.Migrations;
using Grand.Infrastructure.Plugins;
using Grand.SharedKernel.Extensions;
using Grand.Web.Models.Install;
using MediatR;
+using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.Extensions.DependencyInjection;
@@ -31,6 +33,11 @@ namespace Grand.Web.Controllers
private readonly IHostApplicationLifetime _applicationLifetime;
private readonly IMediator _mediator;
+ /// <summary>
+ /// Cookie name to language for the installation page
+ /// </summary>
+ private const string LANGUAGE_COOKIE_NAME = ".Grand.installation.lang";
+
#endregion
#region Ctor
@@ -51,18 +58,30 @@ namespace Grand.Web.Controllers
#region Methods
- public virtual async Task<IActionResult> Index()
+ protected virtual string GetLanguage()
{
- if (DataSettingsManager.DatabaseIsInstalled())
- return RedirectToRoute("HomePage");
+ HttpContext.Request.Cookies.TryGetValue(LANGUAGE_COOKIE_NAME, out var language);
- var locService = _serviceProvider.GetRequiredService<IInstallationLocalizedService>();
+ if(string.IsNullOrEmpty(language))
+ {
+ //find by current browser culture
+ if (HttpContext.Request.Headers.TryGetValue("Accept-Language", out var userLanguages))
+ {
+ var userLanguage = userLanguages.FirstOrDefault().Return(l => l.Split(',')[0], string.Empty);
+ if (!string.IsNullOrEmpty(userLanguage))
+ {
+ return userLanguage;
+ }
+ }
+ }
- var installed = await _cacheBase.GetAsync("Installed", async () => { return await Task.FromResult(false); });
- if (installed)
- return View(new InstallModel() { Installed = true });
+ return language;
+ }
+ protected InstallModel PrepareModel(InstallModel model)
+ {
+ var locService = _serviceProvider.GetRequiredService<IInstallationLocalizedService>();
- var model = new InstallModel {
+ model ??= new InstallModel {
AdminEmail = "[email protected]",
InstallSampleData = false,
DatabaseConnectionString = "",
@@ -73,12 +92,21 @@ namespace Grand.Web.Controllers
Value = ((int)v).ToString()
}).ToList();
+ model.SelectedLanguage = GetLanguage();
+
foreach (var lang in locService.GetAvailableLanguages())
{
+ var selected = false;
+ if (locService.GetCurrentLanguage(model.SelectedLanguage).Code == lang.Code)
+ {
+ selected = true;
+ model.SelectedLanguage = lang.Code;
+ }
+
model.AvailableLanguages.Add(new SelectListItem {
Value = Url.RouteUrl("InstallChangeLanguage", new { language = lang.Code }),
Text = lang.Name,
- Selected = locService.GetCurrentLanguage().Code == lang.Code,
+ Selected = selected,
});
}
//prepare collation list
@@ -90,59 +118,60 @@ namespace Grand.Web.Controllers
Selected = locService.GetCurrentLanguage().Code == col.Value,
});
}
- return View(model);
+
+ return model;
}
- [HttpPost]
- public virtual async Task<IActionResult> Index(InstallModel model)
+ public virtual async Task<IActionResult> Index()
{
if (DataSettingsManager.DatabaseIsInstalled())
return RedirectToRoute("HomePage");
var locService = _serviceProvider.GetRequiredService<IInstallationLocalizedService>();
- if (model.DatabaseConnectionString != null)
- model.DatabaseConnectionString = model.DatabaseConnectionString.Trim();
+ var installed = await _cacheBase.GetAsync("Installed", async () => { return await Task.FromResult(false); });
+ if (installed)
+ return View(new InstallModel() { Installed = true });
- string connectionString = "";
+ return View(PrepareModel(null));
+ }
+
+ protected string BuildConnectionString(IInstallationLocalizedService locService, InstallModel model)
+ {
+ var connectionString = "";
if (model.ConnectionInfo)
{
- if (String.IsNullOrEmpty(model.DatabaseConnectionString))
- {
- ModelState.AddModelError("", locService.GetResource("ConnectionStringRequired"));
- }
+ if (string.IsNullOrEmpty(model.DatabaseConnectionString))
+ ModelState.AddModelError("", locService.GetResource(model.SelectedLanguage, "ConnectionStringRequired"));
else
- {
connectionString = model.DatabaseConnectionString;
- }
}
else
{
- if (String.IsNullOrEmpty(model.MongoDBDatabaseName))
- {
- ModelState.AddModelError("", locService.GetResource("DatabaseNameRequired"));
- }
- if (String.IsNullOrEmpty(model.MongoDBServerName))
- {
- ModelState.AddModelError("", locService.GetResource("MongoDBServerNameRequired"));
- }
- string userNameandPassword = "";
- if (!(String.IsNullOrEmpty(model.MongoDBUsername)))
- {
+ if (string.IsNullOrEmpty(model.MongoDBDatabaseName))
+ ModelState.AddModelError("", locService.GetResource(model.SelectedLanguage, "DatabaseNameRequired"));
+ if (string.IsNullOrEmpty(model.MongoDBServerName))
+ ModelState.AddModelError("", locService.GetResource(model.SelectedLanguage, "MongoDBServerNameRequired"));
+
+ var userNameandPassword = "";
+ if (!(string.IsNullOrEmpty(model.MongoDBUsername)))
userNameandPassword = model.MongoDBUsername + ":" + model.MongoDBPassword + "@";
- }
connectionString = "mongodb://" + userNameandPassword + model.MongoDBServerName + "/" + model.MongoDBDatabaseName;
}
+ return connectionString;
+ }
- if (!string.IsNullOrEmpty(connectionString))
+ protected async Task CheckConnectionString(IInstallationLocalizedService locService, string connectionString, InstallModel model)
+ {
+ if (ModelState.IsValid && !string.IsNullOrEmpty(connectionString))
{
try
{
var mdb = new MongoDBContext();
if (await mdb.DatabaseExist(connectionString))
- ModelState.AddModelError("", locService.GetResource("AlreadyInstalled"));
+ ModelState.AddModelError("", locService.GetResource(model.SelectedLanguage, "AlreadyInstalled"));
}
catch (Exception ex)
{
@@ -150,7 +179,24 @@ namespace Grand.Web.Controllers
}
}
else
- ModelState.AddModelError("", locService.GetResource("ConnectionStringRequired"));
+ ModelState.AddModelError("", locService.GetResource(model.SelectedLanguage, "ConnectionStringRequired"));
+
+ }
+
+ [HttpPost]
+ public virtual async Task<IActionResult> Index(InstallModel model)
+ {
+ if (DataSettingsManager.DatabaseIsInstalled())
+ return RedirectToRoute("HomePage");
+
+ var locService = _serviceProvider.GetRequiredService<IInstallationLocalizedService>();
+
+ if (model.DatabaseConnectionString != null)
+ model.DatabaseConnectionString = model.DatabaseConnectionString.Trim();
+
+ var connectionString = BuildConnectionString(locService, model);
+
+ await CheckConnectionString(locService, connectionString, model);
if (ModelState.IsValid)
{
@@ -214,36 +260,10 @@ namespace Grand.Web.Controllers
System.IO.File.Delete(CommonPath.SettingsPath);
- ModelState.AddModelError("", string.Format(locService.GetResource("SetupFailed"), exception.Message + " " + exception.InnerException?.Message));
+ ModelState.AddModelError("", string.Format(locService.GetResource(model.SelectedLanguage, "SetupFailed"), exception.Message + " " + exception.InnerException?.Message));
}
}
- //prepare db providers
- model.AvailableProviders = Enum.GetValues(typeof(DbProvider)).Cast<DbProvider>().Select(v => new SelectListItem {
- Text = v.ToString(),
- Value = ((int)v).ToString()
- }).ToList();
-
- //prepare language list
- foreach (var lang in locService.GetAvailableLanguages())
- {
- model.AvailableLanguages.Add(new SelectListItem {
- Value = Url.RouteUrl("InstallChangeLanguage", new { language = lang.Code }),
- Text = lang.Name,
- Selected = locService.GetCurrentLanguage().Code == lang.Code,
- });
- }
-
- //prepare collation list
- foreach (var col in locService.GetAvailableCollations())
- {
- model.AvailableCollation.Add(new SelectListItem {
- Value = col.Value,
- Text = col.Name,
- Selected = locService.GetCurrentLanguage().Code == col.Value,
- });
- }
-
- return View(model);
+ return View(PrepareModel(model));
}
public virtual IActionResult ChangeLanguage(string language)
@@ -251,8 +271,13 @@ namespace Grand.Web.Controllers
if (DataSettingsManager.DatabaseIsInstalled())
return RedirectToRoute("HomePage");
- var locService = _serviceProvider.GetRequiredService<IInstallationLocalizedService>();
- locService.SaveCurrentLanguage(language);
+ var cookieOptions = new CookieOptions {
+ Expires = DateTime.Now.AddHours(24),
+ HttpOnly = true
+ };
+
+ HttpContext.Response.Cookies.Delete(LANGUAGE_COOKIE_NAME);
+ HttpContext.Response.Cookies.Append(LANGUAGE_COOKIE_NAME, language, cookieOptions);
//Reload the page
return RedirectToAction("Index", "Install");
diff --git a/src/Web/Grand.Web/Models/Install/InstallModel.cs b/src/Web/Grand.Web/Models/Install/InstallModel.cs
index e5231a754..4e529dcbb 100644
--- a/src/Web/Grand.Web/Models/Install/InstallModel.cs
+++ b/src/Web/Grand.Web/Models/Install/InstallModel.cs
@@ -14,6 +14,8 @@ namespace Grand.Web.Models.Install
AvailableCollation = new List<SelectListItem>();
AvailableProviders = new List<SelectListItem>();
}
+ public string SelectedLanguage { get; set; }
+
[DataType(DataType.EmailAddress)]
public string AdminEmail { get; set; }
[DataType(DataType.Password)]
diff --git a/src/Web/Grand.Web/Validators/Install/InstallValidator.cs b/src/Web/Grand.Web/Validators/Install/InstallValidator.cs
index 5bde4bf68..bef4498c0 100644
--- a/src/Web/Grand.Web/Validators/Install/InstallValidator.cs
+++ b/src/Web/Grand.Web/Validators/Install/InstallValidator.cs
@@ -1,5 +1,4 @@
using FluentValidation;
-using Grand.Business.System.Interfaces.Installation;
using Grand.Infrastructure.Validators;
using Grand.Web.Models.Install;
using System.Collections.Generic;
@@ -9,16 +8,14 @@ namespace Grand.Web.Validators.Install
public class InstallValidator : BaseGrandValidator<InstallModel>
{
public InstallValidator(
- IEnumerable<IValidatorConsumer<InstallModel>> validators,
- IInstallationLocalizedService locService)
+ IEnumerable<IValidatorConsumer<InstallModel>> validators)
: base(validators)
{
- RuleFor(x => x.AdminEmail).NotEmpty().WithMessage(locService.GetResource("AdminEmailRequired"));
+ RuleFor(x => x.AdminEmail).NotEmpty();
RuleFor(x => x.AdminEmail).EmailAddress();
- RuleFor(x => x.AdminPassword).NotEmpty().WithMessage(locService.GetResource("AdminPasswordRequired"));
- RuleFor(x => x.ConfirmPassword).NotEmpty().WithMessage(locService.GetResource("ConfirmPasswordRequired"));
- RuleFor(x => x.AdminPassword).Equal(x => x.ConfirmPassword).WithMessage(locService.GetResource("PasswordsDoNotMatch"));
-
+ RuleFor(x => x.AdminPassword).NotEmpty();
+ RuleFor(x => x.ConfirmPassword).NotEmpty();
+ RuleFor(x => x.AdminPassword).Equal(x => x.ConfirmPassword);
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web/Views/Install/Index.cshtml b/src/Web/Grand.Web/Views/Install/Index.cshtml
index 8935edd64..90709d1e0 100644
--- a/src/Web/Grand.Web/Views/Install/Index.cshtml
+++ b/src/Web/Grand.Web/Views/Install/Index.cshtml
@@ -8,7 +8,7 @@
<!DOCTYPE html>
<html>
<head>
- <title>@LocalizedService.GetResource("Title")</title>
+ <title>@LocalizedService.GetResource(Model.SelectedLanguage, "Title")</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<link href="@Url.Content("~/assets/install/style.css")" type="text/css" rel="stylesheet">
@@ -26,7 +26,7 @@
<div class="col-xl-7 col-lg-6 col-md-12">
<div class="row">
<div class="col-md">
- <h1 class="generalTitle">@LocalizedService.GetResource("Title")</h1>
+ <h1 class="generalTitle">@LocalizedService.GetResource(Model.SelectedLanguage, "Title")</h1>
</div>
<div class="col-md-3 col-5 pt-3">
@Html.DropDownList("language", Model.AvailableLanguages, new { @class = "custom-select", onchange = "window.location.href = this.value;" })
@@ -36,7 +36,7 @@
</div>
<div class="content">
<p>
- @LocalizedService.GetResource("Tooltip2")
+ @LocalizedService.GetResource(Model.SelectedLanguage, "Tooltip2")
<div style="color: Red;">
@Html.ValidationSummary(false)
</div>
@@ -47,20 +47,20 @@
</div>
<div class="card">
<h3 class="card-header">
- @LocalizedService.GetResource("CompanyInformation")
+ @LocalizedService.GetResource(Model.SelectedLanguage, "CompanyInformation")
</h3>
<div class="card-body">
<div class="row">
<div class="col-md-6 col-12">
<label for="AdminPassword">
- @LocalizedService.GetResource("CompanyName"):
+ @LocalizedService.GetResource(Model.SelectedLanguage, "CompanyName"):
</label>
<input asp-for="CompanyName" class="form-control" />
</div>
<div class="col-md-6">
<label for="ConfirmPassword">
- @LocalizedService.GetResource("CompanyAddress"):
+ @LocalizedService.GetResource(Model.SelectedLanguage, "CompanyAddress"):
</label>
<input asp-for="CompanyAddress" class="form-control" />
</div>
@@ -68,13 +68,13 @@
<div class="row">
<div class="col-md-6 col-12">
<label for="AdminPassword">
- @LocalizedService.GetResource("CompanyPhoneNumber"):
+ @LocalizedService.GetResource(Model.SelectedLanguage, "CompanyPhoneNumber"):
</label>
<input asp-for="CompanyPhoneNumber" class="form-control" />
</div>
<div class="col-md-6">
<label for="ConfirmPassword">
- @LocalizedService.GetResource("CompanyEmail"):
+ @LocalizedService.GetResource(Model.SelectedLanguage, "CompanyEmail"):
</label>
<input asp-for="CompanyEmail" class="form-control" />
</div>
@@ -83,23 +83,23 @@
</div>
<div class="card">
<h3 class="card-header">
- @LocalizedService.GetResource("StoreInformation")
+ @LocalizedService.GetResource(Model.SelectedLanguage, "StoreInformation")
</h3>
<div class="card-body">
<label for="AdminEmail" class="col-form-label">
- @LocalizedService.GetResource("AdminEmail"):
+ @LocalizedService.GetResource(Model.SelectedLanguage, "AdminEmail"):
</label>
<input asp-for="AdminEmail" class="form-control" required />
<div class="row">
<div class="col-md-6 col-12">
<label for="AdminPassword">
- @LocalizedService.GetResource("AdminPassword"):
+ @LocalizedService.GetResource(Model.SelectedLanguage, "AdminPassword"):
</label>
<input asp-for="AdminPassword" class="form-control password" required />
</div>
<div class="col-md-6">
<label for="ConfirmPassword">
- @LocalizedService.GetResource("ConfirmPassword"):
+ @LocalizedService.GetResource(Model.SelectedLanguage, "ConfirmPassword"):
</label>
<input asp-for="ConfirmPassword" class="form-control password" required />
</div>
@@ -108,7 +108,7 @@
</div>
<div class="card">
<h3 class="card-header">
- @LocalizedService.GetResource("DataProvider")
+ @LocalizedService.GetResource(Model.SelectedLanguage, "DataProvider")
</h3>
<div class="card-body">
@Html.DropDownList("DataProvider", Model.AvailableProviders, new { @class = "custom-select", onchange = "DataProviderChange(this.value);" })
@@ -120,7 +120,7 @@
<label class="custom-control custom-checkbox my-3">
<input asp-for="InstallSampleData" class="custom-control-input" />
<span class="custom-control-label"></span>
- <span class="custom-control-description">@LocalizedService.GetResource("CreateSampleData")</span>
+ <span class="custom-control-description">@LocalizedService.GetResource(Model.SelectedLanguage, "CreateSampleData")</span>
</label>
</div>
}
@@ -128,23 +128,23 @@
<div id="DBSampleData">
<div class="card">
<h3 class="card-header">
- @LocalizedService.GetResource("DatabaseInformation")
+ @LocalizedService.GetResource(Model.SelectedLanguage, "DatabaseInformation")
</h3>
<div class="card-body">
<label for="MongoDBServerName">
- @LocalizedService.GetResource("MongoDBServerName"):
+ @LocalizedService.GetResource(Model.SelectedLanguage, "MongoDBServerName"):
</label>
<input asp-for="MongoDBServerName" class="form-control" />
<div class="row mongoDBDatabaseName">
<div class="col-6">
<label for="MongoDBDatabaseName">
- @LocalizedService.GetResource("DatabaseName"):
+ @LocalizedService.GetResource(Model.SelectedLanguage, "DatabaseName"):
</label>
<input asp-for="MongoDBDatabaseName" class="form-control" />
</div>
<div class="col-6 collation" id="collation">
<label for="Collation">
- @LocalizedService.GetResource("Collation"):
+ @LocalizedService.GetResource(Model.SelectedLanguage, "Collation"):
</label>
@Html.DropDownList("Collation", Model.AvailableCollation, new { @class = "custom-select" })
</div>
@@ -152,13 +152,13 @@
<div class="row">
<div class="col-6">
<label for="MongoDBUsername">
- @LocalizedService.GetResource("MongoDBUsername"):
+ @LocalizedService.GetResource(Model.SelectedLanguage, "MongoDBUsername"):
</label>
<input asp-for="MongoDBUsername" class="form-control" />
</div>
<div class="col-6">
<label for="MongoDBPassword">
- @LocalizedService.GetResource("MongoDBPassword"):
+ @LocalizedService.GetResource(Model.SelectedLanguage, "MongoDBPassword"):
</label>
<input asp-for="MongoDBPassword" class="form-control password" />
</div>
@@ -171,14 +171,14 @@
<label class="custom-control custom-checkbox my-3">
<input asp-for="ConnectionInfo" onchange="toggleMongoDBConnectionInfo()" class="custom-control-input" />
<span class="custom-control-label"></span>
- <span class="custom-control-description">@LocalizedService.GetResource("ConnectionString"):</span>
+ <span class="custom-control-description">@LocalizedService.GetResource(Model.SelectedLanguage, "ConnectionString"):</span>
</label>
<div id="DatabaseConnectionString" class="connection-string-container" style="display:none;">
<span style="white-space: nowrap;">
<input asp-for="DatabaseConnectionString" class="textbox form-control" />
</span>
<span class="hint">
- @LocalizedService.GetResource("Example"):<br />
+ @LocalizedService.GetResource(Model.SelectedLanguage, "Example"):<br />
For MongoDB: @Html.Raw("mongodb://[username:password@]host1[:port1]/databaseName")
(Find more info <a href="https://docs.mongodb.org/manual/reference/connection-string/" target="_blank">here</a>)
</span>
@@ -186,14 +186,14 @@
</section>
<div class="row">
<div class="col-12">
- @LocalizedService.GetResource("Documentation1") <a href="https://docs.grandnode.com/" target="_blank">@LocalizedService.GetResource("Documentation2")</a>.
+ @LocalizedService.GetResource(Model.SelectedLanguage, "Documentation1") <a href="https://docs.grandnode.com/" target="_blank">@LocalizedService.GetResource(Model.SelectedLanguage, "Documentation2")</a>.
</div>
<div class="col-6 text-left">
- <input class="btn btn-success" type="button" id="installation" name="installation" value="@LocalizedService.GetResource("Install")" style="width: 100px;" />
+ <input class="btn btn-success" type="button" id="installation" name="installation" value="@LocalizedService.GetResource(Model.SelectedLanguage, "Install")" style="width: 100px;" />
</div>
<div class="col-6 text-right">
- <a class="btn btn-secondary" href="@Url.Action("RestartInstall", "Install")" title="@LocalizedService.GetResource("RestartInstallationTooltip")">
- @LocalizedService.GetResource("RestartInstallation")
+ <a class="btn btn-secondary" href="@Url.Action("RestartInstall", "Install")" title="@LocalizedService.GetResource(Model.SelectedLanguage, "RestartInstallationTooltip")">
+ @LocalizedService.GetResource(Model.SelectedLanguage, "RestartInstallation")
</a>
</div>
</div>
@@ -202,7 +202,7 @@
</div>
<div class="curtain-content">
<div>
- <h1 class="throbber-header">@LocalizedService.GetResource("Installing")</h1>
+ <h1 class="throbber-header">@LocalizedService.GetResource(Model.SelectedLanguage, "Installing")</h1>
<div class="spinner active">
<svg style="width:100px; height:100px" viewBox="0 0 64 64">
<circle cx="32" cy="32" r="29" fill="none" stroke-width="3" stroke-miterlimit="10"></circle>
@@ -223,14 +223,14 @@
<div class="col-12">
<div class="row">
<div class="col">
- <h1 class="generalTitle">@LocalizedService.GetResource("Title")</h1>
+ <h1 class="generalTitle">@LocalizedService.GetResource(Model.SelectedLanguage, "Title")</h1>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col text-center">
- <h2 class="text-center">@LocalizedService.GetResource("Installed")</h2>
+ <h2 class="text-center">@LocalizedService.GetResource(Model.SelectedLanguage, "Installed")</h2>
</div>
</div>
</div>