Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 816899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:54:33+00:00 2026-05-15T01:54:33+00:00

What is the best way to design the Domain objects which can have multi-lingual

  • 0

What is the best way to design the Domain objects which can have multi-lingual fields. An example can be a Product class with Description being multi-lingual.

I have found few links but could not decide which one is the best way.

  1. http://fabiomaulo.blogspot.com/2009/06/localized-property-with-nhibernate.html
    (This stores all localised language data in one field. Can be a problem if we query from Sql)

  2. http://ayende.com/Blog/archive/2006/12/26/LocalizingNHibernateContextualParameters.aspx
    (This one has a warning at the beginning that it is a hack and no longer supported)

  3. http://www.webdevbros.net/2009/06/24/create-a-multi-languaged-domain-model-with-nhibernate-and-c/
    (This does not describe how multilingual data will be structured in the database.)

Anyone having experience with using NHibernate with multi-lingual data. Is there a better way?

  • 1 1 Answer
  • 4 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:54:34+00:00Added an answer on May 15, 2026 at 1:54 am

    The third option looks great. The hibernate mapping is given, but not the database schema – if that’s what you are missing, then I’ll sketch it out here:

    dictionary
    ----------
    ID: int - identity
    name: nvarchar(255)
    
    phrase
    ------
    dictionary_id:int  (fkey dictionary.ID)
    culture_id:int     (LCID)
    phrase:nvarchar(255)  - this is the default size - seems too small
    

    According to this blog entry, 255 is the default string length for String values. To overcome the short string length on the phrase text, you can change the <element> tag to

    <element column="phrase" type="String" length="4001"></element>
    

    To use this in your domain model, you add a PhraseDictionary property to your entity where you want translatable text. E.g. the title property or decription property.

    I think the article describes a great approach, and is the one that I would go
    for.

    EDIT: In response to the comments, make the length less than 4001 if you know the absolute maximum size is less than that, as this will typically be faster. Also, NHibernate will lazily fetch the collection, but it may fetch all the items at once. You can profile to determine if this has any performance implications. (If you have only a handful of languages then I doubt you will see a difference.) If you have many languages (Say 50+) then it may be worthwhile creating custom properties to fetch the localized text. These will issue queries to fetch specifically the text required. More importantly, you may be able to fetch all the text for a given entity in one query, rather than each localized text property as a separate query.

    Note that this extra effort is only needed if profiling gives you reason to be concerned about the performance. Chances are that the implementation in the article as is will function more than adequately.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What would be the best way to design a mysql table, which can be
What's the best way to design such a container, which can support randomized value
I'm trying to figure out the best way to design Car and Road objects
The best way to explain my problem is by a example. I have a
I am looking for suggestions as to the best way to design objects for
What's the best way to design/use my model and NSFetchedResultsController so that I can
I have a question about the best way to design a program I'm working
I have a software design question on what's the best way to handle a
What is the best way to design repositories for complex objects, assuming use of
What is the best way to start Domain Driven Design? What are the recommended

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.