{"id":16086555,"url":"https://github.com/amiranagram/localizator","last_synced_at":"2025-04-12T16:41:01.023Z","repository":{"id":42190473,"uuid":"310689686","full_name":"amiranagram/localizator","owner":"amiranagram","description":"Scan your Laravel project and generate language files ready to translate in language(s) of choosing.","archived":false,"fork":false,"pushed_at":"2024-03-27T09:06:44.000Z","size":264,"stargazers_count":229,"open_issues_count":9,"forks_count":29,"subscribers_count":4,"default_branch":"0.x","last_synced_at":"2024-10-10T13:13:31.963Z","etag":null,"topics":["i18n","laravel","laravel-package","locale","locales-translation","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amiranagram.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"amiranagram","custom":["https://www.buymeacoffee.com/amirami/","https://m.do.co/c/f38828dd20f8"]}},"created_at":"2020-11-06T19:37:25.000Z","updated_at":"2024-10-08T12:28:15.000Z","dependencies_parsed_at":"2024-06-18T16:50:51.566Z","dependency_job_id":"4b060623-71d9-4c61-81b8-80cd46a2c349","html_url":"https://github.com/amiranagram/localizator","commit_stats":{"total_commits":99,"total_committers":10,"mean_commits":9.9,"dds":0.5252525252525253,"last_synced_commit":"e687ad12c8bd2fa200ce8481c91120bd957d01d6"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiranagram%2Flocalizator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiranagram%2Flocalizator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiranagram%2Flocalizator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiranagram%2Flocalizator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amiranagram","download_url":"https://codeload.github.com/amiranagram/localizator/tar.gz/refs/heads/0.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248598531,"owners_count":21131113,"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":["i18n","laravel","laravel-package","locale","locales-translation","php"],"created_at":"2024-10-09T13:13:37.029Z","updated_at":"2025-04-12T16:41:00.994Z","avatar_url":"https://github.com/amiranagram.png","language":"PHP","funding_links":["https://github.com/sponsors/amiranagram","https://www.buymeacoffee.com/amirami/","https://m.do.co/c/f38828dd20f8","https://www.buymeacoffee.com/amirami"],"categories":[],"sub_categories":[],"readme":"# Localizator\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/amirami/localizator.svg?style=flat-square)](https://packagist.org/packages/amirami/localizator)\n[![Total Downloads](https://img.shields.io/packagist/dt/amirami/localizator.svg?style=flat-square)](https://packagist.org/packages/amirami/localizator)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/amiranagram/localizator/tests.yml?style=flat-square)](https://github.com/amiranagram/localizator/actions?query=workflow%3Atests+branch%3Amaster)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/amiranagram/localizator/php-cs-fixer.yml?label=code%20style\u0026style=flat-square)](https://github.com/amiranagram/localizator/actions?query=workflow%3A\"Check+%26+fix+styling\"+branch%3Amaster)\n\nLocalizator is a small tool for Laravel that gives you the ability to extract untranslated string from your project files with one command.\n\n## Support\n\n\u003ca href=\"https://www.buymeacoffee.com/amirami\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" height=\"41\" width=\"174\"\u003e\u003c/a\u003e\n\n[![DigitalOcean Referral Badge](https://web-platforms.sfo2.digitaloceanspaces.com/WWW/Badge%203.svg)](https://www.digitalocean.com/?refcode=f38828dd20f8\u0026utm_campaign=Referral_Invite\u0026utm_medium=Referral_Program\u0026utm_source=badge)\n\n## Compatibility\n\n| Laravel | Localizator |\n|---------|-------------|\n| 6.x LTS | 0.3-0.12    |\n| 8.x     | *           |\n| 9.x     | ^0.8        |\n| 10.x    | ^0.12       |\n| 11.x    | ^0.13       |\n| 12.x    | ^0.14       |\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require --dev amirami/localizator\n```\n\nThis package makes use of [Laravels package auto-discovery mechanism](https://medium.com/@taylorotwell/package-auto-discovery-in-laravel-5-5-ea9e3ab20518), which means if you don't install dev dependencies in production, it also won't be loaded.\n\nIf for some reason you want manually control this:\n- add the package to the `extra.laravel.dont-discover` key in `composer.json`, e.g.\n  ```json\n  \"extra\": {\n    \"laravel\": {\n      \"dont-discover\": [\n        \"amirami/localizator\"\n      ]\n    }\n  }\n  ```\n- Add the following class to the `providers` array in `config/app.php`:\n  ```php\n  Amirami\\Localizator\\ServiceProvider::class,\n  ```\n  If you want to manually load it only in non-production environments, instead you can add this to your `AppServiceProvider` with the `register()` method:\n  ```php\n  public function register()\n  {\n      if ($this-\u003eapp-\u003eisLocal()) {\n          $this-\u003eapp-\u003eregister(\\Amirami\\Localizator\\ServiceProvider::class);\n      }\n      // ...\n  }\n  ```\n\n\u003e Note: Avoid caching the configuration in your development environment, it may cause issues after installing this package; respectively clear the cache beforehand via `php artisan cache:clear` if you encounter problems when running the commands\n\nYou can publish the config file with:\n```bash\nphp artisan vendor:publish --provider=\"Amirami\\Localizator\\ServiceProvider\" --tag=\"config\"\n```\n\nThis is the contents of the published config file:\n\n```php\n\u003c?php\n\nreturn [\n\n    /**\n     * Localize types of translation strings.\n     */\n    'localize' =\u003e [\n        /**\n         * Short keys. This is the default for Laravel.\n         * They are stored in PHP files inside folders name by their locale code.\n         * Laravel comes with default: auth.php, pagination.php, passwords.php and validation.php\n         */\n        'default' =\u003e true,\n\n        /**\n         * Translations strings as key.\n         * They are stored in JSON file for each locale.\n         */\n        'json'    =\u003e true,\n    ],\n\n    /**\n     * Search criteria for files.\n     */\n    'search'   =\u003e [\n        /**\n         * Directories which should be looked inside.\n         */\n        'dirs'      =\u003e ['resources/views'],\n        \n        /**\n         * Subdirectories which will be excluded.\n         * The values must be relative to the included directory paths.\n         */\n        'exclude' =\u003e [\n            //\n        ],\n\n        /**\n         * Patterns by which files should be queried.\n         * The values can be a regular expression, glob, or just a string.\n         */\n        'patterns'  =\u003e ['*.php'],\n\n        /**\n         * Functions that the strings will be extracted from.\n         * Add here any custom defined functions.\n         * NOTE: The translation string should always be the first argument.\n         */\n        'functions' =\u003e ['__', 'trans', '@lang']\n    ],\n\n    /**\n     * Should the localize command sort extracted strings alphabetically?\n     */\n    'sort'     =\u003e true,\n\n];\n\n```\n\n## Usage\n\nTo extract all the strings, it's as simple as running:\n\n``` bash\nphp artisan localize de,fr\n```\n\nThis command will create (if don't exist) `de.json` and `fr.json` files inside the `resources/lang` directory.\nIf you have short keys enabled and used in your files (e.g. `pagination.next`) the localize command will create folders `de` and `fr` inside `resources/lang` directory and PHP files inside by the short key's prefix (e.g. `pagination.php`).\n\nYou can also run the artisan command without the country code arguments.\n\n``` bash\nphp artisan localize\n```\n\nIn this case translation strings will be generated for the language specified in `app.locale` config.\n\n\u003e Note: Strings you have already translated will not be overwritten.\n\n### Remove Missing Keys\n\nBy default, the strings inside the locale files will be preserved even if they are not present the next time you run the localize command.\nIf you want to remove those keys that are not present in your files anymore you can append the --remove-missing option to the localize command.\n``` bash\nphp artisan localize --remove-missing\n```\n### Key Sorting\n\nBy default, the strings generated inside those JSON files will be sorted alphabetically by their keys.\nIf you wanna turn off this feature just set `sort =\u003e false` in the config file.\n\n### Searching\n\nThe way the strings are being extracted is simple.\n\nWe are looking inside the directories defined in `search.dirs` config, we match the files using patterns defined in `search.patterns`, and finally we look to extract strings\n which are the first argument of the functions defined in `search.functions`.\n \nYou are free to change any of these values inside the config file to suit you own needs.\n\n## Testing\n\n``` bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Amir Rami](https://github.com/amiranagram)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famiranagram%2Flocalizator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famiranagram%2Flocalizator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famiranagram%2Flocalizator/lists"}