davide-casiraghi / laravel-events-calendar

Create and manage events in your Laravel application.
MIT License
1 stars 2 forks source link

Seed default category translations or fallback to default translation #185

Open mico opened 4 years ago

mico commented 4 years ago

https://github.com/davide-casiraghi/laravel-events-calendar/blob/3613ffe49c2d80240228902b39f4e0c8e180a286/src/Http/Controllers/EventController.php#L103 Here we get an empty array on a fresh database (after deployment for development).

I suggest to add seeds for category translations or use fallback to default translation. Actually seems like listTranslations don't use fallback. withTranslation (https://docs.astrotomic.info/laravel-translatable/package/scopes#withtranslation) using fallback but return data in a different format.

@davide-casiraghi how do you seed translations for development?

davide-casiraghi commented 4 years ago

For sure you can add the fallback. Usually I was seeding just for English with this. https://github.com/davide-casiraghi/ci-global-calendar/blob/master/database/seeds/EventCategoriesTableSeeder.php

Then if you feel to write the seeder for all the languages you are welcome.

I can send you a dump of the production DB if you want.

On Tue, Oct 13, 2020, 5:49 AM Artur Komarov notifications@github.com wrote:

https://github.com/davide-casiraghi/laravel-events-calendar/blob/3613ffe49c2d80240228902b39f4e0c8e180a286/src/Http/Controllers/EventController.php#L103 Here we get an empty array on a fresh database (after deployment for development).

I suggest to add seeds for category translations or use fallback to default translation. Actually seems like listTranslations don't use fallback. withTranslation ( https://docs.astrotomic.info/laravel-translatable/package/scopes#withtranslation) using fallback but return data in a different format.

@davide-casiraghi https://github.com/davide-casiraghi how do you seed translations for development?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/davide-casiraghi/laravel-events-calendar/issues/185, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQEF24A6MMTDEE5PC67NETSKPE3DANCNFSM4SN7JTRQ .

mico commented 4 years ago

Seeder just for English is not enough (it doesn't fill translations table), I ran this seeder before. Looks like to use default values for English we need to use fallback or fill English translations to translations table. When I run EventCategory::orderBy('name')->pluck('name', 'id') I'm getting values, but EventCategory::listsTranslations('name')->orderBy('name')->pluck('name', 'id') returns empty array.

davide-casiraghi commented 4 years ago

How can I support you ?

On Sat, Oct 17, 2020, 6:12 AM Artur Komarov notifications@github.com wrote:

Seeder just for English is not enough (it doesn't fill translations table), I ran this seeder before. Looks like to use default values for English we need to use fallback or fill English translations to translations table.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/davide-casiraghi/laravel-events-calendar/issues/185#issuecomment-710744144, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQEF25QFLYIHEIKUCPPLCTSLEKTJANCNFSM4SN7JTRQ .

mico commented 4 years ago

I can send you a dump of the production DB if you want. Yes please! Will save a lot of time for me. 🥺

davide-casiraghi commented 4 years ago

Which is your email? I can send It to you through WeTransfer.

On Thu, 22 Oct 2020 at 04:36, Artur Komarov notifications@github.com wrote:

I can send you a dump of the production DB if you want. Yes please! Will save a lot of time for me. 🥺

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/davide-casiraghi/laravel-events-calendar/issues/185#issuecomment-714183459, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQEF22AIUQXZOABP6ADE3TSL6LCHANCNFSM4SN7JTRQ .

mico commented 4 years ago

Which is your email?

artur.komarov@gmail.com