tomatophp / filament-translations

Manage your translation with DB and cache
https://tomatophp.com/en/open-source/filament-translations
MIT License
41 stars 16 forks source link

config seems to ignored, failover missing #23

Closed mrvnklm closed 1 month ago

mrvnklm commented 2 months ago

Since updating the package I have the following issues:

  1. wrong locales showing up and mine are missing on empty entries

    Screenshot 2024-08-28 at 13 27 43
  2. array key should not be resolved from config as the entry might not exist

    Screenshot 2024-08-28 at 13 28 05
  3. adding them temporary does not resolve key properly even though it works in list view

    Screenshot 2024-08-28 at 13 30 08 Screenshot 2024-08-28 at 13 30 03

my locals settings:

    'locals' => [
        'de' => [
            'label' => 'German',
            'flag' => 'de',
        ],
        'en' => [
            'label' => 'English',
            'flag' => 'us',
        ],
    ],
dave-mills commented 2 months ago
  1. wrong locales showing up and mine are missing on empty entries

I had this same issue. Turns out the FilamentTranslationComponent that powers the editing has its own config file, and changing it there worked for me. So you need the locals array in both:

Short term, I think an update to the installation / config steps would be helpful here. I get why they're separate (so you can use the component without the main plugin), but long-term it would be nice to be able to specify a list of locales once and have both parts reference it.

3x1io commented 2 months ago

hi, @dave-mills @mrvnklm I will try to make it 1 config on the translation component or main package to make it more easy.

3x1io commented 1 month ago

it's fine now you can check the last version.

mrvnklm commented 1 month ago

I am still getting Undefined array key "ar" when I remove ar from locals like

    'locals' => [
        'de' => [
            'label' => 'German',
            'flag' => 'de',
        ],
        'en' => [
            'label' => 'English',
            'flag' => 'us',
        ],
    ],

There should be a fallback when the key is not found instead of an exception