sveltekit-i18n / lib

Internationalization library built for SvelteKit.
MIT License
447 stars 28 forks source link

preprocess: preserveArrays do not work with string[] #152

Closed AlexandreBrayer closed 9 months ago

AlexandreBrayer commented 9 months ago

Let's say i have this translation in home.json "test": [ "number1", "number2" ], and preprocess: 'preserveArrays' in my config

When I try to log it, I got [ { "0": "n", "1": "u", "2": "m", "3": "b", "4": "e", "5": "r", "6": "1" }, { "0": "n", "1": "u", "2": "m", "3": "b", "4": "e", "5": "r", "6": "2" } ]

The only way i found to make arrays work with preserveArrays is to declare my translation like this "test": [ { "content": "number1" }, { "content": "number2" } ] then i get [ { "content": "number1" }, { "content": "number2" } ] in my log.

jarda-svoboda commented 9 months ago

Hi @AlexandreBrayer! Thanks for reporting this behavior. It seems like a bug😬 I’ll verify and fix that soon.

jarda-svoboda commented 9 months ago

@sveltekit-i18n/base@1.3.6 published. run npm i @sveltekit-i18n/base@latest (or sveltekit-i18n@latest) to install the fixed version