Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

locale is transformed to lowercase #81

Open
ToP29 opened this issue Jun 8, 2022 · 3 comments
Open

locale is transformed to lowercase #81

ToP29 opened this issue Jun 8, 2022 · 3 comments
Labels
base Issue related to base functionality enhancement New feature or request
Milestone

Comments

@ToP29
Copy link

ToP29 commented Jun 8, 2022

I am working on pretty big project reworking it from svetle-i18n and we are using locale when saving items to database, so previously we saved every locale in uppercase format and now if i implement this package it breaks everything across the project, because it transforms current locale to lowercase. I think that locale should be kept in same format as it is defined in loaders (key locale).

const config = {
  parser: parser({ ignoreTag: true }),
  loaders: [
    {
      locale: 'CS',
      key: '',
      loader: async () => (await import('localization/messages/cs.json')).default,
    },
    {
      locale: 'EN',
      key: '',
      loader: async () => (await import('localization/messages/en.json')).default,
    },
  ],
};
@jarda-svoboda
Copy link
Member

Locale is not transformed to lowercase (actually in your case is), but to ISO 639-1 Language Code and I think this is a correct behavior, because you want to be able to use lang, hreflang (and others) html attributes using your $locale..

Don’t know your exact use case, but I think you could use transformed store derived from the original $locale…?

@ToP29
Copy link
Author

ToP29 commented Jun 8, 2022

And would it be possible to at least add option to the config, if the transformation to ISO 639-1 Language Code should be enabled or not? I think I am not the only one who is migrating from svelte-i18n and who might find this automatic transformation causing a lot of breaking changes.

@jarda-svoboda
Copy link
Member

That’s a good point… Could you, please, provide some small repro? Just to see what exactly causes the issue… I’ll provide some solution for use cases like this.)

@jarda-svoboda jarda-svoboda added enhancement New feature or request base Issue related to base functionality labels Jul 30, 2022
@jarda-svoboda jarda-svoboda added this to the 2.2.3 milestone Jul 30, 2022
@jarda-svoboda jarda-svoboda modified the milestones: 2.3.0, 2.x Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
base Issue related to base functionality enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants