在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):spatie/laravel-translatable开源软件地址(OpenSource Url):https://github.com/spatie/laravel-translatable开源编程语言(OpenSource Language):PHP 100.0%开源软件介绍(OpenSource Introduction):A trait to make Eloquent models translatableThis package contains a trait to make Eloquent models translatable. Translations are stored as json. There is no extra table needed to hold them. Once the trait is installed on the model you can do these things: $newsItem = new NewsItem; // This is an Eloquent model
$newsItem
->setTranslation('name', 'en', 'Name in English')
->setTranslation('name', 'nl', 'Naam in het Nederlands')
->save();
$newsItem->name; // Returns 'Name in English' given that the current app locale is 'en'
$newsItem->getTranslation('name', 'nl'); // returns 'Naam in het Nederlands'
app()->setLocale('nl');
$newsItem->name; // Returns 'Naam in het Nederlands' Support usWe invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products. We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall. DocumentationAll documentation is available on our documentation site. Testingcomposer test ContributingPlease see CONTRIBUTING for details. SecurityIf you've found a bug regarding security please mail [email protected] instead of using the issue tracker. PostcardwareYou're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium. We publish all received postcards on our company website. CreditsWe got the idea to store translations as json in a column from Mohamed Said. Parts of the readme of his multilingual package were used in this readme. LicenseThe MIT License (MIT). Please see License File for more information. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论