ensemble
ensemble copied to clipboard
Ability to change the language of the UI (i18n)
As an app developer, I want to be able to provide multiple languages, and have an action that allows me to switch the language within the UI:
Button:
onTap:
setLanguage:
language: es # change to this. Also provide option of userDefault, which will adhere to user's device/browser default language
fallback: en # if es does not exist, fallback to this
onComplete:
# expose event so that I can perform an action
onError:
# expose event so that I can perform an action
Provide same ability in code:
ensemble.setLanguage({
"language": "es",
"fallback": "en"
);
More context: A user may want to have a dropdown (in-App) that allows the user to select a language. All the infrastructure is there to switch language, and some of the code is there in https://github.com/EnsembleUI/ensemble/tree/translation_runtime but it doesn't work yet. THe problem seems to be inside the flutter_i18n we used or our DataTranslatorLoader.
SEnding this to you @snehmehta.
sorry for the ping pong, looks like I won't be able to get to it this week. Assigning back to @snehmehta as he understands the issue better anyway.
@amin-nas did it by accident, assigning back to Sneh
https://docs.ensembleui.com/translations#changing-language-in-screens-using-script