-
Notifications
You must be signed in to change notification settings - Fork 95
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
[JS] Error when comparing with invalid locale (Incorrect locale information provided) #1204
Comments
Thanks for reporting @kinow! How do you change the locale in step 2? |
Changed the interface language. Here's my configuration for languages (the
And the search bar shows German too, which is strange I think? |
Ah, right - I think this is caused by the value of the Line 22 in 4b4359d
It is passed to Skosmos/resource/js/scripts.js Line 339 in 4b4359d
I think the underscore-style locale should be converted to what JS code expects somewhere - the best place to do that would probably be in the Would you like to try to fix this @kinow? :) |
Regarding the search bar: that's probably a different issue altogether. It could be that it reverts to the default language of STW (German) because of some language comparison mismatch (e.g. "en_US" != "en"). I suggest fixing the main issue first, then looking at this later on. |
+1 sounds like a plan!
Yup, I always use Writing a test might be a bit harder, but I'll try too. Thanks @osma! |
Under the hood, looks like new Intl.Collator('en_us') # error
new Intl.Collator('en-us') # ok |
In the ECMAScript document https://tc39.es/ecma402/#intl-object, it says the locale is a valid BCP47 tag, so |
Excellent digging @kinow! This sort of begs the question why language tags with underscores are even used in Underscores are used in locale names like |
Oh, excellent question @osma. We have values like
The label is used internally to match the JS selected values, and the configuration values. Then I guess it's used to submit queries to Jena, e.g. Skosmos/model/sparql/GenericSparql.php Line 1411 in 4b4359d
From what I remember, I added I think we use the locale code (with underscore) also because somewhere we use... a |
(just saw your comment in the PR, sorry, was searching in the IDE and writing here 👍 but agree with you that that's strange to have |
It seems to me that this was a user error - BCP47 language tags should be used for rdfs:label values in config.ttl - with dashes, not underscores, as the separator. I'm closing this issue, but feel free to reopen if you disagree. |
At which URL did you encounter the problem?
Running Skosmos locally, with the locale
en_US
. In JavaScript, the locale needs - I think - to be replaced by en-US or en, otherwise we get aIncorrect locale information provided
fromString.localeCompare
.What steps will reproduce the problem?
en_US
,de_DE
[is this correct?], etc)What is the expected output? What do you see instead?
No errors,
String.localeCompare
uses a valid locale.What browser did you use? (eg. Firefox, Chrome, Safari, Internet explorer)
Firefox & Chromium, Ubuntu LTS.
The text was updated successfully, but these errors were encountered: