{"action":"created","comment":{"url":"https://api.github.com/repos/arathunku/gulp-translator/pulls/comments/36376264","id":36376264,"diff_hunk":"@@ -1,80 +1,167 @@\n var YAML = require('yamljs');\n var q = require('q');\n+var fs = require('fs');\n \n-module.exports = (function() {\n+var DEFAULT_REGEXP = /\\{{2}([\\w\\.\\s\\\"\\']+\\s?\\|\\s?translate[\\w\\s\\|]*)\\}{2}/g;\n \n-  var EXPRESSION_REG = /\\{{2}([\\w\\.\\s\\\"\\']+)\\s?\\|\\stranslate([\\w\\s\\|]*)\\}{2}/g;\n-  var FILTER_REG = /translate(([\\|\\s]*)([\\w]+))*/;\n-  var EXPRESSION_VALUE_REG = /\\{{2}\\s*[\\'\\\"]?([\\w\\.]*)[\\'\\\"]?/;\n \n-  var getLocale = function(dir){\n-    return YAML.load(dir);\n-  };\n+var baseTransforms = {\n+  translate: function(content, dictionary){\n+    if (!content) {\n+      return new Error('No content to transform.');\n+    }\n+    return content.trim().split('.').reduce(function(dict, key){\n+        if (!dict) {\n+          return null;\n+        }\n+        return dict[key];\n+      }, dictionary) ||\n+      new Error('No such content (' + content + ') at dictionary.');\n+  },\n+\n+  uppercase: function(content) {\n+    if (!content) {\n+      return new Error('No content to transform.');\n+    }\n+    return content.toUpperCase();\n+  },\n \n-  var getLocaleValue = function(key, locale) {\n-    return key.trim().split('.').reduce(function(obj, key){\n-      return obj[key];\n-    }, locale);\n-  };\n+  lowercase: function(content) {\n+    if (!content) {\n+      return new Error('No content to transform.');\n+    }\n+    return content.toLowerCase();\n+  },\n \n-  // FILTERS\n+  capitalize: function(content){\n+    if (!content) {\n+      return new Error('No content to transform.');\n+    }\n+    return content.charAt(0).toUpperCase() + content.substring(1).toLowerCase();\n+  },\n \n-  var uppercase = function(content) {\n-    return content.toUpperCase();\n-  };\n+  capitalizeEvery: function(content){\n+    if (!content) {\n+      return new Error('No content to transform.');\n+    }\n+    return content.toLowerCase().replace(/[^\\s\\.!\\?]+(.)/g, function(word){\n+      return this.capitalize(word);\n+    });\n+  },\n+\n+  reverse: function(content){\n+    if (!content) {\n+      return new Error('No content to transform.');\n+    }\n+    var res = '';","path":"lib/translator.js","position":null,"original_position":72,"commit_id":"e9d1bfc1deb4f89ccfd2b7c99bc1e1260a54a43e","original_commit_id":"88a3bd5fc95a0b73bdeec6258f6c5f2c9635a925","user":{"login":"NumminorihSF","id":11752266,"avatar_url":"https://avatars.githubusercontent.com/u/11752266?v=3","gravatar_id":"","url":"https://api.github.com/users/NumminorihSF","html_url":"https://github.com/NumminorihSF","followers_url":"https://api.github.com/users/NumminorihSF/followers","following_url":"https://api.github.com/users/NumminorihSF/following{/other_user}","gists_url":"https://api.github.com/users/NumminorihSF/gists{/gist_id}","starred_url":"https://api.github.com/users/NumminorihSF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NumminorihSF/subscriptions","organizations_url":"https://api.github.com/users/NumminorihSF/orgs","repos_url":"https://api.github.com/users/NumminorihSF/repos","events_url":"https://api.github.com/users/NumminorihSF/events{/privacy}","received_events_url":"https://api.github.com/users/NumminorihSF/received_events","type":"User","site_admin":false},"body":"Sounds good. It works with `.reduceRight()` at updated PR","created_at":"2015-08-06T02:15:03Z","updated_at":"2015-08-06T02:15:03Z","html_url":"https://github.com/arathunku/gulp-translator/pull/6#discussion_r36376264","pull_request_url":"https://api.github.com/repos/arathunku/gulp-translator/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/arathunku/gulp-translator/pulls/comments/36376264"},"html":{"href":"https://github.com/arathunku/gulp-translator/pull/6#discussion_r36376264"},"pull_request":{"href":"https://api.github.com/repos/arathunku/gulp-translator/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/arathunku/gulp-translator/pulls/6","id":41448163,"html_url":"https://github.com/arathunku/gulp-translator/pull/6","diff_url":"https://github.com/arathunku/gulp-translator/pull/6.diff","patch_url":"https://github.com/arathunku/gulp-translator/pull/6.patch","issue_url":"https://api.github.com/repos/arathunku/gulp-translator/issues/6","number":6,"state":"open","locked":false,"title":"+.json, +user transforms, +base transforms","user":{"login":"NumminorihSF","id":11752266,"avatar_url":"https://avatars.githubusercontent.com/u/11752266?v=3","gravatar_id":"","url":"https://api.github.com/users/NumminorihSF","html_url":"https://github.com/NumminorihSF","followers_url":"https://api.github.com/users/NumminorihSF/followers","following_url":"https://api.github.com/users/NumminorihSF/following{/other_user}","gists_url":"https://api.github.com/users/NumminorihSF/gists{/gist_id}","starred_url":"https://api.github.com/users/NumminorihSF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NumminorihSF/subscriptions","organizations_url":"https://api.github.com/users/NumminorihSF/orgs","repos_url":"https://api.github.com/users/NumminorihSF/repos","events_url":"https://api.github.com/users/NumminorihSF/events{/privacy}","received_events_url":"https://api.github.com/users/NumminorihSF/received_events","type":"User","site_admin":false},"body":"* some readme.md update\r\n* translator now use 1 regexp pattern\r\n* translator can works with user RegExp pattern\r\n* translator can work without translate (wow)\r\n* can use user's pattern separator\r\n* can use user's transforms\r\n* can use .json files\r\n* add capitalize transform\r\n* add capitalizeEvery transform\r\n* add reverse transform","created_at":"2015-08-03T09:17:43Z","updated_at":"2015-08-06T02:15:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"af3a3375448fc65659304d7958f91d31880ae277","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/arathunku/gulp-translator/pulls/6/commits","review_comments_url":"https://api.github.com/repos/arathunku/gulp-translator/pulls/6/comments","review_comment_url":"https://api.github.com/repos/arathunku/gulp-translator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/arathunku/gulp-translator/issues/6/comments","statuses_url":"https://api.github.com/repos/arathunku/gulp-translator/statuses/e9d1bfc1deb4f89ccfd2b7c99bc1e1260a54a43e","head":{"label":"NumminorihSF:master","ref":"master","sha":"e9d1bfc1deb4f89ccfd2b7c99bc1e1260a54a43e","user":{"login":"NumminorihSF","id":11752266,"avatar_url":"https://avatars.githubusercontent.com/u/11752266?v=3","gravatar_id":"","url":"https://api.github.com/users/NumminorihSF","html_url":"https://github.com/NumminorihSF","followers_url":"https://api.github.com/users/NumminorihSF/followers","following_url":"https://api.github.com/users/NumminorihSF/following{/other_user}","gists_url":"https://api.github.com/users/NumminorihSF/gists{/gist_id}","starred_url":"https://api.github.com/users/NumminorihSF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NumminorihSF/subscriptions","organizations_url":"https://api.github.com/users/NumminorihSF/orgs","repos_url":"https://api.github.com/users/NumminorihSF/repos","events_url":"https://api.github.com/users/NumminorihSF/events{/privacy}","received_events_url":"https://api.github.com/users/NumminorihSF/received_events","type":"User","site_admin":false},"repo":{"id":40103205,"name":"gulp-translator","full_name":"NumminorihSF/gulp-translator","owner":{"login":"NumminorihSF","id":11752266,"avatar_url":"https://avatars.githubusercontent.com/u/11752266?v=3","gravatar_id":"","url":"https://api.github.com/users/NumminorihSF","html_url":"https://github.com/NumminorihSF","followers_url":"https://api.github.com/users/NumminorihSF/followers","following_url":"https://api.github.com/users/NumminorihSF/following{/other_user}","gists_url":"https://api.github.com/users/NumminorihSF/gists{/gist_id}","starred_url":"https://api.github.com/users/NumminorihSF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NumminorihSF/subscriptions","organizations_url":"https://api.github.com/users/NumminorihSF/orgs","repos_url":"https://api.github.com/users/NumminorihSF/repos","events_url":"https://api.github.com/users/NumminorihSF/events{/privacy}","received_events_url":"https://api.github.com/users/NumminorihSF/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NumminorihSF/gulp-translator","description":"","fork":true,"url":"https://api.github.com/repos/NumminorihSF/gulp-translator","forks_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/forks","keys_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/teams","hooks_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/hooks","issue_events_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/issues/events{/number}","events_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/events","assignees_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/assignees{/user}","branches_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/branches{/branch}","tags_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/tags","blobs_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/git/refs{/sha}","trees_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/statuses/{sha}","languages_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/languages","stargazers_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/stargazers","contributors_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/contributors","subscribers_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/subscribers","subscription_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/subscription","commits_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/commits{/sha}","git_commits_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/git/commits{/sha}","comments_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/comments{/number}","issue_comment_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/issues/comments{/number}","contents_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/contents/{+path}","compare_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/merges","archive_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/downloads","issues_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/issues{/number}","pulls_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/pulls{/number}","milestones_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/milestones{/number}","notifications_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/labels{/name}","releases_url":"https://api.github.com/repos/NumminorihSF/gulp-translator/releases{/id}","created_at":"2015-08-03T03:27:07Z","updated_at":"2015-08-03T03:27:07Z","pushed_at":"2015-08-06T02:12:24Z","git_url":"git://github.com/NumminorihSF/gulp-translator.git","ssh_url":"git@github.com:NumminorihSF/gulp-translator.git","clone_url":"https://github.com/NumminorihSF/gulp-translator.git","svn_url":"https://github.com/NumminorihSF/gulp-translator","homepage":null,"size":91,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"arathunku:master","ref":"master","sha":"01154e589836eeaa7befa3b996484c5c5ccd671a","user":{"login":"arathunku","id":749393,"avatar_url":"https://avatars.githubusercontent.com/u/749393?v=3","gravatar_id":"","url":"https://api.github.com/users/arathunku","html_url":"https://github.com/arathunku","followers_url":"https://api.github.com/users/arathunku/followers","following_url":"https://api.github.com/users/arathunku/following{/other_user}","gists_url":"https://api.github.com/users/arathunku/gists{/gist_id}","starred_url":"https://api.github.com/users/arathunku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arathunku/subscriptions","organizations_url":"https://api.github.com/users/arathunku/orgs","repos_url":"https://api.github.com/users/arathunku/repos","events_url":"https://api.github.com/users/arathunku/events{/privacy}","received_events_url":"https://api.github.com/users/arathunku/received_events","type":"User","site_admin":false},"repo":{"id":23016844,"name":"gulp-translator","full_name":"arathunku/gulp-translator","owner":{"login":"arathunku","id":749393,"avatar_url":"https://avatars.githubusercontent.com/u/749393?v=3","gravatar_id":"","url":"https://api.github.com/users/arathunku","html_url":"https://github.com/arathunku","followers_url":"https://api.github.com/users/arathunku/followers","following_url":"https://api.github.com/users/arathunku/following{/other_user}","gists_url":"https://api.github.com/users/arathunku/gists{/gist_id}","starred_url":"https://api.github.com/users/arathunku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arathunku/subscriptions","organizations_url":"https://api.github.com/users/arathunku/orgs","repos_url":"https://api.github.com/users/arathunku/repos","events_url":"https://api.github.com/users/arathunku/events{/privacy}","received_events_url":"https://api.github.com/users/arathunku/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/arathunku/gulp-translator","description":"","fork":false,"url":"https://api.github.com/repos/arathunku/gulp-translator","forks_url":"https://api.github.com/repos/arathunku/gulp-translator/forks","keys_url":"https://api.github.com/repos/arathunku/gulp-translator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arathunku/gulp-translator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arathunku/gulp-translator/teams","hooks_url":"https://api.github.com/repos/arathunku/gulp-translator/hooks","issue_events_url":"https://api.github.com/repos/arathunku/gulp-translator/issues/events{/number}","events_url":"https://api.github.com/repos/arathunku/gulp-translator/events","assignees_url":"https://api.github.com/repos/arathunku/gulp-translator/assignees{/user}","branches_url":"https://api.github.com/repos/arathunku/gulp-translator/branches{/branch}","tags_url":"https://api.github.com/repos/arathunku/gulp-translator/tags","blobs_url":"https://api.github.com/repos/arathunku/gulp-translator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arathunku/gulp-translator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arathunku/gulp-translator/git/refs{/sha}","trees_url":"https://api.github.com/repos/arathunku/gulp-translator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arathunku/gulp-translator/statuses/{sha}","languages_url":"https://api.github.com/repos/arathunku/gulp-translator/languages","stargazers_url":"https://api.github.com/repos/arathunku/gulp-translator/stargazers","contributors_url":"https://api.github.com/repos/arathunku/gulp-translator/contributors","subscribers_url":"https://api.github.com/repos/arathunku/gulp-translator/subscribers","subscription_url":"https://api.github.com/repos/arathunku/gulp-translator/subscription","commits_url":"https://api.github.com/repos/arathunku/gulp-translator/commits{/sha}","git_commits_url":"https://api.github.com/repos/arathunku/gulp-translator/git/commits{/sha}","comments_url":"https://api.github.com/repos/arathunku/gulp-translator/comments{/number}","issue_comment_url":"https://api.github.com/repos/arathunku/gulp-translator/issues/comments{/number}","contents_url":"https://api.github.com/repos/arathunku/gulp-translator/contents/{+path}","compare_url":"https://api.github.com/repos/arathunku/gulp-translator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arathunku/gulp-translator/merges","archive_url":"https://api.github.com/repos/arathunku/gulp-translator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arathunku/gulp-translator/downloads","issues_url":"https://api.github.com/repos/arathunku/gulp-translator/issues{/number}","pulls_url":"https://api.github.com/repos/arathunku/gulp-translator/pulls{/number}","milestones_url":"https://api.github.com/repos/arathunku/gulp-translator/milestones{/number}","notifications_url":"https://api.github.com/repos/arathunku/gulp-translator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arathunku/gulp-translator/labels{/name}","releases_url":"https://api.github.com/repos/arathunku/gulp-translator/releases{/id}","created_at":"2014-08-16T11:43:52Z","updated_at":"2014-12-10T12:22:50Z","pushed_at":"2015-08-06T02:12:24Z","git_url":"git://github.com/arathunku/gulp-translator.git","ssh_url":"git@github.com:arathunku/gulp-translator.git","clone_url":"https://github.com/arathunku/gulp-translator.git","svn_url":"https://github.com/arathunku/gulp-translator","homepage":null,"size":201,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/arathunku/gulp-translator/pulls/6"},"html":{"href":"https://github.com/arathunku/gulp-translator/pull/6"},"issue":{"href":"https://api.github.com/repos/arathunku/gulp-translator/issues/6"},"comments":{"href":"https://api.github.com/repos/arathunku/gulp-translator/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/arathunku/gulp-translator/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/arathunku/gulp-translator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/arathunku/gulp-translator/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/arathunku/gulp-translator/statuses/e9d1bfc1deb4f89ccfd2b7c99bc1e1260a54a43e"}}}}