{"id":22296749,"url":"https://github.com/webklex/translator","last_synced_at":"2026-02-13T11:27:39.579Z","repository":{"id":62547950,"uuid":"69125925","full_name":"Webklex/translator","owner":"Webklex","description":"This is a translator package provides everything you need to get started with a quiet fast CSV file based translation service.","archived":false,"fork":false,"pushed_at":"2017-04-25T14:57:37.000Z","size":17,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-27T06:35:17.891Z","etag":null,"topics":["csv","language","laravel","library","multilanguage","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/Webklex.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2016-09-24T20:28:35.000Z","updated_at":"2024-06-20T21:48:37.000Z","dependencies_parsed_at":"2022-11-02T22:16:23.620Z","dependency_job_id":null,"html_url":"https://github.com/Webklex/translator","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/Webklex/translator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Webklex%2Ftranslator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Webklex%2Ftranslator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Webklex%2Ftranslator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Webklex%2Ftranslator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Webklex","download_url":"https://codeload.github.com/Webklex/translator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Webklex%2Ftranslator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267616581,"owners_count":24116154,"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","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["csv","language","laravel","library","multilanguage","php"],"created_at":"2024-12-03T17:47:29.244Z","updated_at":"2026-02-13T11:27:39.533Z","avatar_url":"https://github.com/Webklex.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Translator (CSV File based)\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n[![Build Status][ico-travis]][link-travis]\n[![Total Downloads][ico-downloads]][link-downloads]\n\nThis is a translator package provides everything you need to get started with a quiet fast CSV file based translation service.\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require webklex/translator\n```\n\n## Setup\n\nAdd the service provider to the providers array in `config/app.php`.\n\n``` php\n'providers' =\u003e [\n    Webklex\\Translator\\Providers\\TranslatorServiceProvider::class,\n    Webklex\\Translator\\Providers\\TranslatorBladeServiceProvider::class,\n];\n```\n\n## Middleware\n\nYou may want to use the middleware in order to control the global language setup inside `app/Http/Kernel.php`.\n\n``` php\nprotected $routeMiddleware = [\n    'translator' =\u003e Webklex\\Translator\\Middleware\\TranslatorMiddleware::class,\n];\n```\n\n## Routes and language switching\n\nIf you want to change the system language by clicking on a link, you could use something like this:\n\n\nInside your controller:\n``` php\n/**\n * Change the current language\n *\n * @param string $locale\n * @return \\Illuminate\\Http\\RedirectResponse\n */\npublic function changeLanguage($locale){\n    if(in_array($locale, config('translator.available'))){\n        Session::put('locale', $locale);\n        Session::save();\n        app()-\u003esetLocale($locale);\n    }\n\n    return redirect()-\u003eback();\n}\n```\n\nInside your routing file:\n``` php\nRoute::get('/language/{locale}', 'YourControllerName@changeLanguage');\n```\n\n## Publishing\n\nYou can publish everything at once\n\n``` php\nphp artisan vendor:publish --provider=\"Webklex\\Translator\\Providers\\TranslatorServiceProvider\"\n```\n\nor you can publish groups individually.\n\n``` php\nphp artisan vendor:publish --provider=\"Webklex\\Translator\\Providers\\TranslatorServiceProvider\" --tag=\"config\"\n```\n\n## Usage\n\nThis is a translator package provides everything you need to get started with a quiet fast CSV file based translation service.\nYour translation files will be stored by default in `resources/lang/` your language code (e.g. `en`) `/default.csv`.\n\nAccess Translator by its Facade (Webklex\\Translator\\Facades\\TranslatorFacade). \nTherefor you might want to add an alias to the aliases array within the `config/app.php` file.\n\n``` php\n'aliases' =\u003e [\n    'Lang' =\u003e Webklex\\Translator\\Facades\\TranslatorFacade::class\n];\n```\n\nYou registered the TranslatorBladeServiceProvider you can even use this easy shorthand directive.\n\n``` html\n@t('My translation')\n@t('My translation', 'en')\n```\n\nIf you are using something like my other package `webklex/helpers` you can use a helper function to make the access even easier.\n\nTherefor create a new helper: `php artisan make:helper translator` and edit the `app/Helpers/translator.php`.\n``` php\nif (!function_exists('_t')) {\n\n    /**\n     * Shorthand translation\n     * @param string $string\n     * @param string $locale\n     *\n     * @return string\n     */\n    function _t($string, $locale = null)\n    {\n        return Webklex\\Translator\\Facades\\TranslatorFacade::get($string, $locale);\n    }\n}\n```\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Security\n\nIf you discover any security related issues, please email github@webklex.com instead of using the issue tracker.\n\n## Credits\n\n- [Webklex][link-author]\n- All Contributors\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/Webklex/Translator.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-travis]: https://img.shields.io/travis/Webklex/translator/master.svg?style=flat-square\n[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/Webklex/Translator.svg?style=flat-square\n[ico-code-quality]: https://img.shields.io/scrutinizer/g/Webklex/Translator.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/Webklex/Translator.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/Webklex/Translator\n[link-travis]: https://travis-ci.org/Webklex/Translator\n[link-scrutinizer]: https://scrutinizer-ci.com/g/Webklex/Translator/code-structure\n[link-code-quality]: https://scrutinizer-ci.com/g/Webklex/Translator\n[link-downloads]: https://packagist.org/packages/Webklex/Translator\n[link-author]: https://github.com/webklex","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebklex%2Ftranslator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebklex%2Ftranslator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebklex%2Ftranslator/lists"}