Skip to content

Commit f5ee345

Browse files
committed
feat: add i18n text domain
1 parent 31484b5 commit f5ee345

File tree

4 files changed

+66
-62
lines changed

4 files changed

+66
-62
lines changed

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@
3030
},
3131
"require": {
3232
"kucrut/vite-for-wp": "^0.8.0",
33-
"j7-dev/wp-utils": "0.2.9"
33+
"j7-dev/wp-utils": "0.2.27"
3434
},
3535
"require-dev": {
3636
"squizlabs/php_codesniffer": "@stable",
3737
"wp-coding-standards/wpcs": "@stable",
3838
"dealerdirect/phpcodesniffer-composer-installer": "@stable",
3939
"phpcompatibility/php-compatibility": "@stable",
40-
"phpstan/phpstan": "^1.11",
41-
"php-stubs/woocommerce-stubs": "^9.0",
42-
"php-stubs/wordpress-stubs": "^6.5",
43-
"phpstan/extension-installer": "^1.4"
40+
"phpstan/phpstan": "^1.11.9",
41+
"php-stubs/woocommerce-stubs": "^9.1",
42+
"php-stubs/wordpress-stubs": "^6.6",
43+
"phpstan/extension-installer": "^1.4.1"
4444
},
4545
"scripts": {
4646
"lint": "phpcs"
4747
}
48-
}
48+
}

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"zip": "env-cmd -f ./.env node ./release/zip.cjs",
2020
"create:release": "env-cmd -f ./.env node ./release/create-release.cjs",
2121
"sync:version": "wp-update-project-version -s package.json -p plugin.php",
22-
"replace-string": "node ./replace-string.cjs"
22+
"replace-string": "node ./replace-string.cjs",
23+
"i18n": "wp i18n make-pot . languages/wp_react_plugin.pot"
2324
},
2425
"dependencies": {
2526
"@tanstack/react-query": "4.36.1",
@@ -75,4 +76,4 @@
7576
"yarn-upgrade-all": "^0.7.2"
7677
},
7778
"bin": "./bin/create.cjs"
78-
}
79+
}

plugin.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,26 @@ final class Plugin {
3636
* Constructor
3737
*/
3838
public function __construct() {
39-
// $this->required_plugins = array(
40-
// array(
39+
// if your plugin depends on other plugins, you can add them here
40+
// $this->required_plugins = [
41+
// [
4142
// 'name' => 'WooCommerce',
4243
// 'slug' => 'woocommerce',
4344
// 'required' => true,
4445
// 'version' => '7.6.0',
45-
// ),
46-
// array(
47-
// 'name' => 'WP Toolkit',
48-
// 'slug' => 'wp-toolkit',
49-
// 'source' => 'Author URL/wp-toolkit/releases/latest/download/wp-toolkit.zip',
46+
// ],
47+
// [
48+
// 'name' => 'Powerhouse',
49+
// 'slug' => 'powerhouse',
50+
// 'source' => 'https://github.com/j7-dev/wp-powerhouse/releases/latest/download/powerhouse.zip',
51+
// 'version' => '1.0.14',
5052
// 'required' => true,
51-
// ),
52-
// );
53+
// ],
54+
// ];
5355

5456
$this->init(
5557
[
56-
'app_name' => 'My App',
58+
'app_name' => 'Wp React Plugin',
5759
'github_repo' => 'https://github.com/j7-dev/wp-react-plugin',
5860
'callback' => [ Bootstrap::class, 'instance' ],
5961
]

release/.release-it.cjs

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,48 +18,49 @@ const args = process.argv.slice(2) // remove 2 default args
1818
const release = !args.includes('--build-only') // Build release only or build release and push to github
1919

2020
module.exports = {
21-
releasedPluginName,
22-
git: {
23-
commit: release,
24-
commitMessage: 'chore: release v${version}',
25-
tag: release,
26-
tagName: 'v${version}',
27-
commitArgs: ['-n'],
28-
push: release,
29-
},
30-
hooks: {
31-
// 'before:init': [], // run before initialization
32-
// 'after:[my-plugin]:bump': './bin/my-script.sh', // run after bumping version of my-plugin
33-
'after:bump': [
34-
'yarn build && echo ✅ build success',
35-
release
36-
? 'yarn sync:version && echo ✅ sync version success'
37-
: 'echo 🚫 skip sync version',
38-
'yarn create:release && echo ✅ create release files success',
39-
`cd release/${releasedPluginName}/${releasedPluginName} && composer install --no-dev && cd ../.. && echo ✅ composer install success`,
40-
'yarn zip && echo ✅ create zip success',
41-
], // run after bumping version
42-
// 'after:git:release': 'echo After git push, before github release', // run after git push, before github release
43-
'after:release': [
44-
'git pull',
45-
], // run after release
46-
},
47-
npm: {
48-
publish: false,
49-
},
50-
github: {
51-
release,
52-
releaseName: 'v${version}',
53-
assets: [`./release/${releasedPluginName}.zip`], // relative path
54-
web: false,
55-
},
56-
allowedItems: [
57-
'inc',
58-
'js/dist',
59-
'composer.json',
60-
'composer.lock',
61-
'index.php',
62-
'plugin.php',
63-
'README.md',
64-
],
21+
releasedPluginName,
22+
git: {
23+
commit: release,
24+
commitMessage: 'chore: release v${version}',
25+
tag: release,
26+
tagName: 'v${version}',
27+
commitArgs: ['-n'],
28+
push: release,
29+
},
30+
hooks: {
31+
// 'before:init': [], // run before initialization
32+
// 'after:[my-plugin]:bump': './bin/my-script.sh', // run after bumping version of my-plugin
33+
'after:bump': [
34+
'yarn i18n',
35+
'yarn build && echo ✅ build success',
36+
release
37+
? 'yarn sync:version && echo ✅ sync version success'
38+
: 'echo 🚫 skip sync version',
39+
'yarn create:release && echo ✅ create release files success',
40+
`cd release/${releasedPluginName}/${releasedPluginName} && composer install --no-dev && cd ../.. && echo ✅ composer install success`,
41+
'yarn zip && echo ✅ create zip success',
42+
], // run after bumping version
43+
// 'after:git:release': 'echo After git push, before github release', // run after git push, before github release
44+
'after:release': [
45+
'git pull',
46+
], // run after release
47+
},
48+
npm: {
49+
publish: false,
50+
},
51+
github: {
52+
release,
53+
releaseName: 'v${version}',
54+
assets: [`./release/${releasedPluginName}.zip`], // relative path
55+
web: false,
56+
},
57+
allowedItems: [
58+
'inc',
59+
'js/dist',
60+
'composer.json',
61+
'composer.lock',
62+
'index.php',
63+
'plugin.php',
64+
'README.md',
65+
],
6566
}

0 commit comments

Comments
 (0)