GitHub PullRequestReviewCommentEvent at 2014-03-03 22:31:55
Repository: grunt-static-i18n
Actor: imorrison
Payload: {"comment":{"url":"https://api.github.com/repos/beck/grunt-static-i18n/pulls/comments/10232911","id":10232911,"diff_hunk":"@@ -2,91 +2,95 @@\n \n > Grunt plugin to translate static assets.\n \n-## Getting Started\n-This plugin requires Grunt.\n-\n-If 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+Say you have:\n \n-```shell\n-npm install statici18n --save-dev\n+```\n+app\n+├── locale\n+│   ├── en_GB\n+│   │   └── LC_MESSAGES\n+│   │       └── messages.po\n+│   └── fr\n+│       └── LC_MESSAGES\n+│           └── messages.po\n+└── static\n+    └── data.json  // content: [\"_('Hello World')\"]\n ```\n \n-Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n+And you need to translate `data.json`.  \n+Static internationalization would like like:\n \n-```js\n-grunt.loadNpmTasks('statici18n');\n ```\n+app\n+├── i18n\n+│   ├── en_GB\n+│   │   └── static\n+│   │       └── data.json  // content: [\"Hello World\"]\n+│   └── fr\n+│       └── static\n+│           └── data.json  // content: [\"Bonjour tout le monde\"]\n+├── locale\n+│   ├── en_GB\n+│   │   └── LC_MESSAGES\n+│   │       └── messages.po\n+│   └── fr\n+│       └── LC_MESSAGES\n+│           └── messages.po\n+└── static\n+    └── data.json\n+```\n+\n+\n+## Getting Started\n+\n+This plugin requires [Grunt](http://gruntjs.com/).\n+\n+Translations are done with node-gettext and you will need a proper\n+gettext catalog (structure seen above).  If need help extracting translation\n+strings, checkout [grunt-i18n-abide](https://www.npmjs.org/package/grunt-i18n-abide).\n+Checkout the `makemessages` task in [Gruntfile.js](Gruntfile.js).\n+\n \n ## The \"statici18n\" task\n \n ### Overview\n-In your project's Gruntfile, add a section named `statici18n` to the data object passed into `grunt.initConfig()`.\n+\n+In your project's Gruntfile, add a section named `statici18n` to the data\n+object passed into `grunt.initConfig()`: \n \n ```js\n grunt.initConfig({\n   statici18n: {\n     options: {\n-      // Task-specific options go here.\n-    },\n-    your_target: {\n-      // Target-specific file lists and/or options go here.\n+      localeDir: 'app/locale'\n     },\n-  },\n+    myAppTask: {\n+      files: [{\n+        expand: true,\n+        cwd: 'app',\n+        src: 'static/*.json',\n+        dest: 'app/i18n'\n+      }]\n+    }\n+  }\n })\n ```\n \n ### Options\n \n-#### options.separator\n+#### options.localeDir\n Type: `String`\n-Default value: `',  '`\n-\n-A string value that is used to do something with whatever.\n-\n-#### options.punctuation\n-Type: `String`\n-Default value: `'.'`\n-\n-A string value that is used to do something else with whatever else.\n+Default value: `locale`\n \n-### Usage Examples\n+Sometimes easiest to use a var, say `<%= abideCreate.options.localeDir %>`\n \n-#### Default Options\n-In this example, the default options are used to do something with whatever. So if the `testing` file has the content `Testing` and the `123` file had the content `1 2 3`, the generated result would be `Testing, 1 2 3.`\n-\n-```js\n-grunt.initConfig({\n-  statici18n: {\n-    options: {},\n-    files: {\n-      'dest/default_options': ['src/testing', 'src/123'],\n-    },\n-  },\n-})\n-```\n-\n-#### Custom Options\n-In this example, custom options are used to do something else with whatever else. So if the `testing` file has the content `Testing` and the `123` file had the content `1 2 3`, the generated result in this case would be `Testing: 1 2 3 !!!`\n-\n-```js\n-grunt.initConfig({\n-  statici18n: {\n-    options: {\n-      separator: ': ',\n-      punctuation: ' !!!',\n-    },\n-    files: {\n-      'dest/default_options': ['src/testing', 'src/123'],\n-    },\n-  },\n-})\n-```\n+#### options.template.interpolate\n+Type: `RegEx`  \n+Default: search for `_('msgid')` or `_(\"msgid\")`","path":"README.md","position":144,"original_position":144,"commit_id":"42d36464fe620895d18f512b4a21af6e4f3165be","original_commit_id":"42d36464fe620895d18f512b4a21af6e4f3165be","user":{"login":"imorrison","id":1871228,"avatar_url":"https://avatars.githubusercontent.com/u/1871228","gravatar_id":"ba740cf4d0ad9904fc5d1b53e77a7b5b","url":"https://api.github.com/users/imorrison","html_url":"https://github.com/imorrison","followers_url":"https://api.github.com/users/imorrison/followers","following_url":"https://api.github.com/users/imorrison/following{/other_user}","gists_url":"https://api.github.com/users/imorrison/gists{/gist_id}","starred_url":"https://api.github.com/users/imorrison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imorrison/subscriptions","organizations_url":"https://api.github.com/users/imorrison/orgs","repos_url":"https://api.github.com/users/imorrison/repos","events_url":"https://api.github.com/users/imorrison/events{/privacy}","received_events_url":"https://api.github.com/users/imorrison/received_events","type":"User","site_admin":false},"body":"You might want to expand this. For example, a person could change the template to have it work with `<%= string %>` if thats what they want. Correct? ","created_at":"2014-03-03T22:31:55Z","updated_at":"2014-03-03T22:31:55Z","html_url":"https://github.com/beck/grunt-static-i18n/pull/1#discussion_r10232911","pull_request_url":"https://api.github.com/repos/beck/grunt-static-i18n/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/beck/grunt-static-i18n/pulls/comments/10232911"},"html":{"href":"https://github.com/beck/grunt-static-i18n/pull/1#discussion_r10232911"},"pull_request":{"href":"https://api.github.com/repos/beck/grunt-static-i18n/pulls/1"}}}}