Open newtewt opened 5 years ago
In the core there is this note:
// TODO remove this when our enketo-core dependency is updated as the latest
// version uses the language passed to the constructor
currentForm.langs.setAll(options.language);
It's somewhat likely that once #4386 is done the solution to this problem changes, so we should probably wait until then.
I don't think this is possible even with the latest enketo. The way translation works is the HTML is generated with all the translations inline, eg:
<label class="question non-select or-appearance-db-object">
<span lang="fr" class="question-label" data-itext-id="...">Quel est l'identifiant du patient?</span>
<span lang="en" class="question-label active" data-itext-id="...">What is the patient's name?</span>
<input ...>
</label>
The labels are all hidden in CSS. When the language is set enketo finds all elements with [lang="en"]
and adds the active
class which shows them. It has no concept of a "default" language to fall back to if the label doesn't contain any spans with the chosen language.
Raise an issue with enketo-core and consider contributing a PR.
Leaving this screenshot here for testing purposes when the issue is fixed:
Is your feature request related to a problem? Please describe. When a language is added to the app. If the forms are not updated to include translations for that language we display a bunch of fields to select values however there is no text because there are no translations.
Describe the solution you'd like We should be able to identify that a form has no translations for the current language. Then display the default language as we do elsewhere in the app.
Describe alternatives you've considered Another option would be to pump it to the console that the translations are missing. Currently no error is shown.
Additional context