sveltekit-i18n / lib

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

zu locale is non-standard #156

Closed MrRoyce closed 8 months ago

MrRoyce commented 9 months ago

Hi all, I'm trying to add Zulu (zu) as a translation language but the library throws a warning

[i18n]: 'zu' locale is non-standard.

Is there a list of valid languages? Is there a way around this issue?

ThibaultAndreis commented 9 months ago

This project uses Intl.Collator.supportedLocalesOf()

a browser api to return the matching locales given a string

Intl.Collator.supportedLocalesOf('zu')

return ['zu'] in firefox and in safari

Trying it on chrome returns an empty array, even after having installed Zulu on my computer

This seems to be a duplicate of #109

As far as the mn locale is not supported by Intl.Collator.supportedLocalesOf you could avoid console warnings for production like this:

import type { Config } from 'sveltekit-i18n';

const config: Config = {
  // ...
  log: {
    level: process.env.NODE_ENV === 'production' ? 'error' : 'warn',
  }
};
jarda-svoboda commented 8 months ago

This behavior is not being considered as an issue of this lib as it uses native JavaScript solution to differentiate between standard and non-standard locales.