-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[NoQA] Safely catch translation key when it's wrong or missing #28377
[NoQA] Safely catch translation key when it's wrong or missing #28377
Conversation
@lakchote Wrong assigned. Please ignore this PR |
I dont think we have to worry about the API fallback now, we do not have the violations in place right now so I think we can just proceed with what we have now. Did I miss anything? |
@mountiny When you mentioned:
Does that mean we can leave out test steps and screenshots for this PR? If it does, I think we could continue reviewing the PR |
@dukenv0307 Lets test this by hardcoding different than Expensify domain and then hardcoding wrong translation to see it works fine |
@mountiny @robertKozik I just updated the test steps and screenshots. Please help review when you have time. |
@robertKozik Friendly bump. Please help review the PR |
let userEmail = ''; | ||
Onyx.connect({ | ||
key: ONYXKEYS.SESSION, | ||
waitForCollectionCallback: true, | ||
callback: (val) => { | ||
if (!val) { | ||
return; | ||
} | ||
userEmail = val.email; | ||
}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can create some comment to address why are we need user email here - similar to LocaleListener.connect()
comment below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
src/CONST.ts
Outdated
@@ -930,6 +930,7 @@ const CONST = { | |||
RECEIPTS: 'receipts@expensify.com', | |||
STUDENT_AMBASSADOR: 'studentambassadors@expensify.com', | |||
SVFG: 'svfg@expensify.com', | |||
EXPENSIFY_EMAIL_DOMAIN: '@expensify', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXPENSIFY_EMAIL_DOMAIN: '@expensify', | |
EXPENSIFY_EMAIL_DOMAIN: '@expensify.com', |
If you have an phone number as your primary contact method the userEmail
gets format : <phone_number>@expensify.sms
so we need to specify top-level domain as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One change in comment, so it will be more descriptive. I'll start doing reviewer checklist now.
src/libs/Localize/index.js
Outdated
import Log from '../Log'; | ||
import Config from '../../CONFIG'; | ||
import translations from '../../languages/translations'; | ||
import CONST from '../../CONST'; | ||
import LocaleListener from './LocaleListener'; | ||
import BaseLocaleListener from './LocaleListener/BaseLocaleListener'; | ||
import ONYXKEYS from '../../ONYXKEYS'; | ||
|
||
// Save the email after user logins |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Save the email after user logins | |
// Current user mail is needed for handling missing translations |
Reviewer Checklist
Screenshots/VideosWebweb.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/mountiny in version: 1.3.80-0 🚀
|
@mountiny is this internal QA? |
Yeah I will check this off |
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.80-3 🚀
|
🚀 Deployed to staging by https://github.com/mountiny in version: 1.3.81-0 🚀
|
PR caused this weird confusing thing to happen here -> #28312 (comment) |
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.83-11 🚀
|
2 similar comments
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.83-11 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.83-11 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.83-11 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.3.84-10 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.3.84-10 🚀
|
let userEmail = ''; | ||
Onyx.connect({ | ||
key: ONYXKEYS.SESSION, | ||
waitForCollectionCallback: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dukenv0307 SESSION
onyx key is not a collection key, I'm wondering why waitForCollectionCallback: true
was added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was probably a bad copy pasta we have missed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Np, we will remove it in a TS migration PR 👍
Details
Fixed Issues
$ #27759
PROPOSAL: #27759 (comment)
Tests
Testing in dev env
For example: Update this common.settings in this line to 'wrong'
Offline tests
QA Steps
Testing in dev env
For example: Update this common.settings in this line to 'wrong'
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
web.4.mp4
Mobile Web - Chrome
chrome.mov
Mobile Web - Safari
safari.mov
Desktop
desktop.mov
iOS
ios.mov
Android
android.mov