Merge pull request #23989 from woocommerce/add/package-textdomain-replace

Textdomain replacement for packages
This commit is contained in:
Mike Jolley 2019-06-26 15:12:54 +01:00 committed by GitHub
commit 49c293864d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 65 additions and 13 deletions

52
bin/package-update.sh Normal file
View File

@ -0,0 +1,52 @@
#!/bin/sh
# Output colorized strings
#
# Color codes:
# 0 - black
# 1 - red
# 2 - green
# 3 - yellow
# 4 - blue
# 5 - magenta
# 6 - cian
# 7 - white
output() {
echo "$(tput setaf "$1")$2$(tput sgr0)"
}
updating=false
# Script args.
while [ ! $# -eq 0 ]
do
case "$1" in
--updating | -u)
updating=true
;;
esac
shift
done
# Autoloader
output 3 "Updating autoloader classmaps..."
composer dump-autoload --no-dev
output 2 "Done"
# Convert textdomains
output 3 "Updating package textdomains..."
# Replace text domains within packages with woocommerce
find ./packages/woocommerce-blocks -iname '*.php' -exec sed -i.bak -e "s/, 'woo-gutenberg-products-block'/, 'woocommerce'/g" {} \;
find ./packages/woocommerce-rest-api -iname '*.php' -exec sed -i.bak -e "s/, 'woocommerce-rest-api'/, 'woocommerce'/g" {} \;
# Cleanup backup files
find ./packages -name "*.bak" -type f -delete
output 2 "Done"
if ( $updating ); then
# Update POT file
output 3 "Updating POT file..."
grunt makepot
output 2 "Done"
fi

View File

@ -32,10 +32,10 @@
},
"scripts": {
"post-install-cmd": [
"composer dump-autoload --no-dev"
"sh ./bin/package-update.sh"
],
"post-update-cmd": [
"composer dump-autoload --no-dev"
"sh ./bin/package-update.sh --updating"
],
"test": [
"phpunit"
@ -52,8 +52,8 @@
},
"extra": {
"installer-paths": {
"vendor/woocommerce-rest-api": ["woocommerce/woocommerce-rest-api"],
"vendor/woocommerce-blocks": ["woocommerce/woocommerce-blocks"]
"packages/woocommerce-rest-api": ["woocommerce/woocommerce-rest-api"],
"packages/woocommerce-blocks": ["woocommerce/woocommerce-blocks"]
},
"scripts-description": {
"test": "Run unit tests",

18
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "bd3583eea7bbf9c0401e52371ae1baf9",
"content-hash": "e52a74aadbfa3411e205ffd3295a9045",
"packages": [
{
"name": "automattic/jetpack-autoloader",
@ -168,12 +168,12 @@
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-gutenberg-products-block.git",
"reference": "64fdbe613ee66d5444696428567f3b683b1a2b06"
"reference": "d17885ea1fff530ab6bd79d57e8ab4224600ec43"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/64fdbe613ee66d5444696428567f3b683b1a2b06",
"reference": "64fdbe613ee66d5444696428567f3b683b1a2b06",
"url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/d17885ea1fff530ab6bd79d57e8ab4224600ec43",
"reference": "d17885ea1fff530ab6bd79d57e8ab4224600ec43",
"shasum": ""
},
"require": {
@ -202,7 +202,7 @@
],
"description": "Feature plugin for the WooCommerce Gutenberg Products block",
"homepage": "https://woocommerce.com/",
"time": "2019-06-21T18:08:00+00:00"
"time": "2019-06-24T11:20:32+00:00"
},
{
"name": "woocommerce/woocommerce-rest-api",
@ -210,12 +210,12 @@
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-rest-api.git",
"reference": "2943708bb12f70b845f32e5f26893436a926a1ee"
"reference": "a518b9cfd1dec42a59aa10240a31782bc1d43d13"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-rest-api/zipball/2943708bb12f70b845f32e5f26893436a926a1ee",
"reference": "2943708bb12f70b845f32e5f26893436a926a1ee",
"url": "https://api.github.com/repos/woocommerce/woocommerce-rest-api/zipball/a518b9cfd1dec42a59aa10240a31782bc1d43d13",
"reference": "a518b9cfd1dec42a59aa10240a31782bc1d43d13",
"shasum": ""
},
"require": {
@ -243,7 +243,7 @@
],
"description": "The WooCommerce core REST API.",
"homepage": "https://github.com/woocommerce/woocommerce-rest-api",
"time": "2019-06-21T13:57:26+00:00"
"time": "2019-06-21T18:58:20+00:00"
}
],
"packages-dev": [