-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Consider alerting visitors to unofficial docs translation #13094
Comments
What do you have in mind to alert to visitor with? A standard browser |
Oh please no popup JS alert! :D Sorry, elaborating: Right now, translations are hidden way down on the Getting started page. The idea is to detect a visitor's preferred language, check if we have a suiting unofficial translation available and display a short message and link somewhere on the page. Most recently, I remember www.teslamotors.com having such functionality. The message and link might go between the purple masthead and the normal content on any page. The option of saving in a cookie if a user has dismissed the message is also worth considering. |
Yeah no alert :/ But something like we do when the user is using an unsupported browser using the |
I'd be happy to look into this, if @XhmikosR isn't doing so already. |
Feel free to take care of this @hnrch02. Thanks! |
Cool, thanks @hnrch02 ! |
Will work on this first thing tomorrow. |
So, here's what I've found out so far: |
@hnrch02: maybe we should just check for |
Yeah, let's go with that for now. Also, sorry I didn't reply earlier. |
The next question is how we'd expose the list of available translations from that YAML data file to the user facing JavaScript. |
I'm no expert here but maybe we could let Jekyll generate a JSON file from the YAML data? |
Unfortunately we can't use any custom plugins with GitHub Pages... |
JSON is basically a subset of YAML you know. So you could just rewrite the YAML to be JSON and then use the JSON in both places. |
@cvrebert As far as I can tell from a quick test, Jekyll can't parse JSON in |
Haven't tried it, but it theoretically ought to work unless Jekyll is pulling some shenanigans. Did you check your JSON with a validator? |
Yup, valid JSON, but no generated list of translations in getting-started... My original idea was keeping the YAML and adding a file
|
Output: [
{
"name": "Chinese",
"code": "zh",
"description": "Bootstrap 中文文档",
"url": "http://v3.bootcss.com/"
},
{
"name": "French",
"code": "fr",
"description": "Bootstrap en Français",
"url": "http://www.oneskyapp.com/docs/bootstrap/fr"
},
{
"name": "German",
"code": "de",
"description": "Bootstrap auf Deutsch",
"url": "http://holdirbootstrap.de/"
},
{
"name": "Korean",
"code": "ko",
"description": "Bootstrap 한국어",
"url": "http://bootstrapk.com/BS3/"
},
{
"name": "Russian",
"code": "ru",
"description": "Bootstrap по-русски",
"url": "http://www.oneskyapp.com/docs/bootstrap/ru"
},
{
"name": "Spanish",
"code": "es",
"description": "Bootstrap en Español",
"url": "http://www.oneskyapp.com/docs/bootstrap/es"
},
{
"name": "Ukrainian",
"code": "uk",
"description": "Bootstrap ua Українською",
"url": "http://twbs.site-konstruktor.com.ua"
}
] |
@juthilo That's essentially what I did, I just put it in a {
de: {
name: 'German',
description: 'Bootstrap auf Deutsch',
url: 'http://holdirbootstrap.de/'
}
} |
Closing per #13595. |
I planned on implementing this but my JS knowledge failed me.
If anybody else wants to jump in and give it a try, be my guest.
I'll open a Pull Request in a moment to convert the translations section in the docs to be generated from YAML data, which might help with the implementation of this feature.
/cc @twbs/team
The text was updated successfully, but these errors were encountered: