I wonder there is no direct support for multi-languaged data in NHibernate.

Suppose you have a Customer class, and the Customer.Name and
Customer.Address properties should be multi-languaged.
The solution depends on whether the user interface layer expose the
Name/Address in one language only or all posible language values at a given
time.

A)   Store Name for all languages in one database field and map them as
NHibernate component
B)   Store Name for one language as a database field:
    B.1) Customer (ID, Address_en, Address_german, ...)  and map all these
Address_XX columns in one NHIbernate dynamic-component
    B.2) Create a table for Customer and another table for its language
resources in Customer, such as (CustomerID, LanguageID, Address, ..)
           The mapping is the same as B.1
    B.3) Create a table for Customer without Name/Address, and create a
resource table for storing for all language resources for all entities, such
as Resources(ResourceTypeID, OwnerID, LanguageID, Resource), of which the
ResourceTypeID specifies if a resouce represents Customer.Name or
Customer.Address, and the OwnerID specifies the CustomerID that owns this
resource.
            You can map the Resources as  B.3.1) a standalone NHibernate
entity or an manage it yourself, or B.3.2) map the Resources as a family of
classes, each class for a kind of ResourceTypeID.

I prefer B.3.1 as it is simpler and does not require much NHibernate
knowledge:-)

NHibernate have a "filter" feature may helps if you want to expose the
name/address in one language only. It may be used to filter the Resources
with the current LanguageID.



On Tue, Apr 14, 2009 at 8:14 PM, Michal <[email protected]> wrote:

>
> Hello all,
>
> I am completely new to hibernate and would be interested in the
> solution to the following problem:
>
> My application needs to support data in multiple languages. E.g A
> product contains a title which can be stored in English, German,
> Spanish, etc.
>
> Could you tell me the best practice of how ..
>
> A) would you store the details in the database (consider an
> application with several business objects which contain several
> translated properties)
>
> B) would you model your classes so that it allows me to load an
> instance in a given language (e.g. determined from
> Threading.Culture, ...)
>
> Thanks a lot for any advise.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to