Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving translated locale attributes #64

Closed
Thuongkim opened this issue Sep 24, 2019 · 3 comments
Closed

Saving translated locale attributes #64

Thuongkim opened this issue Sep 24, 2019 · 3 comments
Labels

Comments

@Thuongkim
Copy link

Thuongkim commented Sep 24, 2019

I try to save: $slider = Slider::create($input); with $input:

array:6 [▼
  "_token" => "6EReMQzWYsPg8Snwc2dfcvsvj1Yn08cTw51dFiWi"
  "title" => "we"
  "content" => "asd"
  "status" => "1"
  "locale" => "vi"
  "image" => "/images/slider/slide-5826879d561ba54aa8e7a788569832e85486308b.png"
]

but it save default locale(en). How i can solve it? Thank you!
Here's my database:
image

@Gummibeer
Copy link
Member

You have multiple options. Have you checked the form docs?

I would move the locale in input name. But you can also use the setDefaultLocale() method - new Slider; $slider->setDefaultLocale(); $slider->fill();. Or set the app locale before creating.

@Thuongkim
Copy link
Author

It works, when i use setDefaultLocale('fr'). But when i use another locale like: vi,ru... it doesn't work. So what's locale this package support? Anyway, Thank you for saving my day!

@Gummibeer
Copy link
Member

It's up to you which locales are supported.
https://docs.astrotomic.info/laravel-translatable/installation#configuration
https://docs.astrotomic.info/laravel-translatable/package/locales-helper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants