grid-js / gridjs

Advanced table plugin
https://gridjs.io
MIT License
4.39k stars 240 forks source link

Empty translated fields fallback to default language. #1418

Open rubycon opened 8 months ago

rubycon commented 8 months ago

Describe the bug Empty translated fields fallback to default language.

To Reproduce Setup a paginated table with FR translation and you'll see something like :

Affichage des résultats 1 à 6 sur 6 results

Expected behavior It should display :

Affichage des résultats 1 à 6 sur 6.

Additional context The issue comes from here : https://github.com/grid-js/gridjs/blob/2d337e662e6e405814d774125ee69eda3bfae628/src/i18n/language.ts#L48

The french translation file translate results as an empty string to compensate issues with the word basis translation but the translation function fallback to the default language when dealing with an empty string.

Usually its the right behaviour for a translation system but here it conflicts with the hacky way the translation is handled.

See issue https://github.com/grid-js/gridjs/issues/1416#issuecomment-1921043121