On 15 Apr., 14:42, Michal <mga...@gmail.com> wrote:
> On Apr 14, 8:14 pm, Yaojian <sky...@gmail.com> wrote:
>
> > I wonder there is no direct support formulti-languaged data in NHibernate.
>
> > Suppose you have a Customer class, and the Customer.Name and
> > Customer.Address properties should bemulti-languaged.
> > The solution depends on whether the user interface layer expose the
> > Name/Address in onelanguageonly or all posiblelanguagevalues at a given
> > time.
>
> the UI layer would expose it in onelanguageat a time .. just for
> administration it would require to see all ..
>
>
>
>
>
> > A) Store Name for all languages in one database field and map them as
> > NHibernate component
> > B) Store Name for onelanguageas 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 itslanguage
> > 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 alllanguageresources 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 onelanguageonly. It may be used to filter the Resources
> > with the current LanguageID.
>
> aight. Guess i have a clue what you are talking about. B 3.1 sounds
> good to me as well..
>
>
>
> > On Tue, Apr 14, 2009 at 8:14 PM, Michal <mga...@gmail.com> 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 givenlanguage(e.g. determined from
> > > Threading.Culture, ...)
>
> > > Thanks a lot for any advise.
On 15 Apr., 14:42, Michal <mga...@gmail.com> wrote:
> On Apr 14, 8:14 pm, Yaojian <sky...@gmail.com> wrote:
>
> > I wonder there is no direct support formulti-languaged data in NHibernate.
>
> > Suppose you have a Customer class, and the Customer.Name and
> > Customer.Address properties should bemulti-languaged.
> > The solution depends on whether the user interface layer expose the
> > Name/Address in onelanguageonly or all posiblelanguagevalues at a given
> > time.
>
> the UI layer would expose it in onelanguageat a time .. just for
> administration it would require to see all ..
>
>
>
>
>
> > A) Store Name for all languages in one database field and map them as
> > NHibernate component
> > B) Store Name for onelanguageas 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 itslanguage
> > 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 alllanguageresources 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 onelanguageonly. It may be used to filter the Resources
> > with the current LanguageID.
>
> aight. Guess i have a clue what you are talking about. B 3.1 sounds
> good to me as well..
>
>
>
> > On Tue, Apr 14, 2009 at 8:14 PM, Michal <mga...@gmail.com> 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 givenlanguage(e.g. determined from
> > > Threading.Culture, ...)
>
> > > Thanks a lot for any advise.
here is a detailed description of how i did solved the multi language problem:http://www.webdevbros.net/2009/06/24/create-a-multi-languaged-domain-model-with-nhibernate-and-c/
sure why not.
i guess i need some access to it ...
best regards
michal