{"_id":"grunt-checktextdomain","_rev":"14-09b8d586879f248bb34d492525d4c31e","name":"grunt-checktextdomain","description":"Checks gettext function calls for missing or incorrect text domain.","dist-tags":{"latest":"1.0.1"},"versions":{"0.1.0":{"name":"grunt-checktextdomain","description":"Checks gettext function calls for missing or incorrect text domain.","version":"0.1.0","homepage":"https://github.com/stephenharris/grunt-checktextdomain","author":{"name":"Stephen Harris","email":"contact@stephenharris.info"},"repository":{"type":"git","url":"git://github.com/stephenharris/grunt-checktextdomain.git"},"bugs":{"url":"https://github.com/stephenharris/grunt-checktextdomain/issues"},"licenses":[{"type":"GPL","url":"https://github.com/stephenharris/grunt-checktextdomain/blob/master/LICENSE-GPL"}],"main":"Gruntfile.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"grunt test"},"devDependencies":{"grunt-contrib-jshint":"~0.6.0","grunt-contrib-clean":"~0.4.0","grunt-contrib-nodeunit":"~0.2.0","grunt-contrib-copy":"~0.4.1","grunt":"~0.4.1"},"peerDependencies":{"grunt":"~0.4.1"},"dependencies":{"chalk":"~0.2.1","text-table":"~0.2.0"},"keywords":["gruntplugin","i18n","gettext","wordpress"],"_id":"grunt-checktextdomain@0.1.0","dist":{"shasum":"3c591e0784f1a61f0330aec5a8de02be006d1815","tarball":"https://registry.npmjs.org/grunt-checktextdomain/-/grunt-checktextdomain-0.1.0.tgz","integrity":"sha512-j5CcscPqh2OhMA1KQiJPdlxrcJmn25sDt5iKJn0IACYsav5Qrkvq/u5UVRkb7fF26w2K0PYaDh0ww+qlIcsUsw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDVLuFx2FPmmjcZ8dbPupmNavXlBZuIfNLcLXbii2zn/wIhAL8r1pmedIdI/hL64zk/ttdt2gdo9Yd3c5yTyb7FXNye"}]},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"stephenharris","email":"contact@stephenharris.info"},"maintainers":[{"name":"stephenharris","email":"contact@stephenharris.info"}]},"0.1.1":{"name":"grunt-checktextdomain","description":"Checks gettext function calls for missing or incorrect text domain.","version":"0.1.1","homepage":"https://github.com/stephenharris/grunt-checktextdomain","author":{"name":"Stephen Harris","email":"contact@stephenharris.info"},"repository":{"type":"git","url":"git://github.com/stephenharris/grunt-checktextdomain.git"},"bugs":{"url":"https://github.com/stephenharris/grunt-checktextdomain/issues"},"licenses":[{"type":"GPL","url":"https://github.com/stephenharris/grunt-checktextdomain/blob/master/LICENSE-GPL"}],"main":"Gruntfile.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"grunt test"},"devDependencies":{"grunt-contrib-jshint":"~0.6.0","grunt-contrib-clean":"~0.4.0","grunt-contrib-nodeunit":"~0.2.0","grunt-contrib-copy":"~0.4.1","grunt":"~0.4.1"},"peerDependencies":{"grunt":"~0.4.1"},"dependencies":{"chalk":"~0.2.1","text-table":"~0.2.0"},"keywords":["gruntplugin","i18n","gettext","wordpress"],"_id":"grunt-checktextdomain@0.1.1","dist":{"shasum":"5a060837e7a7b7afb41500884ece9b4ca5c549e0","tarball":"https://registry.npmjs.org/grunt-checktextdomain/-/grunt-checktextdomain-0.1.1.tgz","integrity":"sha512-bk4T5JO7BhXPeZWSAN0P4vTMnE28/snTXTu+55y/i7tvb5KSG/tb5IygpZD6ofCV4HOqZeSFA0PyFQ4M2bJ6Vw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDdS3MA9CqV9H0c0OcNEX067P/BvboJOlgXofZdL3RkCAIgH0hx588m8Z8VY63QJJk5z4SysKZGXQmwR6eDd6P1E6E="}]},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"stephenharris","email":"contact@stephenharris.info"},"maintainers":[{"name":"stephenharris","email":"contact@stephenharris.info"}]},"1.0.0":{"name":"grunt-checktextdomain","description":"Checks gettext function calls for missing or incorrect text domain.","version":"1.0.0","homepage":"https://github.com/stephenharris/grunt-checktextdomain","author":{"name":"Stephen Harris","email":"contact@stephenharris.info"},"repository":{"type":"git","url":"git://github.com/stephenharris/grunt-checktextdomain.git"},"bugs":{"url":"https://github.com/stephenharris/grunt-checktextdomain/issues"},"licenses":[{"type":"GPL","url":"https://github.com/stephenharris/grunt-checktextdomain/blob/master/LICENSE-GPL"}],"main":"Gruntfile.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"grunt test"},"devDependencies":{"grunt-contrib-jshint":"~0.6.0","grunt-contrib-clean":"~0.4.0","grunt-contrib-nodeunit":"~0.2.0","grunt-contrib-copy":"~0.4.1","grunt":"~0.4.1"},"peerDependencies":{"grunt":"~0.4.1"},"dependencies":{"chalk":"~0.2.1","text-table":"~0.2.0"},"keywords":["gruntplugin","i18n","gettext","wordpress"],"gitHead":"c143c3d90bcdc88ba01a20a82d5e44e6805d4c5d","_id":"grunt-checktextdomain@1.0.0","_shasum":"a1ae96f670f2d0188d9495eeca75351c2a1fa3db","_from":".","_npmVersion":"2.7.4","_nodeVersion":"0.10.25","_npmUser":{"name":"stephenharris","email":"contact@stephenharris.info"},"maintainers":[{"name":"stephenharris","email":"contact@stephenharris.info"}],"dist":{"shasum":"a1ae96f670f2d0188d9495eeca75351c2a1fa3db","tarball":"https://registry.npmjs.org/grunt-checktextdomain/-/grunt-checktextdomain-1.0.0.tgz","integrity":"sha512-XZraJJdSD+LVOQlPc2adse5KD39NIafUCGS5JucfIacZuPUYhq2LmlWhfi2MEHQLPgtZZFEGBplIQG61UP3g4g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDwFtcwDrM0LVSM/tfLtoq/mZOQYAor14HKBSy7wqG/vQIhAOCBlkCwzBfK6ipChkmBgIg+BH2lKxCXstqNYF91HuoQ"}]}},"1.0.1":{"name":"grunt-checktextdomain","description":"Checks gettext function calls for missing or incorrect text domain.","version":"1.0.1","homepage":"https://github.com/stephenharris/grunt-checktextdomain","author":{"name":"Stephen Harris","email":"contact@stephenharris.info"},"repository":{"type":"git","url":"git://github.com/stephenharris/grunt-checktextdomain.git"},"bugs":{"url":"https://github.com/stephenharris/grunt-checktextdomain/issues"},"licenses":[{"type":"GPL","url":"https://github.com/stephenharris/grunt-checktextdomain/blob/master/LICENSE-GPL"}],"main":"Gruntfile.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"grunt test"},"devDependencies":{"grunt-contrib-jshint":"~0.6.0","grunt-contrib-clean":"~0.4.0","grunt-contrib-nodeunit":"~0.2.0","grunt-contrib-copy":"~0.4.1","grunt":"~0.4.1"},"peerDependencies":{"grunt":">=0.4.1"},"dependencies":{"chalk":"~0.2.1","text-table":"~0.2.0"},"keywords":["gruntplugin","i18n","gettext","wordpress"],"gitHead":"77bdc82272f0218418b2913aef3b04f9f03dd199","_id":"grunt-checktextdomain@1.0.1","_shasum":"b254d01e1de913005d4db1c5303d9023b983e19b","_from":".","_npmVersion":"3.8.1","_nodeVersion":"0.10.25","_npmUser":{"name":"stephenharris","email":"contact@stephenharris.info"},"dist":{"shasum":"b254d01e1de913005d4db1c5303d9023b983e19b","tarball":"https://registry.npmjs.org/grunt-checktextdomain/-/grunt-checktextdomain-1.0.1.tgz","integrity":"sha512-WX6EMOnvrhj8MDqmWJAlZRpM1rE/Mmqy9DCYYeWB1pFV+JotP6pNx2uO58+uHFOEFTcoridr4ECJ6aqGnLmgJw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFH7/IWYyBIWTG1YJftIMZ8RrZScRGfWMD1bVnZIQCl1AiAaGAaiDP2/RVDXL1FI4K+iViRLfJPSxX//aN2jS/iEKQ=="}]},"maintainers":[{"name":"stephenharris","email":"contact@stephenharris.info"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/grunt-checktextdomain-1.0.1.tgz_1466465103283_0.9972047759220004"}}},"readme":"# grunt-checktextdomain\n\n> Check your code for missing or incorrect text-domain in gettext functions\n\nWhile this plug-in was created for development of WordPress plug-ins & themes it should work well with any php-written code base. While the functions normally meant by *gettext functions* (e.g. the native `gettext()`, `ngettext()`) do not allow you to pass a text domain, some platforms - such as WordPress - provide functions which do (.e.g `__()`, `_n()`). This plug-in is intended for *those* functions: to ensure that a domain is given and that is it matches the desired domain specificed in your `Gruntfile.js`.\n\nThis plug-in was inspired by the command line tool [add-textdomain](http://develop.svn.wordpress.org/trunk/tools/i18n/add-textdomain.php).\n\n## Getting Started\nThis plugin requires Grunt `~0.4.1`\n\nIf you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:\n\n```shell\nnpm install grunt-checktextdomain --save-dev\n```\n\nOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('grunt-checktextdomain');\n```\n\n## The \"checktextdomain\" task\n\n### Important: Before you start\n\nFor the task to run you need to specify:\n\n1. **Text domain(s)** - a string or array of valid text domain(s)\n2. **Keywords** - gettext functions, along with a specification indicating where to look for the text domain\n\n\n#### Keyword specifications\nThis task extends the original [keyword specification](http://www.gnu.org/software/gettext/manual/html_node/xgettext-Invocation.html) to indicate where to look for the text domain. The default specification is of the form\n\n``` \n    [function name]:[argument-specifier],[argument-specifier],...\n```\nwhere an argument specificier, `[argument-specifier]`, is of the form\n\n - `[number]` - indicating that this argument is a translatable string\n - `[number]c` - indicating that this argument is a context specifier\n\n\nFor example:\n\n - `gettext` - the translated string is the first argument of `gettext()`\n - `ngettext:1,2` -  the translated strings are arguments 1 and 2 of of `ngettext()`\n - `pgettext:1c,2` -  argument 1 is a context specifier and the translated string is argument 2 of `pgettext()`\n\n\nThis task requires an additional argument specifier (in fact this is the only required one): `[number]d` - indicating that the argument is a domain specifier. For example:\n\n - `__:1,2d` - the translated string is the first argument of `__()` and the domain is the second argument\n - `_n:1,2,4d` -  the translated strings are arguments 1 and 2 of `_n()` and the fourth is the domain specifier.\n - `_nx:1,2,3c,5d` -  the translated strings are arguments 1 and 2 of `_nx()`, the third is a context specifier and the fifth is the domain specifier.\n\n\n#### Example keyword specifications (WordPress)\n\n```\nkeywords: [\n\t'__:1,2d',\n\t'_e:1,2d',\n\t'_x:1,2c,3d',\n\t'esc_html__:1,2d',\n\t'esc_html_e:1,2d',\n\t'esc_html_x:1,2c,3d',\n\t'esc_attr__:1,2d', \n\t'esc_attr_e:1,2d', \n\t'esc_attr_x:1,2c,3d', \n\t'_ex:1,2c,3d',\n\t'_n:1,2,4d', \n\t'_nx:1,2,4c,5d',\n\t'_n_noop:1,2,3d',\n\t'_nx_noop:1,2,3c,4d'\n];\n```\n\n### Overview\nIn your project's Gruntfile, add a section named `checktextdomain` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  checktextdomain: {\n    options: {\n      // Task-specific options go here.\n    },\n    files: {\n      // Files to target go here\n    },\n  },\n})\n```\n\n### Options\n\n#### text_domain\nType: `String`|`Array`\n\nMust be provided. A text domain (or an array of text domains) indicating the domains to check against.\n\n#### keywords\nType: `Array`\n\nAn array of keyword specifications to look for. See above section for details & examples.\n\n#### report_missing\nType: `Bool`\nDefault value: `true`\n\nWhether to report use of keywords without a domain being passed.\n\n#### report_variable_domain\nType: `Bool`\nDefault value: `true`\n\nWhether to report use of keywords with a variable being used as the domain.\n\n#### correct_domain\nType: `Bool`\nDefault value: `false`\n\nWhether to automatically correct incorrect domains. Please note that this does **not** add in missing domains, and can **only** be used when one text domain is supplied. This will also correct instances where a variable, rather than string is used as a text doman, **unless** you set `report_variable_domain` to `false`.\n\n#### create_report_file\nType: `Bool`\nDefault value: `false`\n\nCreate a hidden `.[target].json` file with reported errors.\n\n#### force\n\nType: `Bool`\nDefault value: `false`\n\nSet force to true to report text domain errors but not fail the task\n\n### Usage Examples\n\nThis is a typical set-up for WordPress development. The only thing specific to WordPress here is the keywords list.\n\n```js\n    checktextdomain: {\n\t  standard{\n         options:{\n\t\t\ttext_domain: 'my-domain', //Specify allowed domain(s)\n\t\t\tkeywords: [ //List keyword specifications\n\t\t\t\t'__:1,2d',\n\t\t\t\t'_e:1,2d',\n\t\t\t\t'_x:1,2c,3d',\n\t\t\t\t'esc_html__:1,2d',\n\t\t\t\t'esc_html_e:1,2d',\n\t\t\t\t'esc_html_x:1,2c,3d',\n\t\t\t\t'esc_attr__:1,2d', \n\t\t\t\t'esc_attr_e:1,2d', \n\t\t\t\t'esc_attr_x:1,2c,3d', \n\t\t\t\t'_ex:1,2c,3d',\n\t\t\t\t'_n:1,2,4d', \n\t\t\t\t'_nx:1,2,4c,5d',\n\t\t\t\t'_n_noop:1,2,3d',\n\t\t\t\t'_nx_noop:1,2,3c,4d'\n\t\t\t]\n\t\t},\n\t\tfiles: [{\n\t\t\tsrc: ['**/*.php'], //all php \n\t\t\texpand: true,\n\t\t}],\n\t  }\n    },\n```\n\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).\n\n## Release History\n* *1.0.1* - 21st June 2016 - Loose Grunt peer dependency to support Grunt 1.0.0\n* *1.0.0* - **Potential breaking change:** Grunt now aborts on error (`grunt.fail.warn`). Thanks to @alexVauch. [#4](https://github.com/stephenharris/grunt-checktextdomain/pull/4). Added `force` task to configure this behaviour.\n* *0.1.1* - Fix bug where functions are used to pass value to gettext functions.\n* *0.1.0* - Initial release\n","maintainers":[{"name":"stephenharris","email":"contact@stephenharris.info"}],"time":{"modified":"2022-06-18T14:36:10.959Z","created":"2013-12-04T23:13:43.535Z","0.1.0":"2013-12-04T23:13:48.100Z","0.1.1":"2013-12-26T14:57:49.401Z","1.0.0":"2015-03-30T15:34:22.823Z","1.0.1":"2016-06-20T23:25:04.681Z"},"author":{"name":"Stephen Harris","email":"contact@stephenharris.info"},"repository":{"type":"git","url":"git://github.com/stephenharris/grunt-checktextdomain.git"},"users":{"claudiosmweb":true,"cfoellmann":true,"axisthemes":true,"shivapoudel":true,"julianoe":true},"homepage":"https://github.com/stephenharris/grunt-checktextdomain","keywords":["gruntplugin","i18n","gettext","wordpress"],"bugs":{"url":"https://github.com/stephenharris/grunt-checktextdomain/issues"},"readmeFilename":"README.md"}