Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

How to link entity property to item from a localized source? #1411


User avatar
0
reddogaw created

Hi,

I'm just getting started with Boilerplate, so apologies for my naivety.

My stored entity has a number of properties whose values are driven by a list of values. I want this list of values to be configurable via the database and I want them to support localization.

For example, a "person" has a "hair colour" which must be one of a number of values (e.g. blonde, brown, black, red).

How do I model the persisted "person" entity to store the value?

From my reading, I think that I could create a new localization source for each of these lists of data. This will enable me to use GetAllStrings for the localization source. However, then what should I store into my database? Maybe, the localization source/key combo?

Also, I think a drawback of that approach is that the "GetAllStrings" operation from LocalizedSource that are not explicitly orderable as they are set up more as a dictionary style.

Can you advise if there is an "in the box" (or at least an "on the path") approach to this...


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I think you should not use localization sources. You can take a look at this issue to get an idea about how to make content localization <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/297">https://github.com/aspnetboilerplate/as ... issues/297</a>.

    There is a sample experimental project <a class="postlink" href="https://github.com/hikalkan/experimental-multi-lingual-entities">https://github.com/hikalkan/experimenta ... l-entities</a>.