{"action":"created","issue":{"url":"https://api.github.com/repos/vsch/laravel-translation-manager/issues/112","repository_url":"https://api.github.com/repos/vsch/laravel-translation-manager","labels_url":"https://api.github.com/repos/vsch/laravel-translation-manager/issues/112/labels{/name}","comments_url":"https://api.github.com/repos/vsch/laravel-translation-manager/issues/112/comments","events_url":"https://api.github.com/repos/vsch/laravel-translation-manager/issues/112/events","html_url":"https://github.com/vsch/laravel-translation-manager/issues/112","id":300705979,"number":112,"title":"how to access translations from javascript ","user":{"login":"vesper8","id":816028,"avatar_url":"https://avatars1.githubusercontent.com/u/816028?v=4","gravatar_id":"","url":"https://api.github.com/users/vesper8","html_url":"https://github.com/vesper8","followers_url":"https://api.github.com/users/vesper8/followers","following_url":"https://api.github.com/users/vesper8/following{/other_user}","gists_url":"https://api.github.com/users/vesper8/gists{/gist_id}","starred_url":"https://api.github.com/users/vesper8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vesper8/subscriptions","organizations_url":"https://api.github.com/users/vesper8/orgs","repos_url":"https://api.github.com/users/vesper8/repos","events_url":"https://api.github.com/users/vesper8/events{/privacy}","received_events_url":"https://api.github.com/users/vesper8/received_events","type":"User","site_admin":false},"labels":[{"id":238432152,"url":"https://api.github.com/repos/vsch/laravel-translation-manager/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":276769646,"url":"https://api.github.com/repos/vsch/laravel-translation-manager/labels/fixed%20:)","name":"fixed :)","color":"5319e7","default":false},{"id":238432150,"url":"https://api.github.com/repos/vsch/laravel-translation-manager/labels/%E2%98%B9%20bug","name":"☹ bug","color":"fc2929","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/vsch/laravel-translation-manager/milestones/4","html_url":"https://github.com/vsch/laravel-translation-manager/milestone/4","labels_url":"https://api.github.com/repos/vsch/laravel-translation-manager/milestones/4/labels","id":3165833,"number":4,"title":"Version 2.6.4","description":"JSON translation files","creator":{"login":"vsch","id":10299086,"avatar_url":"https://avatars3.githubusercontent.com/u/10299086?v=4","gravatar_id":"","url":"https://api.github.com/users/vsch","html_url":"https://github.com/vsch","followers_url":"https://api.github.com/users/vsch/followers","following_url":"https://api.github.com/users/vsch/following{/other_user}","gists_url":"https://api.github.com/users/vsch/gists{/gist_id}","starred_url":"https://api.github.com/users/vsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsch/subscriptions","organizations_url":"https://api.github.com/users/vsch/orgs","repos_url":"https://api.github.com/users/vsch/repos","events_url":"https://api.github.com/users/vsch/events{/privacy}","received_events_url":"https://api.github.com/users/vsch/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":0,"state":"closed","created_at":"2018-03-06T15:18:18Z","updated_at":"2018-03-06T15:18:50Z","due_on":null,"closed_at":"2018-03-06T15:18:50Z"},"comments":59,"created_at":"2018-02-27T16:42:15Z","updated_at":"2018-04-18T01:44:46Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Hey, sorry if this is already documented but I wasn't able to locate the answer\r\n\r\nI love your package and have been using it in my apps that use Laravel Blade\r\n\r\nBut now I am transitioning to using more and more Vue and I am finding myself needing to access these translated strings from inside the javascript\r\n\r\nAnd I am wondering what is the optimal way of accessing what I need from a JS content. I am looking for a way that is not too hard on performance.. any advice would be much appreciated!\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/vsch/laravel-translation-manager/issues/comments/382217705","html_url":"https://github.com/vsch/laravel-translation-manager/issues/112#issuecomment-382217705","issue_url":"https://api.github.com/repos/vsch/laravel-translation-manager/issues/112","id":382217705,"user":{"login":"vesper8","id":816028,"avatar_url":"https://avatars1.githubusercontent.com/u/816028?v=4","gravatar_id":"","url":"https://api.github.com/users/vesper8","html_url":"https://github.com/vesper8","followers_url":"https://api.github.com/users/vesper8/followers","following_url":"https://api.github.com/users/vesper8/following{/other_user}","gists_url":"https://api.github.com/users/vesper8/gists{/gist_id}","starred_url":"https://api.github.com/users/vesper8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vesper8/subscriptions","organizations_url":"https://api.github.com/users/vesper8/orgs","repos_url":"https://api.github.com/users/vesper8/repos","events_url":"https://api.github.com/users/vesper8/events{/privacy}","received_events_url":"https://api.github.com/users/vesper8/received_events","type":"User","site_admin":false},"created_at":"2018-04-18T01:44:46Z","updated_at":"2018-04-18T01:44:46Z","author_association":"CONTRIBUTOR","body":"I'm trying to use the TranslationsPublished event now. I've created a listener and it's working, but the $event only contains the group, in this case \"JSON\".\r\n\r\nI tried looking into your export function to see if I could reuse it in a way that would let me manipulate the structure.. but I decided that was not very easy.. instead I quickly put this together which is a bit hacky and very specific to my use-case but it works\r\n\r\n```\r\n<?php\r\n\r\nnamespace App\\Listeners;\r\n\r\nuse Vsch\\TranslationManager\\Models\\Translation;\r\nuse Vsch\\TranslationManager\\Events\\TranslationsPublished;\r\n\r\nclass TranslationsPublishedListener\r\n{\r\n    /**\r\n     * @param Vsch\\TranslationManager\\Events\\TranslationsPublished $event\r\n     */\r\n    public function handle(TranslationsPublished $event)\r\n    {\r\n        if ($event->groups === 'JSON') {\r\n            $locales = [\r\n                'en',\r\n                'fr',\r\n            ];\r\n            foreach ($locales as $locale) {\r\n                $translations = Translation::where('group', $event->groups)\r\n                    ->where('locale', $locale)\r\n                    ->get()\r\n                    ->pluck('value', 'key')\r\n                    ->toArray();\r\n\r\n                $translations = ['JSON' => $translations];\r\n\r\n                \\File::put(base_path(\"resources/lang/{$locale}.json\"), json_encode($translations, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));\r\n            }\r\n        }\r\n    }\r\n}\r\n```\r\n"}}
{"actor":{"display_login":"vesper8"}}