Base solution for your next web application
Open Closed

Switch dropdown values based on selected UI language #10377


User avatar
0
hafiz created

Hi I am using the latest version of aspnet.Zero. I am using angular component with aspnet core api.

I need to create an angular function to bind the value of dropdown dynamically based on selected UI language. I have several lookup tables where the properties of the tables are similar and for each table I feed the values in three languages (en,da,ps). Now I want to create the function, as mentioend above, to dynamically bind the value of dropdown. For example if the selected UI language is in English, the dropdown value for exmaple for product name are shown in English, but when the UI language is Turkey, the dropdown value is filled with Turkey name of products instead of English.

Any suggestion please on how to implement such using asp.net zero.

Thank you


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

    Hi @hafiz,

    You can follow two approaches for localized dropdown values;

    1. If the dropdown contains static items, you can define localization in the xml files and use them in your dropdown like {{'KEY' | localize}}
    2. If those values are dynamically defined by users and those values belong to an entity, then you can convert your Entity to a Multi Lingual Entity, see https://aspnetboilerplate.com/Pages/Documents/Multi-Lingual-Entities

    For your second question on Language Management on your email, the default Localization feature only localizes the static content on y our app. For localizing Entities, you need to use Multi-Lingual-Entities as I stated above.