-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
chore(translations): Add missing i18n #17525
Changes from 4 commits
c3f28de
a2ebcc2
7a5a1ab
0167d97
dc2aeb9
b02d3e0
9e60adb
755fcff
75d0990
787009d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,16 +121,16 @@ const getEntityUrl = (entity: ActivityObject) => { | |
|
||
const getEntityLastActionOn = (entity: ActivityObject) => { | ||
// translation keys for last action on | ||
const LAST_VIEWED = `Viewed %s`; | ||
const LAST_MODIFIED = `Modified %s`; | ||
const LAST_VIEWED = 'Viewed %s'; | ||
const LAST_MODIFIED = 'Modified %s'; | ||
|
||
// for Recent viewed items | ||
if ('time_delta_humanized' in entity) { | ||
return t(LAST_VIEWED, entity.time_delta_humanized); | ||
return t('Viewed %s', entity.time_delta_humanized); | ||
} | ||
|
||
if ('changed_on_delta_humanized' in entity) { | ||
return t(LAST_MODIFIED, entity.changed_on_delta_humanized); | ||
return t('Modified %s', entity.changed_on_delta_humanized); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
} | ||
|
||
let time: number | string | undefined | null; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
[jinja2: superset/**/templates/**.html] | ||
[javascript: superset-frontend/src/**.js] | ||
[javascript: superset-frontend/src/**.jsx] | ||
[javascript: superset-frontend/src/**.ts] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zhaoyongjie let's make sure translations are properly handled after monorepo lands! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will add plugins and packages to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool thanks @zhaoyongjie ! |
||
[javascript: superset-frontend/src/**.tsx] | ||
|
||
encoding = utf-8 |
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'm not sure this change is necessary - I assume the variable value should be picked up here. Did you check if that's not the case?
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 verified, but using constants, the string was not extracted. gilbsgilbs/babel-plugin-i18next-extract#109 seems to confirm this, though the FAQ only speaks of variables, not constants.
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.
In addition, this whole section seems to rely on
time_delta_humanized
andchanged_on_delta_humanized
being localized, which apparently is not the case:For other tables/columns, this seems to be handled differently:
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.
Oh interesting. Maybe I need to switch my local devenv to non-english to catch these, too. It's becoming apparent we need a proper developer tutorial for i18n, as it's obvious this is not being handled consistently across the app.
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.
To avoid duplication and risk of these falling out of sync, maybe we should introduce a similar localized translation mapping as I did in the previous PR:
superset/superset-frontend/src/views/CRUD/welcome/EmptyState.tsx
Lines 25 to 30 in bdc6a1d
Regarding
time_delta_humanized
, I'm pretty sure these are happening in the backend, let me look at those (I have a faint memory of when those were introduced).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 wonder why
time_delta_humanized
andchanged_on_delta_humanized
are necessary? moment.fromNow seems to localize pretty well. Aren'ttime
/changed_on
/changed_on_utc
avaible for every item? Code would become more compact: