%PDF- %PDF-
Direktori : /var/www/projetos/stb.ind.br/wp-content/themes/stb/node_modules/grunt-wp-i18n/docs/ |
Current File : /var/www/projetos/stb.ind.br/wp-content/themes/stb/node_modules/grunt-wp-i18n/docs/addtextdomain.md |
# Addtextdomain task Add the text domain to gettext functions in your plugin or theme. **Warning:** This task will overwrite files in your project. Be sure to have a backup or commit any changes before running it. Viewing a diff after the task has run is a good way to verify any changes. To preview changes without updating files, use the `--dry-run` switch when running the task. _Run this task with the `grunt addtextdomain` command (or `grunt addtextdomain --dry-run` to preview)._ ## Overview In your project's Gruntfile, add a section named `addtextdomain` to the data object passed into `grunt.initConfig()`. ```js grunt.initConfig({ addtextdomain: { options: { textdomain: '', // Project text domain. updateDomains: [] // List of text domains to replace. }, target: { files: {} } } }); ``` ## Options ### options.textdomain Type: `String` Default value: `''` Example value: `'plugin-or-theme-slug'` Defaults to the "Text Domain" header if it exists, otherwise uses the project directory name. ### options.updateDomains Type: `Array|true` Default value: `[]` Example value: `[ 'original-domain', 'vendor-domain' ]` A list of text domains to replace with the new text domain. Setting the value to `true` will update all text domains with the new text domain. ## Usage Examples Options may be specified at the task or target level, but are optional. Each target must define the files that should be processed. It's not necessary to declare a destination since the files will be updated in place. ```js grunt.initConfig({ addtextdomain: { target: { files: { src: [ '*.php', '**/*.php', '!node_modules/**', '!tests/**' ] } } } }); ``` This task supports the same file mapping format Grunt supports. Please read [Globbing patterns](http://gruntjs.com/configuring-tasks#globbing-patterns) and [Building the files object dynamically](http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically) for additional details.