{"action":"created","comment":{"url":"https://api.github.com/repos/armandsar/laravel-translationio/pulls/comments/171616888","pull_request_review_id":100501376,"id":171616888,"diff_hunk":"@@ -0,0 +1,192 @@\n+<?php\n+\n+###\n+# Inspired by https://github.com/oscarotero/Gettext/blob/master/src/translator_functions.php\n+###\n+\n+/**\n+ * Noop, marks the string for translation but returns it unchanged.\n+ */\n+if (!function_exists('noop')) {\n+    function noop($original)\n+    {\n+        return $original;\n+    }\n+}\n+\n+if (!function_exists('noop_')) {\n+    function noop_($original)\n+    {\n+        return $original;\n+    }\n+}\n+\n+if (!function_exists('noop__')) {\n+    function noop__($original)\n+    {\n+        return $original;\n+    }\n+}\n+\n+/**\n+ * Returns the translation of a string without interpolation.\n+ */\n+if (!function_exists('_')) {\n+    function _($original)\n+    {\n+        return gettext($original);\n+    }\n+}\n+\n+/**\n+ * Returns the translation of a string with interpolation.\n+ */\n+if (!function_exists('i_')) {\n+    function i_($original)","path":"src/translator_functions.php","position":null,"original_position":45,"commit_id":"89c8d016c0d6246653a23ea5350c2337f3bb0416","original_commit_id":"7017f1de876165acbeb2d700fa026afe086796c3","user":{"login":"MichaelHoste","id":529357,"avatar_url":"https://avatars0.githubusercontent.com/u/529357?v=4","gravatar_id":"","url":"https://api.github.com/users/MichaelHoste","html_url":"https://github.com/MichaelHoste","followers_url":"https://api.github.com/users/MichaelHoste/followers","following_url":"https://api.github.com/users/MichaelHoste/following{/other_user}","gists_url":"https://api.github.com/users/MichaelHoste/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelHoste/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelHoste/subscriptions","organizations_url":"https://api.github.com/users/MichaelHoste/orgs","repos_url":"https://api.github.com/users/MichaelHoste/repos","events_url":"https://api.github.com/users/MichaelHoste/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelHoste/received_events","type":"User","site_admin":false},"body":"I tried but actually only 2 of them have the same body (`i_` and `i__`) and since there is strange things happening using `func_get_args()`, it's already more complex than just doing something like: \r\n\r\n```php\r\nfunction i__($original)\r\n{\r\n  return i_($original);\r\n}\r\n```\r\n\r\nbecause it will lose the extra (hidden) arguments.\r\n\r\nI have to admit I don't care a lot about this specific duplication of code. That code will not evolve much and it's just 10 lines of code.","created_at":"2018-03-01T16:35:00Z","updated_at":"2018-03-01T16:35:00Z","html_url":"https://github.com/armandsar/laravel-translationio/pull/4#discussion_r171616888","pull_request_url":"https://api.github.com/repos/armandsar/laravel-translationio/pulls/4","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/armandsar/laravel-translationio/pulls/comments/171616888"},"html":{"href":"https://github.com/armandsar/laravel-translationio/pull/4#discussion_r171616888"},"pull_request":{"href":"https://api.github.com/repos/armandsar/laravel-translationio/pulls/4"}},"in_reply_to_id":170448519},"pull_request":{"url":"https://api.github.com/repos/armandsar/laravel-translationio/pulls/4","id":171176247,"html_url":"https://github.com/armandsar/laravel-translationio/pull/4","diff_url":"https://github.com/armandsar/laravel-translationio/pull/4.diff","patch_url":"https://github.com/armandsar/laravel-translationio/pull/4.patch","issue_url":"https://api.github.com/repos/armandsar/laravel-translationio/issues/4","number":4,"state":"open","locked":false,"title":"Gettext support","user":{"login":"MichaelHoste","id":529357,"avatar_url":"https://avatars0.githubusercontent.com/u/529357?v=4","gravatar_id":"","url":"https://api.github.com/users/MichaelHoste","html_url":"https://github.com/MichaelHoste","followers_url":"https://api.github.com/users/MichaelHoste/followers","following_url":"https://api.github.com/users/MichaelHoste/following{/other_user}","gists_url":"https://api.github.com/users/MichaelHoste/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelHoste/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelHoste/subscriptions","organizations_url":"https://api.github.com/users/MichaelHoste/orgs","repos_url":"https://api.github.com/users/MichaelHoste/repos","events_url":"https://api.github.com/users/MichaelHoste/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelHoste/received_events","type":"User","site_admin":false},"body":"Hey @armandsar, I added Gettext support to this package.\r\n\r\nA lot of Gettext syntaxes are now supported. You can see how in that file: `tests/fixtures/gettext/example.php`.\r\n\r\nAs you can see, some are quite classic (`_(\"\")` or `_n(\"\", \"\", number)`) and some are added for easier interpolation (`_i(\"hello %s\", \"world\")`).\r\n\r\nThere are some tests for both client/server behaviour but also to test GetText functions.\r\n\r\nYou'll see that there are also `sync_and_purge` and `sync_and_show_purgeable` methods in the package. They work like to the ones in Ruby: https://github.com/aurels/translation-gem#usage\r\n\r\nI also renamed `php artisan translations:xxx` to `php artisan translation:xxx` for better consistency, I hope you don't mind.\r\n\r\nPlease tell me if you see something weird in the package, I certainly did some mistakes.\r\n\r\nAlso, to change the language in your Laravel application, you need to do:\r\n\r\n```php\r\n$t = new TranslationIO(config('translationio'));\r\n$t->setLocale('fr');\r\n```\r\n\r\nDo you know if there is a way to do something like `TranslationIO::setLocale('fr')` instead? I think I saw something like this somewhere but I'm not very good with Facades and PHP meta-programming.","created_at":"2018-02-24T12:15:33Z","updated_at":"2018-03-01T16:35:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3c0eda5d5896f9f79cad4793448d6353d78e4cac","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/armandsar/laravel-translationio/pulls/4/commits","review_comments_url":"https://api.github.com/repos/armandsar/laravel-translationio/pulls/4/comments","review_comment_url":"https://api.github.com/repos/armandsar/laravel-translationio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/armandsar/laravel-translationio/issues/4/comments","statuses_url":"https://api.github.com/repos/armandsar/laravel-translationio/statuses/89c8d016c0d6246653a23ea5350c2337f3bb0416","head":{"label":"MichaelHoste:gettext","ref":"gettext","sha":"89c8d016c0d6246653a23ea5350c2337f3bb0416","user":{"login":"MichaelHoste","id":529357,"avatar_url":"https://avatars0.githubusercontent.com/u/529357?v=4","gravatar_id":"","url":"https://api.github.com/users/MichaelHoste","html_url":"https://github.com/MichaelHoste","followers_url":"https://api.github.com/users/MichaelHoste/followers","following_url":"https://api.github.com/users/MichaelHoste/following{/other_user}","gists_url":"https://api.github.com/users/MichaelHoste/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelHoste/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelHoste/subscriptions","organizations_url":"https://api.github.com/users/MichaelHoste/orgs","repos_url":"https://api.github.com/users/MichaelHoste/repos","events_url":"https://api.github.com/users/MichaelHoste/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelHoste/received_events","type":"User","site_admin":false},"repo":{"id":112357122,"name":"laravel-translationio","full_name":"MichaelHoste/laravel-translationio","owner":{"login":"MichaelHoste","id":529357,"avatar_url":"https://avatars0.githubusercontent.com/u/529357?v=4","gravatar_id":"","url":"https://api.github.com/users/MichaelHoste","html_url":"https://github.com/MichaelHoste","followers_url":"https://api.github.com/users/MichaelHoste/followers","following_url":"https://api.github.com/users/MichaelHoste/following{/other_user}","gists_url":"https://api.github.com/users/MichaelHoste/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelHoste/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelHoste/subscriptions","organizations_url":"https://api.github.com/users/MichaelHoste/orgs","repos_url":"https://api.github.com/users/MichaelHoste/repos","events_url":"https://api.github.com/users/MichaelHoste/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelHoste/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MichaelHoste/laravel-translationio","description":null,"fork":true,"url":"https://api.github.com/repos/MichaelHoste/laravel-translationio","forks_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/forks","keys_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/teams","hooks_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/hooks","issue_events_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/issues/events{/number}","events_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/events","assignees_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/assignees{/user}","branches_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/branches{/branch}","tags_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/tags","blobs_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/git/refs{/sha}","trees_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/statuses/{sha}","languages_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/languages","stargazers_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/stargazers","contributors_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/contributors","subscribers_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/subscribers","subscription_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/subscription","commits_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/commits{/sha}","git_commits_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/git/commits{/sha}","comments_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/comments{/number}","issue_comment_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/issues/comments{/number}","contents_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/contents/{+path}","compare_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/merges","archive_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/downloads","issues_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/issues{/number}","pulls_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/pulls{/number}","milestones_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/milestones{/number}","notifications_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/labels{/name}","releases_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/releases{/id}","deployments_url":"https://api.github.com/repos/MichaelHoste/laravel-translationio/deployments","created_at":"2017-11-28T16:01:56Z","updated_at":"2017-11-28T16:01:58Z","pushed_at":"2018-03-01T15:41:30Z","git_url":"git://github.com/MichaelHoste/laravel-translationio.git","ssh_url":"git@github.com:MichaelHoste/laravel-translationio.git","clone_url":"https://github.com/MichaelHoste/laravel-translationio.git","svn_url":"https://github.com/MichaelHoste/laravel-translationio","homepage":null,"size":63,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"armandsar:master","ref":"master","sha":"a413791cc59feba04d0e130edc4940bc6486dc19","user":{"login":"armandsar","id":3834314,"avatar_url":"https://avatars1.githubusercontent.com/u/3834314?v=4","gravatar_id":"","url":"https://api.github.com/users/armandsar","html_url":"https://github.com/armandsar","followers_url":"https://api.github.com/users/armandsar/followers","following_url":"https://api.github.com/users/armandsar/following{/other_user}","gists_url":"https://api.github.com/users/armandsar/gists{/gist_id}","starred_url":"https://api.github.com/users/armandsar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/armandsar/subscriptions","organizations_url":"https://api.github.com/users/armandsar/orgs","repos_url":"https://api.github.com/users/armandsar/repos","events_url":"https://api.github.com/users/armandsar/events{/privacy}","received_events_url":"https://api.github.com/users/armandsar/received_events","type":"User","site_admin":false},"repo":{"id":104565097,"name":"laravel-translationio","full_name":"armandsar/laravel-translationio","owner":{"login":"armandsar","id":3834314,"avatar_url":"https://avatars1.githubusercontent.com/u/3834314?v=4","gravatar_id":"","url":"https://api.github.com/users/armandsar","html_url":"https://github.com/armandsar","followers_url":"https://api.github.com/users/armandsar/followers","following_url":"https://api.github.com/users/armandsar/following{/other_user}","gists_url":"https://api.github.com/users/armandsar/gists{/gist_id}","starred_url":"https://api.github.com/users/armandsar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/armandsar/subscriptions","organizations_url":"https://api.github.com/users/armandsar/orgs","repos_url":"https://api.github.com/users/armandsar/repos","events_url":"https://api.github.com/users/armandsar/events{/privacy}","received_events_url":"https://api.github.com/users/armandsar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/armandsar/laravel-translationio","description":null,"fork":false,"url":"https://api.github.com/repos/armandsar/laravel-translationio","forks_url":"https://api.github.com/repos/armandsar/laravel-translationio/forks","keys_url":"https://api.github.com/repos/armandsar/laravel-translationio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/armandsar/laravel-translationio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/armandsar/laravel-translationio/teams","hooks_url":"https://api.github.com/repos/armandsar/laravel-translationio/hooks","issue_events_url":"https://api.github.com/repos/armandsar/laravel-translationio/issues/events{/number}","events_url":"https://api.github.com/repos/armandsar/laravel-translationio/events","assignees_url":"https://api.github.com/repos/armandsar/laravel-translationio/assignees{/user}","branches_url":"https://api.github.com/repos/armandsar/laravel-translationio/branches{/branch}","tags_url":"https://api.github.com/repos/armandsar/laravel-translationio/tags","blobs_url":"https://api.github.com/repos/armandsar/laravel-translationio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/armandsar/laravel-translationio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/armandsar/laravel-translationio/git/refs{/sha}","trees_url":"https://api.github.com/repos/armandsar/laravel-translationio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/armandsar/laravel-translationio/statuses/{sha}","languages_url":"https://api.github.com/repos/armandsar/laravel-translationio/languages","stargazers_url":"https://api.github.com/repos/armandsar/laravel-translationio/stargazers","contributors_url":"https://api.github.com/repos/armandsar/laravel-translationio/contributors","subscribers_url":"https://api.github.com/repos/armandsar/laravel-translationio/subscribers","subscription_url":"https://api.github.com/repos/armandsar/laravel-translationio/subscription","commits_url":"https://api.github.com/repos/armandsar/laravel-translationio/commits{/sha}","git_commits_url":"https://api.github.com/repos/armandsar/laravel-translationio/git/commits{/sha}","comments_url":"https://api.github.com/repos/armandsar/laravel-translationio/comments{/number}","issue_comment_url":"https://api.github.com/repos/armandsar/laravel-translationio/issues/comments{/number}","contents_url":"https://api.github.com/repos/armandsar/laravel-translationio/contents/{+path}","compare_url":"https://api.github.com/repos/armandsar/laravel-translationio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/armandsar/laravel-translationio/merges","archive_url":"https://api.github.com/repos/armandsar/laravel-translationio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/armandsar/laravel-translationio/downloads","issues_url":"https://api.github.com/repos/armandsar/laravel-translationio/issues{/number}","pulls_url":"https://api.github.com/repos/armandsar/laravel-translationio/pulls{/number}","milestones_url":"https://api.github.com/repos/armandsar/laravel-translationio/milestones{/number}","notifications_url":"https://api.github.com/repos/armandsar/laravel-translationio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/armandsar/laravel-translationio/labels{/name}","releases_url":"https://api.github.com/repos/armandsar/laravel-translationio/releases{/id}","deployments_url":"https://api.github.com/repos/armandsar/laravel-translationio/deployments","created_at":"2017-09-23T12:14:36Z","updated_at":"2017-10-03T17:39:58Z","pushed_at":"2018-03-01T15:41:31Z","git_url":"git://github.com/armandsar/laravel-translationio.git","ssh_url":"git@github.com:armandsar/laravel-translationio.git","clone_url":"https://github.com/armandsar/laravel-translationio.git","svn_url":"https://github.com/armandsar/laravel-translationio","homepage":null,"size":34,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/armandsar/laravel-translationio/pulls/4"},"html":{"href":"https://github.com/armandsar/laravel-translationio/pull/4"},"issue":{"href":"https://api.github.com/repos/armandsar/laravel-translationio/issues/4"},"comments":{"href":"https://api.github.com/repos/armandsar/laravel-translationio/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/armandsar/laravel-translationio/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/armandsar/laravel-translationio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/armandsar/laravel-translationio/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/armandsar/laravel-translationio/statuses/89c8d016c0d6246653a23ea5350c2337f3bb0416"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"MichaelHoste"}}