-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
test
committed
Jul 19, 2023
1 parent
dbf6566
commit 4674cfa
Showing
4 changed files
with
64 additions
and
27 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
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
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
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,55 @@ | ||
# Internationalization (i18n) | ||
|
||
The `pup i18n` command can be used do fetch language files from a GlotPress instance for your project. To enable this | ||
command, you must configure the `i18n` section of your `.puprc` file. | ||
|
||
## The bare minimum | ||
|
||
```json | ||
{ | ||
"i18n": { | ||
"slug": "the-slug-used-in-glotpress", | ||
"textdomain": "my-textdomain", | ||
"url": "https://translate.wordpress.org/api/projects/wp-plugins/{slug}/stable" | ||
} | ||
} | ||
``` | ||
|
||
By default, the config settings for `i18n` inherit defaults from the `i18n_defaults` values in the | ||
[`.puprc-defaults`](/.puprc-defaults) found within `pup`. | ||
|
||
## Fetching from multiple sources | ||
|
||
If you wish to specify multiple `i18n` configs, being sure to override the `path` value so that the second config | ||
will download language files to an alternate location: | ||
|
||
```json | ||
{ | ||
"i18n": [ | ||
{ | ||
"slug": "the-slug-used-in-glotpress", | ||
"textdomain": "my-textdomain", | ||
"url": "https://translate.wordpress.org/api/projects/wp-plugins/{slug}/stable" | ||
}, | ||
{ | ||
"path": "some-other-path/lang", | ||
"slug": "the-slug-used-in-glotpress", | ||
"textdomain": "my-textdomain", | ||
"url": "https://translate.wordpress.org/api/projects/wp-plugins/{slug}/stable" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## All options | ||
|
||
| Config option | Type | Description | | ||
|-----------------------------|---|---------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `file_format` | `string` | The format of the file name for each language file that is downloaded. See [`.puprc-defaults`](/.puprc-defaults) for the default value. | | ||
| `filter` | `object` | This is the containing object for filters used in fetching language files. | | ||
| `filter.minimum_percentage` | `boolean` | The percentage of strings that must be translated in order to download the file. See [`.puprc-defaults`](/.puprc-defaults) for the default value. | | ||
| `formats` | `array` | The array of file formats to download. Defaults to `['mo', 'po']`. | | ||
| `path` | `string` | The path to download the language files to. Defaults to `lang`. | | ||
| `slug` | `string` | The slug used in GlotPress to identify the project. | | ||
| `textdomain` | `string` | The textdomain used in the project. | | ||
| `url` | `string` | The URL to the GlotPress API endpoint. | |