Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK-624] Allow users to select between translated labels and XML names for displayed form questions in NLP UI #4933

Merged
merged 14 commits into from
Jul 1, 2024

Conversation

duvld
Copy link
Member

@duvld duvld commented May 8, 2024

Checklist

  1. If you've added code that should be tested, add tests
  2. If you've changed APIs, update (or create!) the documentation
  3. Ensure the tests pass
  4. Make sure that your code lints and that you've followed our coding style
  5. Write a title and, if necessary, a description of your work suitable for publishing in our release notes
  6. Mention any related issues in this repository (as #ISSUE) and in other repositories (as kobotoolbox/other#ISSUE)
  7. Open an issue in the docs if there are UI/UX changes

Description

Adds a selector to the NLP UI to allow switching question label languages. The places that would be affected by such a change are:

Notes

Ended up having to pass asset instead of assetContent in some places due to needing the entire AssetResponse in order to use getLanguageIndex. Tried to make these changes minimal but maybe better to just change all cases to use asset instead of sometimes both.

Related issues

Task 624 of NLP improvements

duvld added 3 commits May 7, 2024 00:30
 Please enter the commit message for your changes. Lines starting
@duvld duvld requested a review from magicznyleszek May 8, 2024 04:22
@magicznyleszek magicznyleszek changed the title Allow users to select between translated labels and XML names for displayed form questions in NLP UI [TASK-624] Allow users to select between translated labels and XML names for displayed form questions in NLP UI May 8, 2024
Base automatically changed from nlp-addons-select-data-questions-displayed to beta May 8, 2024 20:51
@magicznyleszek magicznyleszek self-assigned this May 10, 2024
}
});
} else {
languagesList.push({label: t('Default'), value: 'default'});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make it so it works similarly to "Data → Table → Display options" modal? I.e. that you will see the "default" option as being selected? I'm guessing you would need to return 'default' in getInitialDisplayedLanguage instead of empty string. Or change the value: 'default' to value: ''

getDisplayedLanguagesList(): KoboSelectOption[] {
const languagesList = [];

languagesList.push({label: t('XML names'), value: 'xml_names'});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In "Data → Table → Display options" modal, if you have a project with no languages being defined, you will see two options: "XML Values" and "Labels" - let's stick to the same naming, so it's clear these are the same.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried making the changes for this one and above. Not 100% I understand so lmk if I did it right

<Button
size='m'
type='bare'
label={t('Change question language')}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not fond of this label. And as I was trying to think about better name, like "Labels settings", "Data settings", I started thinking about moving this into the "Display settings" modal after all… Sorry! Will ask Tessa in public topic about her two cents.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The decision on Zulip topic is to put labels settings inside display settings modal, sorry!

@magicznyleszek magicznyleszek merged commit b6e5a4e into beta Jul 1, 2024
4 checks passed
@magicznyleszek magicznyleszek deleted the nlp-addons-task-624-change-displayed-language branch July 1, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants