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

Add dynamic language options and translate locale picker #15553

Conversation

jatinsonijs
Copy link
Contributor

Details

We have language selection at two places one at login page and another at preference page. In preference page we are translating language option also based on selected language but in login page it is not changing. To fix this changed login page locale picker to behave same like preference language selection - change picker values also based on selected language.

Fixed Issues

$ #15285
PROPOSAL: #15285 (comment)

Tests

  1. Logout if already logged in.
  2. From locale / language picker change the language.
  3. Open the locale picker again.
  4. Verify locale picker values are also translated based on selected language.
  • Verify that no errors appear in the JS console

Offline tests

  1. Logout if already logged in.
  2. Turn off network.
  3. From locale / language picker change the language.
  4. Open the locale picker again.
  5. Verify locale picker values are also translated based on selected language.

QA Steps

  1. Logout if already logged in.
  2. From locale / language picker change the language.
  3. Open the locale picker again.
  4. Verify locale picker values are also translated based on selected language.
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
web.mov
Mobile Web - Chrome
android-chrome.mov
Mobile Web - Safari
ios-safari.mov
Desktop
desktop.mov
iOS
ios.mov
Android
android.mov

@jatinsonijs jatinsonijs requested a review from a team as a code owner February 28, 2023 07:42
@melvin-bot melvin-bot bot requested review from aldo-expensify and rushatgabhane and removed request for a team February 28, 2023 07:42
@MelvinBot
Copy link

@aldo-expensify @rushatgabhane One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

Comment on lines 38 to 42
label={
props.size === 'normal'
? props.translate('languagePage.language')
: null
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation looks wrong, please fix 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines 53 to 55
containerStyles={
props.size === 'small' ? [styles.pickerContainerSmall] : []
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation looks wrong, please fix 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rushatgabhane
Copy link
Member

reviewing today

@rushatgabhane
Copy link
Member

rushatgabhane commented Mar 1, 2023

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web

Uploading Screen Recording 2023-03-02 at 4.20.09 AM.mov…

Mobile Web - Chrome
Screen.Recording.2023-03-02.at.4.22.59.AM.mov
Mobile Web - Safari
Screen.Recording.2023-03-02.at.4.22.42.AM.mov
Desktop
Screen.Recording.2023-03-02.at.4.24.04.AM.mov
iOS
Screen.Recording.2023-03-02.at.4.25.19.AM.mov
Android
WhatsApp.Video.2023-03-02.at.04.28.58.mp4

Copy link
Member

@rushatgabhane rushatgabhane left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@aldo-expensify aldo-expensify 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 both! tested well for me.

@aldo-expensify aldo-expensify merged commit 3f1379c into Expensify:main Mar 1, 2023
@OSBotify
Copy link
Contributor

OSBotify commented Mar 1, 2023

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2023

Performance Comparison Report 📊

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
Open Search Page TTI 648.715 ms → 694.692 ms (+45.977 ms, +7.1%)
App start nativeLaunch 20.500 ms → 21.267 ms (+0.767 ms, +3.7%)
App start TTI 695.333 ms → 696.002 ms (+0.669 ms, ±0.0%)
App start regularAppStart 0.014 ms → 0.014 ms (+0.000 ms, +2.1%)
App start runJsBundle 191.094 ms → 189.156 ms (-1.938 ms, -1.0%)
Show details
Name Duration
Open Search Page TTI Baseline
Mean: 648.715 ms
Stdev: 37.367 ms (5.8%)
Runs: 594.5437429999001 605.583415000001 606.8105059999507 608.4763189998921 614.6478269998915 615.1261809999123 621.0341389998794 622.2697349998634 622.3022050000727 622.5658780001104 623.3851320000831 623.8535150000826 626.1346030000132 628.0885419999249 628.1504319999367 633.7443440000061 634.9455160000362 639.8438309999183 646.6527909999713 652.921590999933 658.5257170000114 659.8927820001263 663.9340010001324 665.4254970001057 666.9139809999615 666.948406000156 677.5454510001 679.0795500001404 700.0768230000976 713.7227380000986 717.3597829998471 717.3898930000141 749.6998699998949

Current
Mean: 694.692 ms
Stdev: 28.186 ms (4.1%)
Runs: 638.279499999946 642.5608729999512 664.9048260001 665.3378089999314 670.6244310000911 670.9859209998976 676.9197599999607 678.4035650000442 678.4977219998837 678.6402590000071 678.7465410002042 680.7613929999061 681.4651699999813 682.8399659998249 683.4809570000507 687.5015459998976 688.7478430001065 693.3880209999625 693.8212079999503 695.3357750000432 695.5093189999461 697.5510660000145 697.9379879999906 702.2280679999385 714.4117839999963 717.5414230001625 719.4377850000747 733.62695299997 734.6400550000835 735.0651859999634 737.9208579999395 745.640951000154 762.0744229999837
App start nativeLaunch Baseline
Mean: 20.500 ms
Stdev: 1.668 ms (8.1%)
Runs: 18 18 18 18 18 19 20 20 20 20 20 20 20 20 20 20 21 21 21 21 21 21 21 21 22 22 22 23 24 25

Current
Mean: 21.267 ms
Stdev: 2.048 ms (9.6%)
Runs: 18 18 18 19 19 19 20 20 20 20 21 21 21 21 21 21 21 22 22 22 22 22 22 22 23 23 24 24 25 27
App start TTI Baseline
Mean: 695.333 ms
Stdev: 32.961 ms (4.7%)
Runs: 644.9057559999637 651.7235620000865 654.0434550000355 656.0885270000435 659.962273000041 662.5697439999785 667.8540109999012 669.2327870000154 671.3229259999935 672.5157920001075 674.9660189999267 677.9406469999813 679.3587889999617 683.2567539999727 684.2246890000533 686.6151350000873 687.792958999984 688.7995810001157 692.2597159999423 697.7753399999347 707.28252899996 709.4293680000119 713.1121580000035 717.0301230000332 725.3208029998932 729.128902999917 729.4995049999561 734.6008570000995 740.2180910001043 752.1828980001155 764.2130819999147 765.4432969999034

Current
Mean: 696.002 ms
Stdev: 30.015 ms (4.3%)
Runs: 637.7699889999349 651.5167219999712 652.3433479999658 659.1747320001014 671.5165560001042 671.739770000102 671.830498999916 672.7016980000772 678.3760029999539 683.428915000055 685.0804789999966 686.1810699999332 686.2702430000063 688.4348430000246 688.6243509999476 688.7578280000016 695.2974970000796 695.6438160000835 697.2108909999952 701.9933450000826 702.3036209999118 706.893354000058 708.3107799999416 711.2822300000116 719.0015839999542 727.5069099999964 728.4752670000307 739.0258599999361 751.077825000044 756.0378870000131 762.2657019998878
App start regularAppStart Baseline
Mean: 0.014 ms
Stdev: 0.001 ms (4.9%)
Runs: 0.012206999817863107 0.012655000202357769 0.012695000041276217 0.012735999887809157 0.012817000038921833 0.012818000046536326 0.01306200004182756 0.013101999880746007 0.01310200011357665 0.013264999957755208 0.013264999957755208 0.0133050000295043 0.01334599987603724 0.013386999955400825 0.013508999953046441 0.013550000032410026 0.013590999878942966 0.013672000030055642 0.013794000027701259 0.013875000178813934 0.013915999792516232 0.013916000025346875 0.013956000097095966 0.013956999871879816 0.01432300009764731 0.014404000015929341 0.014444999862462282 0.014484999934211373 0.01485200016759336 0.014933000085875392

Current
Mean: 0.014 ms
Stdev: 0.001 ms (4.5%)
Runs: 0.012775999959558249 0.012980999890714884 0.01306200004182756 0.013142999960109591 0.013184000039473176 0.013386999955400825 0.013428000034764409 0.013467999873682857 0.013469000114127994 0.013508999953046441 0.013509000185877085 0.013549999799579382 0.013550000032410026 0.013672000030055642 0.013752999948337674 0.013752999948337674 0.013753999955952168 0.013794000027701259 0.013794000027701259 0.013876000186428428 0.013916000025346875 0.014079000102356076 0.014201000100001693 0.014283000025898218 0.01436399994418025 0.014444999862462282 0.014607999939471483 0.014771000016480684 0.015056000091135502 0.015056000091135502 0.015339999925345182
App start runJsBundle Baseline
Mean: 191.094 ms
Stdev: 21.616 ms (11.3%)
Runs: 157 161 166 168 170 170 171 175 175 177 178 179 183 184 185 186 186 187 189 196 198 201 202 203 208 211 211 213 217 219 241 248

Current
Mean: 189.156 ms
Stdev: 15.609 ms (8.3%)
Runs: 162 164 166 169 170 174 175 179 180 180 181 182 184 187 188 188 188 189 190 190 191 195 196 198 201 204 206 210 213 215 218 220

@OSBotify
Copy link
Contributor

OSBotify commented Mar 2, 2023

🚀 Deployed to staging by https://github.com/aldo-expensify in version: 1.2.78-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

OSBotify commented Mar 6, 2023

🚀 Deployed to production by https://github.com/mountiny in version: 1.2.78-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

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.

5 participants