Skip to content

Commit 6523717

Browse files
authored
Merge pull request #2 from raph-topo/feature/composer_2
Support Composer v2
2 parents e42d85b + 20129da commit 6523717

File tree

5 files changed

+1741
-23
lines changed

5 files changed

+1741
-23
lines changed

README.md

+13-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Composer plugin to download translation files for WordPress core, plugins and th
1313

1414
Optimized for the [Roots](https://roots.io/) stack, particularly Bedrock, but can be adapted to other setups based on Composer.
1515

16+
Supports Composer v2 (only).
17+
1618
Instructions are given relative to the Bedrock root folder, usually `site`.
1719

1820
## Installation
@@ -22,12 +24,12 @@ Install with:
2224
$ composer require raph-topo/wp-translations
2325
```
2426

25-
Set the following options in `composer.json`:
27+
Add the following settings to `composer.json`:
2628
```json
2729
{
2830
"extra": {
2931
"wordpress-translations": [ "fr_FR" ],
30-
"wordpress-languages-dir": "web/app/languages"
32+
"wordpress-translations-dir": "web/app/languages"
3133
}
3234
}
3335
```
@@ -40,10 +42,17 @@ Composer will try to install translations from through the WordPress.org API eve
4042

4143
**Commit the translation files** (`web/app/languages/{.,themes,plugins}/*{.mo,.po}`) and deploy them to staging and production.
4244

45+
From time to time, you might want to get rid of old translation files (plugins that were uninstalled, etc.) To do that, you must delete `web/app/languages` and follow _Extant projects_ hereunder.
46+
4347
## Extant projects
4448

45-
To force-update translations for already installed packages, delete the contents of `web/app/plugins` (keep any `.gitkeep`) and run `composer install`
49+
To force-update translations for already installed packages, delete the contents of the following folders:
50+
51+
- `web/wp`
52+
- `web/app/plugins`, except the file `web/app/plugins/.gitkeep`
53+
54+
Run `composer update`.
4655

4756
## Credits
4857

49-
This package was started by [Angry Creative](https://github.com/Angrycreative/composer-plugin-language-update), has been rewritten by [Bjørn Johansen](https://github.com/bjornjohansen/wplang) and integrates compatibility changes made by [Mirai](https://github.com/mirai-wordpress/wplang).
58+
This package was started by [Angry Creative](https://github.com/Angrycreative/composer-plugin-language-update), has been rewritten by [Bjørn Johansen](https://github.com/bjornjohansen/wplang), integrates compatibility changes made by [Mirai](https://github.com/mirai-wordpress/wplang) and was updated to support Composer v2.

composer.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313
],
1414
"require": {
15-
"composer-plugin-api": "^1.1"
15+
"composer-plugin-api": "^2.0"
1616
},
1717
"autoload": {
1818
"psr-4": {
@@ -21,5 +21,8 @@
2121
},
2222
"extra": {
2323
"class": "RaphTopo\\WPTranslations\\WPTranslations"
24+
},
25+
"require-dev": {
26+
"composer/composer": "^2.0"
2427
}
2528
}

0 commit comments

Comments
 (0)