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

Unsupported locales #54

Closed
dewrano opened this issue Apr 6, 2022 · 8 comments · Fixed by sveltekit-i18n/base#4
Closed

Unsupported locales #54

dewrano opened this issue Apr 6, 2022 · 8 comments · Fixed by sveltekit-i18n/base#4
Assignees
Labels
base Issue related to base functionality bug Something isn't working
Milestone

Comments

@dewrano
Copy link

dewrano commented Apr 6, 2022

Hi

I'm not sure but I think this method filters away unsupported locales:
https://github.com/sveltekit-i18n/base/blob/a5df0f1c63b23504e7dbcbe7a62461f573a78149/src/utils.ts#L26

I'm trying to add the Kurdish language ("ku"), but unfortunately, it's not supported when I try to run this:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/supportedLocalesOf

Is there a way for us to disable the sanitizer?

@jarda-svoboda
Copy link
Member

Hi @dewrano!

Currently there is no way how to disable the sanitizer, but you have probably found a bug. This lib should work even without standard locales - in that case should only warn and use lower-cased form of the input locale.

I'll try to fix this in the next couple of days, thanks.)

@jarda-svoboda jarda-svoboda added the bug Something isn't working label Apr 6, 2022
@jarda-svoboda jarda-svoboda self-assigned this Apr 6, 2022
@jarda-svoboda
Copy link
Member

Ok, this does not yield any error https://github.com/sveltekit-i18n/base/blob/a5df0f1c63b23504e7dbcbe7a62461f573a78149/src/utils.ts#L32 for ku locale, so sanitized locale is undefined...
Definitely needs to be fixed.

@jarda-svoboda
Copy link
Member

Will be included in sveltekit-i18n@2.1.3 and @sveltekit-i18n/base@1.1.2

@jarda-svoboda jarda-svoboda added this to the 2.1.3 milestone Apr 6, 2022
@dewrano
Copy link
Author

dewrano commented Apr 7, 2022

@jarda-svoboda Thank you for the quick response. I've updated to 2.1.3 and now I see new warnings, but I still can't seem to get it to work. When I print out locales, it returns undefined for ku. See attached screenshot.

image

@jarda-svoboda jarda-svoboda reopened this Apr 7, 2022
@jarda-svoboda jarda-svoboda added the base Issue related to base functionality label Apr 7, 2022
@jarda-svoboda
Copy link
Member

Oh, that’s weird… there are tests for it and it worked..🤔 https://github.com/sveltekit-i18n/base/blob/master/tests/specs/index.spec.ts#L138

i’ll look at it again soon..!

@jarda-svoboda jarda-svoboda modified the milestones: 2.1.3, 2.1.4 Apr 7, 2022
@jarda-svoboda
Copy link
Member

It seems it already works on server side, but still does not work on client for some reason...
server:
Snímek obrazovky 2022-04-07 v 22 30 17
client:
Snímek obrazovky 2022-04-07 v 22 30 07

@jarda-svoboda
Copy link
Member

It seems there is a difference between Node's and JS's Intl so that's probably the reason why all tests were passing for ku locale.
Anyway now it's fixed and it works on client as well in sveltekit-i18n@2.1.4 and @sveltekit-i18n/base@1.1.3

@dewrano
Copy link
Author

dewrano commented Apr 9, 2022

@jarda-svoboda Thank you so much, I can confirm it works. :)
Hopefully we can expect #55 soon to disable the many warnings.

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 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants