Beizsoft.Text
1.0.0-rc2
dotnet add package Beizsoft.Text --version 1.0.0-rc2
NuGet\Install-Package Beizsoft.Text -Version 1.0.0-rc2
<PackageReference Include="Beizsoft.Text" Version="1.0.0-rc2" />
paket add Beizsoft.Text --version 1.0.0-rc2
#r "nuget: Beizsoft.Text, 1.0.0-rc2"
// Install Beizsoft.Text as a Cake Addin
#addin nuget:?package=Beizsoft.Text&version=1.0.0-rc2&prerelease
// Install Beizsoft.Text as a Cake Tool
#tool nuget:?package=Beizsoft.Text&version=1.0.0-rc2&prerelease
Beizsoft.Text
A simple .NET string localization base library using Names
as language and text resource keys.
Comes with BasicLanguage
and BasicLanguageManager
implementations which use a dictionary under-the-hood, with the ILanguage
, ILanguageManager
interfaces providing a consistent API, and LanguageManagerBase
providing an easily-extensible abstract base class to work with.
An ILanguage
has a Name
and exposes a bool TryGetText(Name name, out string value)
method, while ILanguageManager
handles changing the current language bool TrySetLanguage(Name langugage, out ILanguage language)
, a way of querying available languages IEnumerable<Name> Languages { get; }
& bool TryGetLanguage(Name langugage, out ILanguage language)
and knowledge of what the currently active language is ILanguage CurrentLanguage { get; }
.
There are two approaches to localization enabled by the ILanguageManager
.
bool TryGetText(Name name, out string text)
- Returns false if the current language has no entry for the requested text resource.
text
always has a value; when true, it is localized string associated withname
for the current language and, when false, is simplyname.ToString()
for a fallback.
string GetText(Name name)
- Always returns a string, either the localized version associated with
name
for the current language, orname.ToString()
as a fallback.
- Always returns a string, either the localized version associated with
LanguageManagerBase
has one abstract property, and two abstract methods:
IEnumerable<Name> Languages { get; }
- Requires an actual implementation, used to query available languages.
bool TryGetLanguage(Name name, out ILanguage<TStringComparer> language)
- Requires an actual implementation, used to query and change languages.
void AfterChangingLanguage(ILanguage oldLanguage, ILanguage newLanguage)
- Can have a noop implementation; called after a language has been changed.
- Only called when the language is actually changed; is not called if the specified language cannot be found, or if the specified language is already the current language.
All other members are pre-implemented on LangaugeManagerBase
. This class can be used to quickly implement a language manager using any storage mechanism you like.
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 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Beizsoft.Names (>= 2.0.0)
- System.Collections.Immutable (>= 5.0.0)
-
net5.0
- Beizsoft.Names (>= 2.0.0)
-
net6.0
- Beizsoft.Names (>= 2.0.0)
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 |
---|