Localization.Accessor.Host
1.0.1
dotnet add package Localization.Accessor.Host --version 1.0.1
NuGet\Install-Package Localization.Accessor.Host -Version 1.0.1
<PackageReference Include="Localization.Accessor.Host" Version="1.0.1" />
paket add Localization.Accessor.Host --version 1.0.1
#r "nuget: Localization.Accessor.Host, 1.0.1"
// Install Localization.Accessor.Host as a Cake Addin #addin nuget:?package=Localization.Accessor.Host&version=1.0.1 // Install Localization.Accessor.Host as a Cake Tool #tool nuget:?package=Localization.Accessor.Host&version=1.0.1
Localization
Introduction
During the development of multiple application @Indrivo we observed that we are in need of a generic accessor service for localizations. The general idea is to have plugable sources of lexemes like database, json formated files, cache etc.
Purpose
The main purpose of the module came from the up mentioned need. The module itself contains right now implementations for the database, json & cache services. Each comming with its own initializer. On initial setup the lexemes are retrieved from the database and json files and then stored into cache. If a lexeme is not found by key for a specific language then a value "[lexemekey]" is returned.
How to set up
Set up is pretty straightforward you will need to install the following packages inside your solution:
- Indrivo.Localization.Accessor.Contracts
- Indrivo.Localization.Accessor.Host
- Indrivo.Localization.Accessor.Service
For installing the module use the following lines in your program.cs or startup.cs file.
// Inside the configure services
services.AddTransient<IHttpContextAccessor, HttpContextAccessor>();
services.AddLocalizationService(Configuration);
// Inside the Configure method inject the ILocalizationAccessor and pass it into the extension method
app.BuildLocalizationOptions(localizationAccessor);
Inside the appsettings you will need to provide the following configuration: File name should be in the following format : "en-Gb" | "ro-RO" | "ru-RU" etc. Files in the path folder are automatically scanned and added to the list.
"ConnectionStrings": {
"DefaultConnection": ""
},
"FileLocalizationConfig": {
"Path": "Localization",
"DefaultLocale": "en-GB"
}
Where "FileLocalizationConfig:Path" is the path to the folders with the json formated lexemes. The format for the lexemes is the following
{
"key": "value"
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- AutoMapper (>= 12.0.1)
- Localization.Accessor.Service (>= 1.0.1)
- MediatR (>= 12.0.1)
- Microsoft.AspNetCore.Localization (>= 2.1.1)
- Microsoft.EntityFrameworkCore.SqlServer (>= 7.0.5)
- Scrutor (>= 4.2.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.