Base solution for your next web application
Open Closed

How to know the current language from an entity #3700


User avatar
0
expertit created

Hello,

In aspnet zero, what is the best way to discover which is the current language inside of an entity accessor ?

Thanks,

Albert


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

    Hi @expertit,

    I think it is not a good way but you can use current Thread's culture. I don't know your use case very well but It is better to pass culture string to your entity if possible.

    Thanks.

  • User Avatar
    0
    expertit created

    Hi @ismcagdas

    The use case is to support multi-lingual entity properties. The solution is :

    • an entity Expert and another entity ExpertLocal
    • ExpertLocal is linked with Expert and also with ApplicationLanguage
    • ExpertLocal contains the translated properties
    • when I access to expert.Name property, I want to get the Name in the current language by accessing experLocals.

    Best regards Albert

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @expertit,

    Thanks for sharing your solution. As I mentioned above, you can use current thread's culture but I suggest you to search on the web for current solutions on this area if you haven't done this yet.

    Thanks.