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                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Localization.Accessor.Host" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Localization.Accessor.Host --version 1.0.1                
#r "nuget: Localization.Accessor.Host, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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:

  1. Indrivo.Localization.Accessor.Contracts
  2. Indrivo.Localization.Accessor.Host
  3. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 1,158 6/7/2023
1.0.0 205 12/7/2022