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

tokenize settings menu and add French translations #14905

Merged
merged 5 commits into from Oct 6, 2021

Conversation

metamoni
Copy link
Contributor

@metamoni metamoni commented Oct 3, 2021

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

This PR aims to tokenize strings in the Settings menu, which are currently defined in the Constant::Settings::TAB_LIST constant. At my current work we ran into issues when storing strings in constants like this, as they get loaded before any translations are looked up, and as a consequence they never get translated into the user's chosen locale. This is why I moved the tokens into a class method. And since we're not using a constant anymore, I moved theSettings module out of the Constants namespace.

Related Tickets & Documents

#14888

QA Instructions, Screenshots, Recordings

  • log in as any user
  • go to /settings
  • verify that the menu on the left includes the following options: Profile, Customization, Notifications, Account, Billing, Organization, Extensions
  • verify that all options in the menu are valid English strings
  • verify that there are no missing translations errors on the page
  • for due diligence, click each option in the menu and verify that it goes to the correct page

UI accessibility concerns?

N/A

Added/updated tests?

  • Yes - minimal updates required, as strings are generated from array rather than hardcoded
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

[Forem core team only] How will this change be communicated?

Will this PR introduce a change that impacts Forem members or creators, the
development process, or any of our internal teams? If so, please note how you
will share this change with the people who need to know about it.

  • I've updated the Developer Docs or
    Storybook (for Crayons components)
  • This PR changes the Forem platform and our documentation needs to be
    updated. I have filled out the
    Changes Requested
    issue template so Community Success can help update the Admin Docs
    appropriately.
  • I've updated the README or added inline documentation
  • I've added an entry to
    CHANGELOG.md
  • I will share this change in a Changelog
    or in a forem.dev post
  • I will share this change internally with the appropriate teams
  • I'm not sure how best to communicate this change and need help
  • This change does not need to be communicated, and this is why not: please
    replace this line with details on why this change doesn't need to be
    shared

@metamoni metamoni requested a review from a team as a code owner October 3, 2021 11:41
@pr-triage pr-triage bot added the PR: unreviewed bot applied label for PR's with no review label Oct 3, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2021

Thank you for opening this PR! We appreciate you!

For all pull requests coming from third-party forks we will need to
review the PR before we can process it through our CI pipelines.

A Forem Team member will review this contribution and get back to
you as soon as possible!

@@ -30,6 +30,14 @@
# available at https://guides.rubyonrails.org/i18n.html.

en:
settings_menu:
profile: Profile
Copy link
Contributor

Choose a reason for hiding this comment

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

Currently, we're not being consistent with our usage of quotes in the translation file. While they are strictly speaking not necessary, using them consistently avoids problems with YAML's type coercions. For example, Yes will be turned into a boolean true and no will become false.

Copy link
Contributor Author

@metamoni metamoni Oct 5, 2021

Choose a reason for hiding this comment

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

Oh I didn't know YAML does that. TIL 🎉
I'll update these

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it's one of YAML's more... creative features:

image

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok we should make a decision as i18n-tasks normalize removes quotes and right now we have an English file and a French file without them

create_account: Create account

(we're not enforcing either)

@metamoni metamoni requested review from citizen428 and removed request for a team October 5, 2021 07:19
@@ -30,6 +30,14 @@
# available at https://guides.rubyonrails.org/i18n.html.

en:
settings_menu:
Copy link
Contributor

@citizen428 citizen428 Oct 6, 2021

Choose a reason for hiding this comment

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

Sorry for being so nitpicky but could we keep this file (and the French one) alphabetically sorted, so put settings_menu after core?

Copy link
Contributor Author

@metamoni metamoni Oct 6, 2021

Choose a reason for hiding this comment

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

I merged in the latest version of main, so the settings_menu is all the way at the bottom now, after podcasts.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks a lot @metamoni

@pr-triage pr-triage bot added PR: partially-approved bot applied label for PR's where a single reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Oct 6, 2021
Copy link
Contributor

@rhymes rhymes left a comment

Choose a reason for hiding this comment

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

Thank you @metamoni!

@pr-triage pr-triage bot added PR: reviewed-approved bot applied label for PR's where reviewer approves changes and removed PR: partially-approved bot applied label for PR's where a single reviewer approves changes labels Oct 6, 2021
@rhymes rhymes merged commit bd0b4f1 into forem:main Oct 6, 2021
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged and removed PR: reviewed-approved bot applied label for PR's where reviewer approves changes labels Oct 6, 2021
@cmgorton
Copy link
Contributor

cmgorton commented Oct 6, 2021

Thank you for this contribution @metamoni . Great work here. 🥳

@yheuhtozr yheuhtozr mentioned this pull request Oct 18, 2021
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged bot applied label for PR's that are merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants