Xtensive.Orm.Localization
7.0.7
See the version list below for details.
dotnet add package Xtensive.Orm.Localization --version 7.0.7
NuGet\Install-Package Xtensive.Orm.Localization -Version 7.0.7
<PackageReference Include="Xtensive.Orm.Localization" Version="7.0.7" />
<PackageVersion Include="Xtensive.Orm.Localization" Version="7.0.7" />
<PackageReference Include="Xtensive.Orm.Localization" />
paket add Xtensive.Orm.Localization --version 7.0.7
#r "nuget: Xtensive.Orm.Localization, 7.0.7"
#:package Xtensive.Orm.Localization@7.0.7
#addin nuget:?package=Xtensive.Orm.Localization&version=7.0.7
#tool nuget:?package=Xtensive.Orm.Localization&version=7.0.7
Xtensive.Orm.Localization
Summary
The extension transparently solves a task of application or service localization. This implies that localizable resources are a part of domain model so they are stored in database.
Prerequisites
DataObjects.Net 7.0.x or later (http://dataobjects.net)
Implementation
Implement ILocalizable<TLocalization> on your localizable entities, e.g.:
[HierarchyRoot]
public class Page : Entity, ILocalizable<PageLocalization>
{
[Field, Key]
public int Id { get; private set; }
// Localizable field. Note that it is non-persistent
public string Title
{
get { return Localizations.Current.Title; }
set { Localizations.Current.Title = value; }
}
[Field] // This is a storage of all localizations for Page class
public LocalizationSet<PageLocalization> Localizations { get; private set; }
public Page(Session session) : base(session) {}
}
Define corresponding localizations, e.g.:
[HierarchyRoot]
public class PageLocalization : Localization<Page>
{
[Field(Length = 100)]
public string Title { get; set; }
public PageLocalization(Session session, CultureInfo culture, Page target)
: base(session, culture, target) {}
}
Examples of usage
Example #1. Access localizable properties as regular ones, e.g.:
page.Title = "Welcome";
string title = page.Title;
Example #2. Mass editing of localizable properties:
var en = new CultureInfo("en-US");
var sp = new CultureInfo("es-ES");
var page = new Page(session);
page.Localizations[en].Title = "Welcome";
page.Localizations[sp].Title = "Bienvenido";
Example #3. Value of localizable properties reflects culture of the current Thread, e.g.:
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
string title = page.Title; // title is "Welcome"
Thread.CurrentThread.CurrentCulture = new CultureInfo("es-ES");
string title = page.Title; // title is "Bienvenido"
Example #4. Instead of altering CurrentThread, instance of LocalizationScope can be used, e.g.:
using (new LocalizationScope(new CultureInfo("en-US"))) {
string title = page.Title; // title is "Welcome"
}
using (new LocalizationScope(new CultureInfo("es-ES"))) {
string title = page.Title; // title is "Bienvenido"
}
Example #5. LINQ queries that include localizable properties are transparently translated
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
var query = from p in session.Query.All<Page>()
where p.Title=="Welcome"
select p;
Assert.AreEqual(1, query.Count());
Thread.CurrentThread.CurrentCulture = new CultureInfo("es-ES");
var query = from p in session.Query.All<Page>()
where p.Title=="Bienvenido"
select p;
Assert.AreEqual(1, query.Count());
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- Xtensive.Orm (>= 7.0.7)
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 |
|---|---|---|
| 7.2.0 | 479 | 11/16/2025 |
| 7.2.0-RC | 125 | 11/1/2025 |
| 7.2.0-Beta-2 | 200 | 4/27/2025 |
| 7.2.0-Beta-1 | 175 | 12/28/2023 |
| 7.1.6 | 219 | 10/29/2025 |
| 7.1.5 | 458 | 4/10/2025 |
| 7.1.4 | 240 | 1/27/2025 |
| 7.1.2 | 251 | 10/18/2024 |
| 7.1.1 | 281 | 11/14/2023 |
| 7.1.0 | 460 | 4/12/2023 |
| 7.1.0-RC | 283 | 3/9/2023 |
| 7.0.7 | 211 | 10/28/2025 |
| 7.0.6 | 218 | 12/19/2024 |
| 7.0.5 | 238 | 6/3/2024 |
| 7.0.4 | 179 | 11/12/2023 |
| 6.0.15 | 202 | 10/27/2025 |
| 6.0.14 | 206 | 12/17/2024 |
| 6.0.13 | 258 | 4/4/2024 |
| 6.0.12 | 183 | 11/10/2023 |