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

DCOS-43383: Translate /plugins component strings #3372

Merged
merged 87 commits into from
Nov 5, 2018

Conversation

natmegs
Copy link
Contributor

@natmegs natmegs commented Oct 24, 2018

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.

Copy link
Contributor

@brandonc brandonc left a 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?

plugins/services/src/js/components/DeploymentsModal.js Outdated Show resolved Hide resolved
plugins/services/src/js/components/DeploymentsModal.js Outdated Show resolved Hide resolved
@@ -513,7 +530,13 @@ class CreateServiceModalForm extends Component {
<TabButton
className={item.className}
id={item.id}
label={item.label}
label={
Copy link
Contributor

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?

Copy link
Contributor Author

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

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._(
Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor

@brandonc brandonc left a 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

@natmegs natmegs force-pushed the natalie/feat/DCOS-43383-strings-plugins branch 3 times, most recently from d352909 to 990b811 Compare October 26, 2018 02:27
@nLight nLight force-pushed the natalie/feat/DCOS-43383-strings-plugins branch from 990b811 to b015a4e Compare October 26, 2018 14:48
@nLight
Copy link
Contributor

nLight commented Oct 26, 2018

rebased + added a small commit to include #3336 I didn't run lingui-extract-with-plugins as it has created a lot of new strings with the latest plugins so I decided to leave it to you :)

@@ -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.
Copy link
Contributor

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",
Copy link
Contributor

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}>
Copy link
Contributor

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:
Copy link
Contributor

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?

Copy link
Contributor Author

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");
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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 =
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (serviceCount === 1) {
// L10NTODO: Pluralize
if (serviceCount === 1) {

findNestedPropertyInObject(appConfig, "containers.length") || 1
);
const serviceLabel =
(findNestedPropertyInObject(appConfig, "containers.length") || 1) === 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
(findNestedPropertyInObject(appConfig, "containers.length") || 1) === 1
// L10NTODO: Pluralize
(findNestedPropertyInObject(appConfig, "containers.length") || 1) === 1

@natmegs natmegs force-pushed the natalie/feat/DCOS-43383-strings-plugins branch from b015a4e to 81f98d1 Compare October 26, 2018 19:36
@natmegs
Copy link
Contributor Author

natmegs commented Oct 26, 2018

@nLight Thanks for the feedback! I've addressed your comments but it's not obvious since they have not been marked as 'outdated'

@natmegs natmegs force-pushed the natalie/feat/DCOS-43383-strings-plugins branch from 81f98d1 to 581b127 Compare October 31, 2018 17:33
Copy link
Contributor

@brandonc brandonc left a 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._(
Copy link
Contributor

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.

@natmegs natmegs force-pushed the natalie/feat/DCOS-43383-strings-plugins branch 2 times, most recently from 5e4a893 to 0b0e810 Compare October 31, 2018 20:47
brandonc
brandonc previously approved these changes Oct 31, 2018
DanielMSchmidt
DanielMSchmidt previously approved these changes Nov 5, 2018

cy.wait(700).then(function() {
expect(document.querySelectorAll(".modal").length).to.equal(0);
});
});
});
});

context("Rollback modal", function() {
Copy link
Contributor

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()
Copy link
Contributor

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.

@DanielMSchmidt
Copy link
Contributor

@natmegs The CI errors look like something on the service page is wrong

natmegs and others added 22 commits November 5, 2018 09:21
…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.
@natmegs natmegs dismissed stale reviews from DanielMSchmidt and brandonc via e2dcf8a November 5, 2018 17:23
@natmegs natmegs force-pushed the natalie/feat/DCOS-43383-strings-plugins branch from 0b0e810 to e2dcf8a Compare November 5, 2018 17:23
@brandonc brandonc merged commit 9ee59c2 into master Nov 5, 2018
@brandonc brandonc deleted the natalie/feat/DCOS-43383-strings-plugins branch November 5, 2018 21:31
@mesosphere-ci
Copy link
Collaborator

🎉 This PR is included in version 2.35.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

None yet

6 participants