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 745121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T09:03:30+00:00 2026-05-14T09:03:30+00:00

Are there any good practices to follow when designing a model/ViewModel to represent data

  • 0

Are there any good practices to follow when designing a model/ViewModel to represent data in an app that will view/edit that data in multiple languages? Our top-level class–let’s call it Course–contains several collection properties, say Books and TopicsCovered, which each might have a collection property among its data. What kind of class structure should I implement to hold the data for certain properties in multiple languages?

For example, the data needs to represent course1.Books.First().Title in different languages, and course1.TopicsCovered.First().Name in different languages. We want a app that can edit any of the data for one given course in any of the available languages–as well as edit non-language-specific data, perhaps the Author of a Book (i.e. course1.Books.First().Author). We are having trouble figuring out how best to set up the model to enable binding in the XAML view.

For example, do we replace (in the single-language model) each String with a collection of LanguageSpecificString instances? So to get the Title in the current language:

course1.Books.First().Title.Where(lss => lss.Language==CurrentLanguage).SingleOrDefault()

If we do that, we cannot easily bind to any value in one given language, only to the collection of language values such as in an ItemsControl.

<TextBox Text={Binding Title.???} />  <!-- no way to bind to the current language title -->

Do we replace the top-level Course class with a collection of language-specific Courses? So to get the title in the current language:

course1.GetLanguage(CurrentLanguage).Books.First().Title

If we do that, we can only easily work with one language at a time; we might want a view to show one language and let the user edit the other.

<TextBox Text={Binding Title} />  <!-- good -->
<TextBlock Text={Binding ??? } />  <!-- no way to bind to the other language's title-->

Also, that has the disadvantage of not representing language-neutral data as such; every property (such as Author) would seem to be in multiple languages. Even non-string properties would be in multiple languages.

Is there an option in between those two? Is there another way that we aren’t thinking of?

I realize this is somewhat vague, but it would seem to be a somewhat common problem to design for.

Note: This is not a question about providing a multilingual UI, but rather about actually editing multi-language data in a flexible way.

Edit: so the question is how should we model the classes? Something like this:

Class Course { 
    ObservableCollection<Book> Books
    ObservableCollection<Topic> TopicsCovered
}
Class Book {
    ObservableCollection<LanguageSpecificString> Title
    String Author
}
Class Topic {
    ObservableCollection<LanguageSpecificString> Name
}
Class LanguageSpecificString {
    String LanguageCode
    String Value
}

Or should it be something like:

Class MultilingualCourse { 
    Course GetLanguage(string languageCode)
}
Class Course { 
    ObservableCollection<Book> Books
    ObservableCollection<Topic> TopicsCovered
}
Class Book {
    String Title
    String Author
}
Class Topic {
    String Name
}

Or something else altogether?

  • 1 1 Answer
  • 0 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-14T09:03:30+00:00Added an answer on May 14, 2026 at 9:03 am

    We’ve decided to go simpler than these answers and just replace each string that is translatable with a Dictionary<string, string> (language, value). Of course, we may wish to Dictionary<CultureInfo, string> in the future. This is close to my first answer in the original post.

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

Sidebar

Related Questions

I wonder if there are any good practices for addressing Spring controllers in JSP.
Are there any good technical solutions for extremely long term archiving of data, for
just a simple question.. Is there any good practices to validate an HTML embed
Are there any good .net Compact Framework reference implementations (w/ source) out there that
Is there any good practice for this? I wish I could solve the problem
Is there any good library which supports WebSockets and is compatible with GWT? Ideally,
Are there any good technical comparisons available between the various game development options available.
Are there any good examples of mvc routing wherein every 404 page not found
Are there any good open source frameworks for developing computer system emulators? I am
Is there any good way of truncating text with plain HTML and CSS, so

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.