H073.Local 1.1.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package H073.Local --version 1.1.0                
NuGet\Install-Package H073.Local -Version 1.1.0                
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="H073.Local" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add H073.Local --version 1.1.0                
#r "nuget: H073.Local, 1.1.0"                
#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 H073.Local as a Cake Addin
#addin nuget:?package=H073.Local&version=1.1.0

// Install H073.Local as a Cake Tool
#tool nuget:?package=H073.Local&version=1.1.0                

HxLocal API Documentation

Introduction

The Localisation class provides functions to manage and access translations based on language JSON files.

Setup

By default, translations are expected to be stored in a folder named "Lingos", containing JSON files named with their respective language codes, e.g., "en.json", "de.json".

Changing the Default Folder:

If you want to use a different folder, you can change the FilePath property. However, it's crucial to ensure that you set this folder before loading any languages or accessing translations:

Localisation.FilePath = "YourFolderPathHere";

⚠️ Note: Always change the folder path before loading a language or using the API to fetch translations. The order is crucial to ensure the API looks in the correct directory.

Using the API

1. Loading a Language:

To load a specific language, call the LoadLanguage method:

Localisation.LoadLanguage("en");

Where "en" is the language code.

2. Retrieving a String:

To retrieve a translated string, use the GetString method:

var welcomeMessage = Localisation.GetString("welcomeMessage");

If the key contains nested objects, use a dot notation:

var nestedMessage = Localisation.GetString("parent.child.message");
3. Using Format Strings:

You can use string formats and pass arguments to the GetString method:

var formattedMessage = Localisation.GetString("welcomeWithName", "John");

Assuming the translation is something like: "welcomeWithName": "Welcome, {0}!"

4. List Available Languages:

To get a list of available languages:

var languages = Localisation.ListAvailableLanguages();
foreach(var lang in languages)
{
    Console.WriteLine(lang);
}

This will list the names of the JSON files without their extensions.

Product 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. 
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.3.1 174 8/24/2023
1.3.0 155 8/22/2023
1.2.0 137 8/22/2023
1.1.0 129 8/17/2023