Pi18n 1.3.0
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
.NET Framework 4.0
This package targets .NET Framework 4.0. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Pi18n --version 1.3.0
NuGet\Install-Package Pi18n -Version 1.3.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="Pi18n" Version="1.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Pi18n --version 1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Pi18n, 1.3.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 Pi18n as a Cake Addin #addin nuget:?package=Pi18n&version=1.3.0 // Install Pi18n as a Cake Tool #tool nuget:?package=Pi18n&version=1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Pi18n
A fully dynamic and easy-to-use solution for multi-lingual support
Features
- Load and switch languages at runtime without recompiling or restarting.
- Simple setup and usage with minimal code changes necessary.
Installation
If you want to include Pi18n in your project, you can install it directly from NuGet.
Support: Net40+ | Net5.0+ | netstandard2.0+
Getting Started
Setup
Resource Files: Create resource files for different languages.
Example:.resource/language-resource-ja-JP.ui.i18n .resource/language-resource-ja-JP.msg.i18n .resource/language-resource-zh-CN.ui.i18n .resource/language-resource-zh-CN.msg.i18n
Resource content style:
Key=Value
Configuration: Set up the
ResourceManager
with the appropriate resource path and naming convention.ResourceManager.SetUp("resource", "language-resource-{I18N}.{ANY}.i18n"); ResourceManager.SetLanguage(ResourceManager.CultureInfoList[0].Name);
Usage
Use directly in Code-Behind
Access the localized strings using the ResourceManager
.
MessageBox.Show(ResourceManager["MessageText"]);
Use MVVM for data binding
public class ViewModel : ObservableObject
{
public ResourceManager ResourceManager => ResourceManager.Instance;
}
<TextBlock Text="{Binding ResourceManager[Hello]}"/>
APIS
Properties
- Instance : Get instance of ResourceManager
- DefaultCulture : Get or set default CultureInfo instance
- CurrentCulture : Get or set current CultureInfo instance
- CultureInfoList : Get list of CultureInfo instance
- CultureCodeList : Get list of culture code (like "en-US")
- CultureNameList : Get list of culture name (like "English (United States)")
Functions
void SetUp(string path, string format)
: Sets up the ResourceManager with the appropriate resource path and naming convention.bool SetDefault(CultureInfo cultureInfo)
: Sets the default language by CultureInfo object.bool SetDefault(string cultureCode)
: Sets the default language by culture code.bool SetDefault(CultureType cultureType)
: Sets the default language by culture type (CurrentUICulture | CurrentCulture).bool SetLanguage(CultureInfo cultureInfo)
: Sets or switches the current language by CultureInfo object.bool SetLanguage(string cultureCode)
: Sets or switches the current language by culture code.string GetFormat(string key, params object[] args)
: Get formatted string.
Events
- LanguageChanged : Language changed
- LanguageChangedEventArgs.OldCultureInfo
- LanguageChangedEventArgs.NewCultureInfo
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. 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 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 is compatible. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net40 is compatible. net403 was computed. net45 is compatible. net451 is compatible. net452 is compatible. net46 is compatible. net461 is compatible. net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
-
.NETFramework 4.5.1
- No dependencies.
-
.NETFramework 4.5.2
- No dependencies.
-
.NETFramework 4.6
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.7
- No dependencies.
-
.NETFramework 4.7.1
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
.NETFramework 4.8.1
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.