{"id":37004109,"url":"https://github.com/latevaweb/laravel-translatable","last_synced_at":"2026-01-14T00:36:41.038Z","repository":{"id":49086954,"uuid":"229246130","full_name":"latevaweb/laravel-translatable","owner":"latevaweb","description":"Make Eloquent model attributes translatables using Translations table","archived":false,"fork":false,"pushed_at":"2024-08-05T10:28:30.000Z","size":78,"stargazers_count":0,"open_issues_count":4,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-18T05:26:20.899Z","etag":null,"topics":["laravel","localization","package","translatable","translations"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/latevaweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-20T10:43:07.000Z","updated_at":"2020-09-10T08:11:20.000Z","dependencies_parsed_at":"2023-02-17T18:15:26.652Z","dependency_job_id":null,"html_url":"https://github.com/latevaweb/laravel-translatable","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/latevaweb/laravel-translatable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/latevaweb%2Flaravel-translatable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/latevaweb%2Flaravel-translatable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/latevaweb%2Flaravel-translatable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/latevaweb%2Flaravel-translatable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/latevaweb","download_url":"https://codeload.github.com/latevaweb/laravel-translatable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/latevaweb%2Flaravel-translatable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["laravel","localization","package","translatable","translations"],"created_at":"2026-01-14T00:36:40.291Z","updated_at":"2026-01-14T00:36:41.023Z","avatar_url":"https://github.com/latevaweb.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Translatable\n\nMake Eloquent model attributes translatables using Translations table\n\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/latevaweb/laravel-translatable/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/latevaweb/laravel-translatable/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/latevaweb/laravel-translatable/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/latevaweb/laravel-translatable/?branch=master)\n[![Build Status](https://scrutinizer-ci.com/g/latevaweb/laravel-translatable/badges/build.png?b=master)](https://scrutinizer-ci.com/g/latevaweb/laravel-translatable/build-status/master)\n[![StyleCI](https://github.styleci.io/repos/229246130/shield?branch=master)](https://github.styleci.io/repos/229246130)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Laravel 6.x](https://img.shields.io/badge/Laravel-6.x-orange.svg)](http://laravel.com)\n\nThis package contains a trait to make Eloquent attributes translatable. Translations are stored in Translations database table.\n\nOnce the trait is installed on the model you can do these things:\n\n```php\n$customer = new Customer; // An Eloquent model\n$customer\n   -\u003esetTranslation('greeting', 'en', 'Hello')\n   -\u003esetTranslation('greeting', 'es', 'Hola')\n   -\u003esave();\n   \n$customer-\u003egreeting; // Returns 'Hello' given that the current app locale is 'en'\n$customer-\u003egetTranslation('greeting', 'es'); // returns 'Hola'\n\napp()-\u003esetLocale('es');\n\n$customer-\u003egreeting; // Returns 'Hola'\n```\n\n## Installation\n\nYou can install the package via composer:\n\n``` bash\ncomposer require latevaweb/laravel-translatable\n```\n\nIf you want to change the default model or the default tables names, you could publish the config file:\n``` bash\nphp artisan vendor:publish --provider=\"LaTevaWeb\\Translatable\\TranslatableServiceProvider\" --tag=config --force\n```\n\nYou must publish the migration file to create polymorphic and main translations tables:\n``` bash\nphp artisan vendor:publish --provider=\"LaTevaWeb\\Translatable\\TranslatableServiceProvider\" --tag=migrations --force\n```\n\n## Making a model translatable\n\nThe required steps to make a model translatable are:\n\n- First, you need to add the `LaTevaWeb\\Translatable\\Traits\\Translatable`-trait.\n- Next, you should create a public static property `$translatable` which holds an array with all the names of attributes you wish to make translatable.\n- You have to create a field in the migration of your model type `string` and `nullable`.\n\nHere's an example of a prepared model:\n\n``` php\nuse Illuminate\\Database\\Eloquent\\Model;\nuse LaTevaWeb\\Translatable\\Traits\\Translatable;\n\nclass NewsItem extends Model\n{\n    use Translatable;\n       \n    protected $fillable = ['greeting'];\n    public static $translatable = ['greeting'];\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flatevaweb%2Flaravel-translatable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flatevaweb%2Flaravel-translatable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flatevaweb%2Flaravel-translatable/lists"}