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

Implement new language variants #3458

Merged
merged 39 commits into from
Feb 22, 2022
Merged

Implement new language variants #3458

merged 39 commits into from
Feb 22, 2022

Conversation

mozgzh
Copy link
Contributor

@mozgzh mozgzh commented Feb 9, 2022

Frontend

JIRA ticket: https://mozilla-hub.atlassian.net/browse/OI-2044

  • Some fixing up of existing components
  • Adds ability to select a language variant is available.
  • Currently has a placeholder empty endpoint to be implemented in Implement new language variants #3458
  • Add improved accessibility ExpandableInformation component to replace broken component (profile-toggle)
  • Add help text when a variant is shown in UI

Backend

...

Database

Add two tables for variants

  • variants holds the literally variant types and associated labeling
  • user_client_variants holds the relation between a user and the variant

@zcolleyz zcolleyz self-requested a review February 14, 2022 15:08
common/locale.ts Outdated Show resolved Hide resolved
.eslintrc.js Show resolved Hide resolved
@@ -437,6 +530,7 @@ const UserClient = {
updateDemographicsPromise,
this.claimContributions(clientId, clientIds),
languages && updateLanguages(clientId, languages),
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering here instead of adding another line for variants we rename updateLanguages to updateAccents and then add a function like:

/**
 * Updates languages for a given user
 *
 * @param clientId clientId as string
 * @param languages array of UserLanguage
 * @returns void
 */
async function updateLanguages(clientId: string, languages: UserLanguage[]) {
  return Promise.all([
    updateAccents(clientId, languages),
    updateVariants(clientId, languages),
  ]);
}

@@ -0,0 +1,71 @@
const VARIANTS = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to remove this test data

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, need to remove test data, but ill keep it for now, as itll be the basis of the import script once variants are decided

@zcolleyz zcolleyz changed the title Serverside changes for new language variants Implement new language variants Feb 16, 2022
@zcolleyz zcolleyz self-requested a review February 16, 2022 18:06
@zcolleyz zcolleyz removed their request for review February 21, 2022 10:55
@zcolleyz
Copy link
Contributor

Pushed up an update for the label copy: 60acd5c

@zcolleyz
Copy link
Contributor

Could there be an option here for "My variant is not listed here" or "I can't find my variant in the list" ?

@ftyers Good idea, I'll post it on the JIRA ticket so EM can give some input there too

@mozgzh
Copy link
Contributor Author

mozgzh commented Feb 22, 2022

Going to merge this in dev to get some more eyes for QA

@mozgzh mozgzh merged commit 8446dd6 into main Feb 22, 2022
@mozgzh mozgzh deleted the add-variant-language-data branch February 22, 2022 18:20
zcolleyz pushed a commit that referenced this pull request Feb 24, 2022
* Add migration for new variant table

* Remove repeated data

* Add initial variants query

* Add GET route for variant

* Format code

* Add working variants query

* Add types for variants

* Add init user variant update logic

* Refactor diff function and add unit tests

* Update variant method to handle erroneous variant ids

* Init user endpoint for variants

* Update tslint

* Simplify getdiff code

* Simplify getdiff code

* Clean up erroneous variables

* Use newer type

* Update variant type

* Updat variant migrations

* Refactor update endpoint for one variant per language

* Remove early return

* chore(languages): fix up current components

* feat(variant): UI for new language variants

* fix(api): placeholder api response for variants

* chore(linting): please tslint

* fix(accessibility): replace broken expandable info component

* feat(variants): add help text when variant option present

* Update user client queries

* Remove extra accent check

* Fix join when variants table empty

* change comment

* Update variant join to ensure it matches locale

* Use variant api

* Clean up log

* feat(variant): update label for UI

* Remove test data

* Add variant data

* Ensure user_clients variants are deleted if variant is also deleteD

* Add variant data and import it

Co-authored-by: g <g@pop-os.localdomain>
Co-authored-by: Zac Colley <zac@mozillafoundation.org>
zcolleyz pushed a commit that referenced this pull request Feb 24, 2022
* Add migration for new variant table

* Remove repeated data

* Add initial variants query

* Add GET route for variant

* Format code

* Add working variants query

* Add types for variants

* Add init user variant update logic

* Refactor diff function and add unit tests

* Update variant method to handle erroneous variant ids

* Init user endpoint for variants

* Update tslint

* Simplify getdiff code

* Simplify getdiff code

* Clean up erroneous variables

* Use newer type

* Update variant type

* Updat variant migrations

* Refactor update endpoint for one variant per language

* Remove early return

* chore(languages): fix up current components

* feat(variant): UI for new language variants

* fix(api): placeholder api response for variants

* chore(linting): please tslint

* fix(accessibility): replace broken expandable info component

* feat(variants): add help text when variant option present

* Update user client queries

* Remove extra accent check

* Fix join when variants table empty

* change comment

* Update variant join to ensure it matches locale

* Use variant api

* Clean up log

* feat(variant): update label for UI

* Remove test data

* Add variant data

* Ensure user_clients variants are deleted if variant is also deleteD

* Add variant data and import it

Co-authored-by: g <g@pop-os.localdomain>
Co-authored-by: Zac Colley <zac@mozillafoundation.org>
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.

None yet

3 participants