A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/NetCoreStack/Localization below:

NetCoreStack/Localization: 🌏 Database Resource Localization for .NET Core with Entity Framework and In Memory Cache

NetCoreStack Localization v1.0.6 Database Resource Localization for .NET Core with Entity Framework and In Memory Cache

PM> docker pull tahaipek/netcorestack-localization-test-hosting
PM> docker run -d -p 5003:80 netcorestack-localization-test-hosting
PM> Install-Package NetCoreStack.Localization
AppSettings Configuration

Configuration settings in AppSettings.json:

{
	"DbSettings": {
		"SqlConnectionString": "Server=.;Database=LocalizationTest;Trusted_Connection=True;MultipleActiveResultSets=true"
	},
	"LocalizationSettings": {
		"UseDefaultLanguageWhenValueIsNull": true
  	}
}
Enable NetCoreStack.Localization in ASP.NET Core
public void ConfigureServices(IServiceCollection services)
{
	services.AddNetCoreStackMvc(options => { options.AppName = "NetCoreStack Localization"; });
	services.AddNetCoreStackLocalization(Configuration);
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
	app.UseNetCoreStackMvc();
	app.UseNetCoreStackLocalization();
}
Client-side localization in *.cshtml file
<head>
	<!-- Optional: The resources defined javascript. =>  "window.culture.resource"  -->
	<netcorestack-javascriptregistrar></netcorestack-javascriptregistrar>
    
	<!-- 
	Optional: 
	   - If you want cookies to be set by JavaScript, you should use this.   
	   - If you don't want cookies to be set by JavaScript, remove this line. It will automatically redirect to Controller Action.
	-->
	<netcorestack-languageSelector-scripts></netcorestack-languageSelector-scripts>
</head>
<body>
	<!--  
	Required: Language Selector Combobox
	Optional:
	   - If you want cookies to be set by JavaScript, you should set "set-cookie-with-java-script" property.   
	   - If you don't want cookies to be set by JavaScript, the application sets it through Controller Action.
	-->
	<netcorestack-languageSelector name="culture" set-cookie-with-java-script="true"></netcorestack-languageSelector>
	
	@Localizer["Logo_Description"]
</body>
Back-end Localization in *.cs file
public class HomeController : Controller
{
	private readonly IStringLocalizer _stringLocalizer;
	public HomeController(IStringLocalizer stringLocalizer)
	{
		_stringLocalizer = stringLocalizer;
	}

	public IActionResult About()
	{
		ViewData["Message"] = _stringLocalizer["AboutPageDescription"];
		return View();
	}
}
.Net Core Localization with Entity Framework .Net Core Database Localization

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4