-
Notifications
You must be signed in to change notification settings - Fork 610
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
i18n support #17243
base: gh-pages
Are you sure you want to change the base?
i18n support #17243
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for working on this! I left some comments.
tNoResults: "No results found", | ||
tStatusQueryTooShort: "Type ${minChars} or more characters for results.", | ||
tStatusStartTyping: "Begin typing for results.", | ||
tListItemText: "list item ${index} of ${length}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these should be in a separate object, not just as raw properties. Also, we do not need them on every instance, what we need is a way to select a language for the instance. So I'd suggest a data structure like:
Awesomplete.languages = {
"en-us": {
"list-label": "Results List"
}
}
Then instances would point to one of these objects either by storing the language, or a reference to the object (I'll leave that up to you).
awesomplete.js
Outdated
@@ -62,7 +67,7 @@ var _ = function (input, o) { | |||
"aria-live": "assertive", | |||
"aria-atomic": true, | |||
inside: this.container, | |||
textContent: this.minChars != 0 ? ("Type " + this.minChars + " or more characters for results.") : "Begin typing for results." | |||
textContent: this.minChars != 0 ? this.tStatusQueryTooShort.replace("${minChars}", this.minChars) : this.tStatusStartTyping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably need a method for this instead of just raw .replace()
calls (also note that if the phrase needs to continue the substitution multiple times, this will only substitute the first one).
For inspiration, check out how Mavo does this: https://github.com/mavoweb/mavo/blob/master/src/locale.js#L25
Hello @LeaVerou |
#17242
I tried to add simple i18n support. is currently running as part of our timetable: https://preview-timetable.dsiag.ch
Cheers, Roman