{"id":21544304,"url":"https://github.com/wesleyhf/laravel-localization-js","last_synced_at":"2025-04-10T04:41:17.182Z","repository":{"id":40772027,"uuid":"260368609","full_name":"wesleyhf/laravel-localization-js","owner":"wesleyhf","description":"Easy way to handle Laravel's lang.json in Javascript :earth_americas:","archived":false,"fork":false,"pushed_at":"2023-03-04T15:50:35.000Z","size":2062,"stargazers_count":9,"open_issues_count":16,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T05:52:12.284Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wesleyhf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-01T03:07:22.000Z","updated_at":"2023-01-25T20:38:08.000Z","dependencies_parsed_at":"2023-02-05T08:46:50.825Z","dependency_job_id":null,"html_url":"https://github.com/wesleyhf/laravel-localization-js","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesleyhf%2Flaravel-localization-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesleyhf%2Flaravel-localization-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesleyhf%2Flaravel-localization-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesleyhf%2Flaravel-localization-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wesleyhf","download_url":"https://codeload.github.com/wesleyhf/laravel-localization-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248160716,"owners_count":21057549,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T05:17:36.959Z","updated_at":"2025-04-10T04:41:17.159Z","avatar_url":"https://github.com/wesleyhf.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# laravel-localization-js\n\n![CI](https://github.com/wesleyhf/laravel-localization-js/workflows/CI/badge.svg?branch=master)\n\nEasy way to handle Laravel's lang.json in Javascript. :earth_americas:\n\nInspired by [Ziggy](https://github.com/tightenco/ziggy) and based on Laravel way to [Retrieving Translation Strings](https://laravel.com/docs/7.x/localization#retrieving-translation-strings).\n\n## Why\n\nManipulating translations strings at Javascript when you are using Laravel should not be so tricky. So, why not use the `lang.json` file that is already at your back-end?\n\n## Contents\n\n- [Installation](#installation)\n- [Setup](#setup)\n- [Usage](#usage)\n- [License](#license)\n\n## Installation\n\nJust run:\n\n```sh\nnpm install @wesleyhf/laravel-localization-js --save\n\n# or using yarn\n\nyarn add @wesleyhf/laravel-localization-js\n```\n\n## Setup\n\n```js\nimport { createLaravelLocalization } from 'laravel-localization-js';\nimport lang from '../../lang/pt-br.json';\n\nconst __ = createLaravelLocalization(lang);\n\nconsole.log(__('Hello world')); // output: Olá mundo\n```\n\n## Usage\n\n\n```js\n// example of lang.json\n{\n    'My name is Wesley': 'Meu nome é Wesley',\n    'My name is :name': 'Meu nome é :name',\n};\n\n// undefined key\n__('Hello world'); // 'Hello world'\n\n// defined key\n__('My name is Wesley'); // 'Meu nome é Wesley'\n\n// peplacing parameters\n__('My name is :name', { 'name': 'Wesley' }); // 'Meu nome é Wesley'\n```\n\n## License\n\n[MIT License](LICENSE) © Wesley Francisco\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwesleyhf%2Flaravel-localization-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwesleyhf%2Flaravel-localization-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwesleyhf%2Flaravel-localization-js/lists"}