Localization.Accessor.Service
1.0.0
See the version list below for details.
dotnet add package Localization.Accessor.Service --version 1.0.0
NuGet\Install-Package Localization.Accessor.Service -Version 1.0.0
<PackageReference Include="Localization.Accessor.Service" Version="1.0.0" />
paket add Localization.Accessor.Service --version 1.0.0
#r "nuget: Localization.Accessor.Service, 1.0.0"
// Install Localization.Accessor.Service as a Cake Addin #addin nuget:?package=Localization.Accessor.Service&version=1.0.0 // Install Localization.Accessor.Service as a Cake Tool #tool nuget:?package=Localization.Accessor.Service&version=1.0.0
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 | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. |
-
net6.0
- Localization.Accessor.Contracts (>= 1.0.0)
- MediatR (>= 7.0.0)
- Microsoft.AspNetCore.Hosting (>= 2.2.7)
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.EntityFrameworkCore (>= 2.2.6)
- Microsoft.EntityFrameworkCore.Relational (>= 2.2.6)
- Microsoft.EntityFrameworkCore.SqlServer (>= 2.2.6)
- Microsoft.Extensions.Configuration (>= 2.2.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 2.2.0)
- Microsoft.Extensions.Localization (>= 6.0.8)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 2.2.0)
- Newtonsoft.Json (>= 13.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Localization.Accessor.Service:
Package | Downloads |
---|---|
Localization.Accessor.Host
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.