Add option_labels to questions for stable identifiers and translated labels #2646
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Agama questions have two attributes to define the possible answers:
options: possible options the user can choose from.default_option: default option. This option is used by the web UI to decide which button to set as the default.The problem is that, if you try to load an answers file, you need to make sure that Agama and your profile are in the same language. So instead of using translated values, we should use some kind of identifiers.
Solution
Where the old code had an
optionsarray, add also anoption_labelsarray. The options will be untranslated IDs, the labels are translated and displayed to the user.TODO:
N_("text")to the actual answersTesting
How to test manually:
Screenshots
TODO, make one
Documentation
Remember to look at it from the user's perspective. Yes you have made the compiler happy.
But will the humans even know about your contribution? Sometimes they cannot miss it,
other times they need advertisement and explanation.
Look for relevant sections and adjust:
change the
///comments (rust doc)and update the .md with
cargo xtask markdowngit ls-files '*.md'