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

i18n: Extract wp/i18n translatable strings #28200

Merged
merged 2 commits into from
Nov 2, 2018

Conversation

akirk
Copy link
Member

@akirk akirk commented Oct 31, 2018

This adds the Gutenberg-style translatable strings (__(), _x(), _n(), and _nx()) to the methods we extract for translation.

Testing instructions

Compare with the npm run translate without this change to make sure this only adds and not removes strings to calypso-strings.pot.

You could use diff or podiff to check this with a sequence of commands like this:

npm run translate
mv calypso-strings.pot calypso-strings-__.pot
git co master
npm run translate
podiff calypso-strings.pot calypso-strings-__.pot

(Unfortunately podiff has a bug regarding multiline contexts, so you'll need to use my patched version).

@matticbot
Copy link
Contributor

@akirk akirk added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Nov 2, 2018
@akirk akirk requested a review from tyxla November 2, 2018 09:41
package.json Outdated
@@ -267,7 +267,7 @@
"test-server": "jest -c=test/server/jest.config.js",
"test-server:coverage": "npm run -s test-server -- --coverage",
"test-server:watch": "npm run -s test-server -- --watch",
"translate": "i18n-calypso --format pot --output-file ./calypso-strings.pot -e date \"**/*.js\" \"**/*.jsx\" \"!build/**\" \"!node_modules/**\" \"!public/**\"",
"translate": "i18n-calypso --format pot --output-file ./calypso-strings.pot -k translate,__,_x,_n -e date \"**/*.js\" \"**/*.jsx\" \"!build/**\" \"!node_modules/**\" \"!public/**\"",
Copy link
Member

Choose a reason for hiding this comment

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

Are we planning to also target _nx()?

@akirk akirk force-pushed the add/i18n-extract-gutenberg-strings branch from ea1d178 to 874b1a0 Compare November 2, 2018 09:51
Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

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

🚢

@akirk akirk merged commit 242414e into master Nov 2, 2018
@tyxla tyxla deleted the add/i18n-extract-gutenberg-strings branch November 2, 2018 11:42
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Nov 2, 2018
ockham added a commit that referenced this pull request Nov 13, 2018
akirk pushed a commit that referenced this pull request Nov 20, 2018
ockham added a commit that referenced this pull request Nov 20, 2018
akirk added a commit that referenced this pull request Nov 27, 2018
…he CI (#28842)

* Framework: Add @wordpress/babel-plugin-makepot dev dependency

* Build: Use makepot Babel plugin to build pot file

* Revert "i18n: Extract wp/i18n translatable strings (#28200)"

This reverts commit 242414e.

* Start with a babel-plugin-i18n-calypso

* typo

* Try to avoid need for building by using CJS

* Extract translate calls to POT

* Integrate babel-plugin-makepot

* Remove the translate command

* Try a new NODE_ENV

* set the calypso env

* WIP write to different files to see where strings are dropped

* Write single files and concat them using msgcat

* Make sure msgcat is available on CircleCI

* Remove makepot functionality

* Move build files into the build directory

* Unify POT headers

* Improve POT filenames

* Incorporate review feedback

* typo

* Format plugin with prettier

* Remove CI related changes

* Build POT using the Babel plugin
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