WordPress Plugin i18n, Webpack, and Composer

The Tower of Babel screwed all of us. i18n is more complicated than it should be for something that everyone deals with.

Developer Resources

By: Brad Jorsch

A lot of work has been going on in the Jetpack plugin lately. We have UIs built in React, with the JavaScript bundles being created by Webpack. We have Composer packages used for code sharing, increasingly so as we look into creating standalone plugins like Jetpack Backup and Jetpack Search. And we want everything to be translated for people who speak languages other than English.

A few months back we started getting reports that some translations in Jetpack had gone missing. As we looked into it, we eventually found no fewer thansixdifferent ways that translation was broken!

  1. JavaScript bundles weren’t being scanned due to bad file naming.
  2. Webpack’s optimizations were breaking thei18nfunction calls so WordPress.org’s translation infrastructure couldn’t find them.
  3. Lazy-loaded Webpack bundles weren’t lazy-loading translation data.
  4. Shared React component translations didn’t work in plugins other than Jetpack itself.
  5. Bundled Composer packages weren’t being scanned.

View original post 1,979 more words


Installing SVN

The latest versions of xcode no longer includes SVN, so if you’re installing it fresh, you’re out of luck.

Running brew install svn installed it, but was giving me a Symbol not found: _apr_crypto_block_cleanup error.

I was able to fix that by running brew reinstall apr-util

Now I’m back to the early 2000s!

Bulk Remove Labels

gh pr list --label "[Status] Needs Review" --state closed --json number -L 350| jq '.[].number' | xargs -L 1 gh pr edit --remove-label "[Status] Needs Review"

We usually have an automation that removes some labels from a PR once it is merged. I haven’t looked into why that happened, but wanted to bulk remove it without having to use the UI.

This uses the gh cli command, installed via brew install gh on OS X and jq command, installed via brew install jq

First, it requests a list of PRs with the given label, that are closed, outputted in JSON with just the PR number with a limit of up to 350 issues (we had like 330 that were missed).

That pipes it to jq which parses out, in this case, the number field from every json object.

That’s piped to xargs which takes one line per execution and passes it to gh‘s pr edit command to remove that specific label.