Localization.Accessor.Service 1.0.3

dotnet add package Localization.Accessor.Service --version 1.0.3                
NuGet\Install-Package Localization.Accessor.Service -Version 1.0.3                
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.Service" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Localization.Accessor.Service --version 1.0.3                
#r "nuget: Localization.Accessor.Service, 1.0.3"                
#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.Service as a Cake Addin
#addin nuget:?package=Localization.Accessor.Service&version=1.0.3

// Install Localization.Accessor.Service as a Cake Tool
#tool nuget:?package=Localization.Accessor.Service&version=1.0.3                

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 (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.

Version Downloads Last updated
1.0.3 1,087 6/14/2023
1.0.2 177 6/13/2023
1.0.1 251 6/7/2023
1.0.0 257 12/7/2022