Skip to content

Latest commit

 

History

History
55 lines (46 loc) · 3.05 KB

i18n.md

File metadata and controls

55 lines (46 loc) · 3.05 KB

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

{
    "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 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:

{
    "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 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 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.