Skip to content
This repository has been archived by the owner on Nov 21, 2018. It is now read-only.

i18n/build improvements, part 1 #243

Merged
merged 4 commits into from
Feb 26, 2015
Merged

Conversation

snostorm
Copy link
Contributor

Modifies to use handlebars, only adds checksums/git info to changed files, outputs only changed files.

Semi work-in-progress, but merge-able.

  • Reading the individual commits in order (versus the bigger diff against master) might be a good place to start as it avoids the "noise" of the public directory changes.
  • Fixes the mass updates to ./public files (that haven't actually changes) which I reported as a side comment in Updates public/ with out-of-date i18n #234
  • I (originally) left the i18n-* hooks in the existing template file to keep the diff of ./public more readable and left it as a final commit for diff readability (when reading the individual commit changes.)
  • Partial prep work for Language detection + linking #235 (although more work is needed for detection)
  • Helps with requests like Localize comment in HTML #225
  • Alternative approach to use jade templates #195. However, this doesn't necessarily stomp over the Jade proposal discussed, but it is a good simple step while we discuss larger changes to tempting.
  • I excluded some of my previous (in progress) work on optimizing how we organize the template build script to keep things closer to the status quo. This should keep the review easier. I'll follow up with that additional cleanup / commenting / refactoring later, as I don't like to mass refactor and change functionality too much at the same time.

@snostorm
Copy link
Contributor Author

@iojs/website can we get a faster review on this? Because of the mass changes to ./public we'll possibly have to deal with conflicts if other stuff gets in to master first.

(That said, if there are real blockers on this change, we should properly deal with them first.)

This was referenced Feb 26, 2015
@bnb
Copy link

bnb commented Feb 26, 2015

Went through everything, and it beside my previous comment, it looks good to me.

@snostorm
Copy link
Contributor Author

Yup @bnb, once that we have this merged it would be trivial to follow up with another PR adding support.

@therebelrobot
Copy link
Contributor

+1

@snostorm
Copy link
Contributor Author

Forgetting our own rules. How many +1's do we need before somebody hits the big green button?

@therebelrobot
Copy link
Contributor

Oh, yeah, I probably could just merge it. sorry.

therebelrobot added a commit that referenced this pull request Feb 26, 2015
@therebelrobot therebelrobot merged commit 759d646 into master Feb 26, 2015
@snostorm
Copy link
Contributor Author

Merci beaucoup @therebelrobot! Next up: trying to work some JS magic around language detection. (Although we may need some hints from the server to help it work better.)

@bnb
Copy link

bnb commented Feb 26, 2015

@snostorm Don't know if you saw it, but someone suggested doing it by geo-ip (or whatever geological ip location is called).

I think it was in one of the last few TC meetings that someone, maybe @mikeal, said it was super annoying to have pages auto-translated in foreign countries with no way to easily change back to English.

Additionally, @mikeal said some of the localization groups don't want their translations to be automatically changed, as the majority of developers in their country/lang read and use English commonly or for development. They only want their translation as a backup.

Back to geo-ip, we could auto translate by ip for the localization groups that want that. I would use some notifications library (there are about a million jQuery plugins for this) and simply put a toast/notification in one of the corners that had a description in both languages and link to the English translation that went away when the user either went to the English translation or closed it.

We could do the reverse for the languages that want to keep English as the main site, with a description in both languages and a link to the correct language translation.

Thoughts?

@therebelrobot
Copy link
Contributor

I like the idea, @bnb, I also have a few open APIs that do geo-location that we could ping on page load, then just have a list of what the localization team wants for their region. We'd have to get all those regions specified, of course, maybe through geoJSON, but should be fairly simple.

@Fishrock123
Copy link
Contributor

I'm getting an error at https://github.com/iojs/website/blob/master/gulp/tasks/templates.js#L59 when trying to rebuild after bumping the versions for the release. Investigating.

@Fishrock123
Copy link
Contributor

Error log:

Jeremiahs-MacBook-Pro:iojs-website Jeremiah$ gulp build
[17:57:29] Using gulpfile ~/Documents/iojs-website/gulpfile.js
[17:57:29] Starting 'build'...
[17:57:29] Starting 'clean'...
[17:57:29] Finished 'clean' after 39 ms
[17:57:29] Starting 'stylus'...
[17:57:29] Starting 'templates'...
[17:57:29] Finished 'templates' after 8.2 ms
[17:57:29] Size es6.css : 37 B
[17:57:29] Size faq.css : 37 B
[17:57:29] Size index.css : 1.54 kB
fs.js:515
  if (typeof m === 'string')
               ^
Error: ENOENT: no such file or directory, open 'public/cn/es6.html'
    at Error (native)
    at Object.fs.openSync (fs.js:540:18)
    at Object.fs.readFileSync (fs.js:392:15)
    at isChangedFile (/Users/Jeremiah/Documents/iojs-website/gulp/tasks/templates.js:59:35)
    at module.exports (/Users/Jeremiah/Documents/iojs-website/node_modules/gulp-if/node_modules/gulp-match/index.js:15:12)
    at classifier (/Users/Jeremiah/Documents/iojs-website/node_modules/gulp-if/index.js:19:12)
    at ForkStream.classifier (/Users/Jeremiah/Documents/iojs-website/node_modules/gulp-if/node_modules/ternary-stream/index.js:19:16)
    at ForkStream._write (/Users/Jeremiah/Documents/iojs-website/node_modules/gulp-if/node_modules/ternary-stream/node_modules/fork-stream/index.js:44:20)
    at doWrite (_stream_writable.js:295:12)
    at writeOrBuffer (_stream_writable.js:282:5)

@therebelrobot
Copy link
Contributor

Kk. Looking into it too.

@therebelrobot
Copy link
Contributor

Kk. The issue was with the clean gulp task, which I've disabled for now. We should probably decide whether or not we want to keep that task or not.

@snostorm snostorm deleted the improved-language-support branch February 27, 2015 13:28
@snostorm
Copy link
Contributor Author

Re: auto-language, I was thinking of doing it in a few passive ways (to start):

  1. Simply provide a language switch toggle on the site to help users be aware translations exist. Either Wikipedia-style (list them on the left somewhere) or as a dropdown.
  2. Via front-end JavaScript (and/or Geo-IP; and/or content language request header) prompt users visiting the site if we think they might want a language other than the one you first hit. This could be toast style / a dismissible banner / etc.

    "This article is also available in English" / "Cet article est disponible en français."

Mostly we're not even linking to the translations right now, so Google has no reason to find them. I want to resolve that in Part 2 (or 3) as well.

@snostorm
Copy link
Contributor Author

Also: lets move back discussion to one of the generic Issues to not lose track of good ideas :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants