-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Borrowed from WooCommerce Admin plugin.
- Loading branch information
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Check for required version | ||
WPCLI_VERSION=`wp cli version | cut -f2 -d' '` | ||
if [ ${WPCLI_VERSION:0:1} -lt "2" -o ${WPCLI_VERSION:0:1} -eq "2" -a ${WPCLI_VERSION:2:1} -lt "1" ]; then | ||
echo WP-CLI version 2.1.0 or greater is required to make JSON translation files | ||
exit | ||
fi | ||
|
||
# Substitute JS source references with build references | ||
# For new rules, duplicate the line `-e ...` | ||
for T in `find lang -name "*.po"` | ||
do | ||
sed \ | ||
-e 's/ assets\/onboarding[^:]*:/ assets\/dist\/onboarding\/index.js:/gp' \ | ||
$T | uniq > $T-build | ||
rm $T | ||
mv $T-build $T | ||
done | ||
|
||
# Make the JSON files | ||
wp i18n make-json lang --no-purge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters