kenepa / translation-manager

Manage your application's translations in Filament.
MIT License
86 stars 27 forks source link

Fix data truncated by ensuring keys are strings. #41

Closed Senexis closed 5 months ago

Senexis commented 8 months ago

Currently in our app, whenever we try to synchronize translations, we get SQL error due to incorrect data types. Turns out whenever an array key is a numeric value in the translations file, the parseTranslation function doesn't work correctly. This is an issue when translating http-statuses:

return [
    '0'   => 'Unknown Error',
    '100' => 'Continue',
    '101' => 'Switching Protocols',
    // ...
];

The above keys would turn into integers which causes issues in the DELETE query for the synchronize action. Rather than fixing that query and having to potentially figure out more queries where this goes wrong, instead this ensures the keys are always strings to begin with, avoiding the issue altogether.

As a small bonus fix, add a missing translation key for the Section in the resource.

Jehizkia commented 5 months ago

Thank you! Resolved by https://github.com/ster/translation-manager/pull/1