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

chore: adding missing translation function #21479

Closed
wants to merge 4 commits into from
Closed

chore: adding missing translation function #21479

wants to merge 4 commits into from

Conversation

AndVK
Copy link
Contributor

@AndVK AndVK commented Sep 15, 2022

SUMMARY

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue: Fixes Superset translation native filters bug #17779
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@rusackas rusackas changed the title Adding missing translation function chore: adding missing translation function Dec 8, 2022
@@ -62,7 +62,7 @@ function DateRangeFilter(

return (
<RangeFilterContainer>
<FormLabel>{Header}</FormLabel>
<FormLabel>{t(Header as string)}</FormLabel>
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain the "as string" need here? If this is a dynamic value, it might not be wise to use the t() here.

Header: column,
? tableColumns.map((column: string[] | string) => ({
accessor: column[0],
Header: column[1],
Copy link
Member

Choose a reason for hiding this comment

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

Is this bycatch? Might need a little explanation of why this is tackled in this PR.

@@ -318,7 +318,7 @@ export default function DateFilterLabel(props: DateFilterControlProps) {
{!validTimeRange && (
<IconWrapper className="warning">
<Icons.ErrorSolidSmall iconColor={theme.colors.error.base} />
<span className="text error">{evalResponse}</span>
<span className="text error">{t(evalResponse)}</span>
Copy link
Member

Choose a reason for hiding this comment

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

I don't know what strings would be expected here, but this sounds highly dynamic and unlikely to be in the translation files. Correct me if I'm mistaken.

@@ -373,7 +373,7 @@ export default function DateFilterLabel(props: DateFilterControlProps) {
>
<Tooltip placement="top" title={tooltipTitle}>
<Label className="pointer" data-test="time-range-trigger">
{actualTimeRange}
{t(`${actualTimeRange}`)}
Copy link
Member

Choose a reason for hiding this comment

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

I don't know what strings would be expected here, but this sounds highly dynamic and unlikely to be in the translation files. Correct me if I'm mistaken.

@@ -53,7 +56,7 @@ class CreatedContent extends React.PureComponent<CreatedContentProps> {
const search = [{ col: 'created_by', opr: 'created_by_me', value: 'me' }];
const query = rison.encode({
keys: ['none'],
columns: ['created_on_delta_humanized', 'dashboard_title', 'url'],
columns: ['changed_on_utc', 'dashboard_title', 'url'],
Copy link
Member

Choose a reason for hiding this comment

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

Please add context on this change... doesn't seem related to the general translation theme of the PR.

@@ -63,8 +66,8 @@ class CreatedContent extends React.PureComponent<CreatedContentProps> {
const mutator = (data: DashboardResponse) =>
data.result.map(dash => ({
dashboard: <a href={dash.url}>{dash.dashboard_title}</a>,
created: dash.created_on_delta_humanized,
_created: dash.created_on_delta_humanized,
created: moment.utc(dash.changed_on_utc).fromNow(),
Copy link
Member

Choose a reason for hiding this comment

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

Again, more context here would be helpful.

@@ -64,16 +68,19 @@ export default class Favorites extends React.PureComponent<FavoritesProps> {
const mutator = (data: DashboardResponse) =>
data.result.map(dash => ({
dashboard: <a href={dash.url}>{dash.dashboard_title}</a>,
created: dash.created_on_delta_humanized,
_created: dash.created_on_delta_humanized,
created: moment.utc(dash.changed_on_utc).fromNow(),
Copy link
Member

Choose a reason for hiding this comment

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

Context for this change also welcomed, thanks!

@@ -76,7 +76,7 @@ export default function LanguagePicker(props: LanguagePickerProps) {
>
<StyledLabel className="f16">
<i className={`flag ${languages[langKey].flag}`} />
<a href={languages[langKey].url}>{languages[langKey].name}</a>
<a href={languages[langKey].url}>{t(languages[langKey].name)}</a>
Copy link
Member

Choose a reason for hiding this comment

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

Just to make sure, I hope having these translated doesn't cause an issue with people having a harder time switching to their preferred language!

@rusackas
Copy link
Member

rusackas commented Dec 8, 2022

Most of this seems a-ok! Thanks for the contribution! The vast majority of the t() calls seem unobjctionable.

There is, however, a fair amount of change in this PR involving Moment and utc timestamps. A description of how that fits in here (and any PR description at all, for that matter) would be helpful.

There are also a couple of translated strings in there that look like they might be fairly dynamic in terms of content. We shouldn't use the t() wrapper unless the translated string is static/stable.

Also noting that this should close out #21200 and this can be done automatically by adding "Fixes: #21200" in your PR description.

@rusackas
Copy link
Member

Hi @AndVK :) I haven't forgotten about this... any chance this can get a rebase and we can push it through? It's so close

@rusackas
Copy link
Member

@AndVK if this is getting to painful to rebase until CI passes and so forth, I'm also fine with splitting it up into smaller PRs that require less strenuous reviews ;) Either way, I still appreciate all this great/hard work!

@AndVK
Copy link
Contributor Author

AndVK commented Jan 20, 2023

Hi, @rusackas! I will split this PR into smaller ones.

@rusackas
Copy link
Member

Hi, @rusackas! I will split this PR into smaller ones.

Fantastic, looking forward to it! Ping me/us here and/or on Slack to make sure we pay attention to them! :D

@hbruch
Copy link
Contributor

hbruch commented Mar 14, 2023

Hi @AndVK!

Thanks for the great work! Do you think you'll be able to split this PR in the next days? If not, I could give a helping hand, if you'd like to...

@rusackas
Copy link
Member

rusackas commented Apr 6, 2023

@AndVK @hbruch do either of you have the bandwidth to carry any pieces of this forward? Leaving it open since it serves as a reminder, and hoping that we can close out #21200 sooner rather than later 🤞

@hbruch
Copy link
Contributor

hbruch commented Apr 7, 2023

Would you mind reviewing #23402 before?

@hbruch
Copy link
Contributor

hbruch commented Apr 9, 2023

I went through the suggested changes and most of them were already handled and merged via @AndVK's #21816 (thanks again!). For the very few missing translations I spotted, I'll submit a PR.

Besides this, two changes suggested by @AndVK are still open and require some code changes:

  • internationalize table columns
  • humanized times/ time deltas. For these, I also think, they should be handled client side

Another category of missing translations are error messages. Not sure, which of the are really end user facing, but a couple of them them will be (e.g. in controls.ts or TTestTable.jsx).

@rusackas
Copy link
Member

Thanks @hbruch. Closing this PR for now, and appreciate the follow-up!

@rusackas rusackas closed this Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants