Hi, I bet there is a trick for this but I have not figured out it yet…
How can I make a button to select between two languages in Appsmith apps EN/CN? Imagine I have a form and some wigets, for example a drop-down list and some buttons. Imagine also that the form opens up with English text but now a non-English user wants to use the app so they click on their language button (Flag) and automagically all the text should be displayed in the newly selected language… I hope it makes sense.
Any ideas or tutorials about this? Google comes up empty,
Hi Superace,
Unfortunately we don’t have support for internationalisation yet. However till we support it you can can use storeValue to store language and use it as shown below.
// on language change button click
{{
storeValue('lang', appsmith.store.lang === 'en' ? 'ca': 'en') // Toggle between languages
}}
// in other buttons Label should be
{{
appsmith.store.lang === 'en' ? 'En text' : 'CA text'
}}
// on dropdowns options should be
{{() => {
var enOptions = [{
label: 'en text',
value: 'envalue'
}, {
label: 'en text 2',
value: 'envalue2'
}];
var caOptions = [{
label: 'ca text',
value: 'cavalue'
}, {
label: 'ca text 2',
value: 'cavalue2'
}]
return appsmith.store.lang === 'en' ? enOptions : caOptions
}}}