-
Notifications
You must be signed in to change notification settings - Fork 81
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
DCOS-43383: Translate /plugins component strings #3372
Conversation
19fdcee
to
ea00082
Compare
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.
Wow! That was a tedious review. Thanks for organizing your commits that made it a lot easier. Only one or two minor items. Another question: Can we now remove react-intl and if not can you remove any more en-us catalog items based on some of the migrations you did?
@@ -513,7 +530,13 @@ class CreateServiceModalForm extends Component { | |||
<TabButton | |||
className={item.className} | |||
id={item.id} | |||
label={item.label} | |||
label={ |
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 may be misreading rn, but when is label not a string?
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 believe there is a situation where it was being passed a styled span
thus breaking Trans
plugins/services/src/js/components/modals/ServiceActionDisabledModal.js
Outdated
Show resolved
Hide resolved
plugins/services/src/js/service-configuration/ServiceConfigBaseSectionDisplay.js
Outdated
Show resolved
Hide resolved
required: false, | ||
min: "0", | ||
max: `${numberOfRepositories}`, | ||
step: "1", | ||
validationErrorText: `Must be a positive integer between 0 and ${numberOfRepositories} representing its priority. 0 is the highest and ${numberOfRepositories} denotes the lowest priority.`, | ||
validationErrorText: i18n._( |
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 don't think this can be translated this way since you'll get a difference "id" phrase for every numberOfRepositories
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 I was wrong about this? The phrase looks extracted.
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 meant to "request changes" in my last review
d352909
to
990b811
Compare
990b811
to
b015a4e
Compare
rebased + added a small commit to include #3336 I didn't run |
@@ -496,7 +496,7 @@ You will need a fully functional cluster to run your system tests. | |||
|
|||
## i18n | |||
|
|||
DCOS UI uses [React-Intl](https://github.com/yahoo/react-intl) to enable i18n, please look at the documentation. Currently this project is only supporting `en-us` but planning to support more languages/locales in the future. | |||
DCOS UI uses [lingui](https://github.com/lingui/js-lingui) to enable i18n, please look at the documentation. Currently this project is only supporting `en-us` but planning to support more languages/locales in the future. |
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.
❤️
@@ -67,7 +67,6 @@ | |||
"react-addons-pure-render-mixin": "15.4.1", | |||
"react-dom": "15.4.1", | |||
"react-gemini-scrollbar": "2.1.5", | |||
"react-intl": "2.2.3", |
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.
🎉
@@ -101,9 +96,7 @@ RequestUtil.json = function(options = {}) { | |||
language={UserLanguageStore.get()} | |||
catalogs={{ en }} | |||
> | |||
<IntlProvider locale={navigatorLanguage} messages={enUS}> |
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.
🎊
required: false, | ||
min: "0", | ||
max: `${numberOfRepositories}`, | ||
step: "1", | ||
validationErrorText: `Must be a positive integer between 0 and ${numberOfRepositories} representing its priority. 0 is the highest and ${numberOfRepositories} denotes the lowest priority.`, | ||
validationErrorText: |
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.
Why can't we tag the whole thing?
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 was under the misguided impression that i18n._(t...
did not play nicely with strings including variables... but I just tried it now and it seems to work! Will change
@@ -58,17 +59,17 @@ class DeploymentStatusIndicator extends mixin(StoreMixin) { | |||
return null; | |||
} | |||
|
|||
const deploymentText = | |||
deploymentsCount === 1 ? i18nMark("deployment") : i18nMark("deployments"); |
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'd rather // TODO pluralize
. Some languages 🇷🇺 have interesting rules around quantities :D
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.
@brandonc conflicting feedback re: pluralization. Would you mind if I changed these back to L10NTODOs?
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.
Well, tbh I have no idea about what kinds of problems can arise so let's mark it
@@ -512,16 +533,15 @@ class DeploymentsModal extends mixin(StoreMixin) { | |||
</button> | |||
</div> | |||
); | |||
|
|||
// L10NTODO: Pluralize |
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.
👌
findNestedPropertyInObject(appConfig, "containers.length") || 1 | ||
); | ||
const serviceLabel = | ||
(findNestedPropertyInObject(appConfig, "containers.length") || 1) === 1 |
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.
Todo pluralize
@@ -58,17 +59,17 @@ class DeploymentStatusIndicator extends mixin(StoreMixin) { | |||
return null; | |||
} | |||
|
|||
const deploymentText = |
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.
const deploymentText = | |
// L10NTODO: Pluralize | |
const deploymentText = |
return `This will stop the current deployment of ${listOfServiceNames} and | ||
start a new deployment to ${UserActions.DELETE} the affected | ||
${service}.`; | ||
if (serviceCount === 1) { |
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.
if (serviceCount === 1) { | |
// L10NTODO: Pluralize | |
if (serviceCount === 1) { |
findNestedPropertyInObject(appConfig, "containers.length") || 1 | ||
); | ||
const serviceLabel = | ||
(findNestedPropertyInObject(appConfig, "containers.length") || 1) === 1 |
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.
(findNestedPropertyInObject(appConfig, "containers.length") || 1) === 1 | |
// L10NTODO: Pluralize | |
(findNestedPropertyInObject(appConfig, "containers.length") || 1) === 1 |
b015a4e
to
81f98d1
Compare
@nLight Thanks for the feedback! I've addressed your comments but it's not obvious since they have not been marked as 'outdated' |
81f98d1
to
581b127
Compare
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.
Only one remaining item! (See added comment to previous review)
required: false, | ||
min: "0", | ||
max: `${numberOfRepositories}`, | ||
step: "1", | ||
validationErrorText: `Must be a positive integer between 0 and ${numberOfRepositories} representing its priority. 0 is the highest and ${numberOfRepositories} denotes the lowest priority.`, | ||
validationErrorText: i18n._( |
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 I was wrong about this? The phrase looks extracted.
5e4a893
to
0b0e810
Compare
|
||
cy.wait(700).then(function() { | ||
expect(document.querySelectorAll(".modal").length).to.equal(0); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
context("Rollback modal", function() { |
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.
Nice 👍
@@ -72,7 +72,9 @@ describe("EditServiceModal", function() { | |||
|
|||
const wrapper = shallow( | |||
<EditServiceModal params={{ id: "/my-new-service" }} /> | |||
); | |||
) | |||
.dive() |
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.
TIL about .dive
, I normally switch to mount
on this occasions.
@natmegs The CI errors look like something on the service page is wrong |
…trings Mark and pretranslate component strings as neccessary, and replace unit tests with more appropriate integration tests.
Translate SearchLog component strings using combination of marking/macros and pretranslation with withI18next HOC. Modify applicable unit tests to use enzyme and to test behaviour rather than internal implementation details. Remove deprecated unit test.
…trings Translate column headings and modify ServiceConfigDisplayUtil render function to display translated marked strings. Modify headings in other components that use the util to be functions instead of Trans elements.
Translate text content, including marking and pretranslating bare strings, in all Nodes components.
Translate component text, including marking and pretranslating bare strings, for all Jobs components.
Translate text content, including marking and pretranslating bare strings, in all Repositories components.
Update translation catalog with all extracted messages. Closes DCOS-43383.
0b0e810
to
e2dcf8a
Compare
🎉 This PR is included in version 2.35.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Testing
There should be no visual changes as a result of these commits.
Trade-offs
Many unit tests had to be refactored, rewritten, or converted to integration tests.