Uh oh!
There was an error while loading. Please reload this page.
nodejs.org: falling back to english when page hasn't been translated - #316
nodejs.org: falling back to english when page hasn't been translated#316phillipj wants to merge 3 commits into
Conversation
jbergstroem
commented
Feb 2, 2016
This will make all 404's redirect to |
phillipj
commented
Feb 2, 2016
Good question. Got to admit I didn't think about URLs other than the actual On Tuesday, 2 February 2016, Johan Bergström notifications@github.com
|
phillipj
commented
Feb 13, 2016
I assume you would rather see it check the /en/ equivalent exist before doing a redirect, correct? Haven't been able to get that working... Got a trick up your sleeve @jbergstroem? |
phillipj
commented
Mar 2, 2016
To elaborate on what I've tried to accomplish without luck so far: The biggest challenge here is doing a string replace on the current Anyway the use |
jbergstroem
commented
Mar 2, 2016
How about going at it the other way? redirecting all other 'known' languages that doesn't exist to en? |
phillipj
commented
Mar 7, 2016
@jbergstroem something like this? That surely removes the complexity and no if's in sight 👍 |
0a34b07 to
224dcdbComparephillipj
commented
Mar 9, 2016
@jbergstroem just updated the PR with the simplified version posted above ^^ with explicit known languages as you suggested. Also added the english fallback to the |
phillipj
commented
Mar 23, 2016
@jbergstroem any thoughts on this after it got updated? |
Fishrock123
commented
Apr 11, 2016
Didn't we have something like this for iojs.org? Looks like it does work on iojs.org: https://iojs.org/fa/es6.html Ideally, however, it would not re-write to /en/ so that any future links can still go to the native language? I think? I'm not sure. |
Fishrock123
commented
Apr 11, 2016
Hmm, looks like we just made redirect static files for each page: https://github.com/nodejs/iojs.org/blob/master/source/static/es6.html |
Fishrock123
commented
Apr 11, 2016
As a note, 404's don't even work correctly at the current time: https://nodejs.org/ko/404/ - yet we clearly have one for korean: https://github.com/nodejs/nodejs.org/blob/master/locale/ko/404.md |
| } | ||
| location / { | ||
| try_files $uri $uri/ @english_fallback; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Fishrock123
commented
Apr 24, 2016
Ok I spent some time trying to get the localized 404 pages working today. What I've come up with: location @english_fallback {if($uri~* ^/(it|ko)/){set$lang$1;}rewrite ^/(it|ko)/(.*)$ /en/$2; # I've used a relative url here for testing, not sure if it should be absolute or not
# No `return 404;` here, I think that makes our page actually return that status code ontop of serving..}Where we currently declare error_page @404;# use localized 404 pages if possiblelocation @404{try_files /$lang/404.html /en/404.html;} |
Fishrock123
commented
Apr 24, 2016
@phillipj Hopefully you have time to look at this, I'd definitely like to get it live! |
jbergstroem
commented
Apr 24, 2016
I will follow up here shortly too. |
ebf0e0b to
e8d291eComparephillipj
commented
Apr 25, 2016
@Fishrock123 awesome, thanks for pitching in here! Just pushed an update which contains your localized 404 hackery 👍 |
| if ($uri ~* ^/(it|ko)/) { | ||
| set $lang $1; | ||
| } | ||
| rewrite ^/(it|ko)/(.*)$ /en/$2; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Fishrock123
commented
May 2, 2016
@nodejs/build could some people look at this please? This is really important for website translation and I'd like to get it live ASAP. |
phillipj
commented
May 2, 2016
Rebased to fix merge conflict. Also decided to not go for relative rewrites to do things as before, and not raising more questions than necessary. |
Starefossen
commented
May 2, 2016
Looks good to me 👍 |
jbergstroem
commented
May 2, 2016
Sorry for the delay -- I just need to do some performance testing (if's are evil yada yada) |
Fishrock123
commented
May 3, 2016
|
Fishrock123
commented
May 13, 2016
@jbergstroem Can we merge this and if it really turns out to be a problem, undo it and have a single, multi-language 404 page? This is badly blocking translation groups as I understand... I know you're busy. :( (I don't really know how to benchmark this... if you just want me to run |
jbergstroem
commented
May 31, 2016
@phillipj I'd suggest having a ubuntu14 machine available and override hosts |
rvagg
commented
May 31, 2016
I've been messing with setting up a test machine for you to play with this on, knowing that our ansible scripts are not entirely solid for the web server this was a good chance to try and address that. @phillipj I've put your ssh keys from GitHub into root@107.170.115.122 and it's set up almost identically to the nodejs.org server and you can do what you like with it. Stick For the record: the playbook in this repo for www should be in a better state now, it can be run with |
rvagg
commented
May 31, 2016
@Fishrock123 I put your keys in there too if you're interested in shaving this yak |
Fishrock123
commented
May 31, 2016
Noted, looking at it right now. |
Fishrock123
commented
May 31, 2016
Hmm, Indeed it does not appear to be working. Aside: why do we have 2 server configs for both blog.nodejs.org and nodejs.org? It's quite confusing. |
rvagg
commented
May 31, 2016
@Fishrock123 legacy, you'll note that all of the blog redirects are contained within the blog.nodejs.org part of the config, which leave the main nodejs.org config with much fewer redirects in its flow. I think that's what you're referring to. Or perhaps you're seeing |
rvagg
commented
May 31, 2016
Also, you're welcome to propose improvements to our nginx config, for both readability and actual efficiency. Just be aware of the legacy constraints, things need to continue to work as they do now. Mostly I'm pretty afraid to mess with nginx config too much because it's a bit like playing wac-a-mole. https://github.com/nodejs/build/blob/master/setup/www/resources/config/nodejs.org |
phillipj
commented
Jun 3, 2016
@rvagg thanks for adding my keys! After some trial-n-error, it seems like using relative URLs in the fallback rewrites made a positive impact. I just pushed a commit. Those changes has been made on |
phillipj
commented
Jun 4, 2016
Added |
| error_page 404 @localized_404; | ||
| location / { | ||
| try_files $uri $uri/ @english_fallback; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
rvagg
commented
Jun 8, 2016
sgtm but I'm way too gun shy with this nginx config to be comfortable signing off on it. Can others who are comfortable hacking nginx config have a look and try it out on the test host too? @jbergstroem? |
jbergstroem
commented
Jun 8, 2016
I will follow up shortly to confirm that it works as intended. I wasn't a big fan of how variable scopes were used; but it was indeed nifty. |
Fishrock123
commented
Jun 13, 2016
At some point we're going to have to just try it. |
Fishrock123
commented
Jun 24, 2016
... ping again ... |
rvagg
commented
Jun 27, 2016
I'm OK with giving this a try, but only if @jbergstroem is +1 too. We should probably do it during a low traffic period, the weekend I guess, as long as we have people around to revert quickly if need be. |
jbergstroem
commented
Jun 27, 2016
Not sure which timezone digitalocean runs by, but least amount of traffic occurs in ~13h from now. I can attempt to give it a test around then. |
jbergstroem
commented
Jun 28, 2016
This has been running for a bit on nodejs.org now and seems to be working as intended. |
Fishrock123
commented
Jun 30, 2016
Has been running for about 3 days now? I think this can be merged |
jbergstroem
commented
Jul 4, 2016
I'll merge this! |
phillipj
commented
Jul 28, 2016
@jbergstroem any progress on merging this? nodejs.org just got a new locale (es / spanish), so it would be nice to get this merged before opening a new PR adding spanish as well. |
jbergstroem
commented
Jul 28, 2016
@phillipj I'll add es/spanish. |
Fall back to english if a page hasn't been translated. Refs: nodejs/nodejs.org#490 PR-URL: #316 Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Rod Vagg <rod@vagg.org>
jbergstroem
commented
Jul 28, 2016
Merged (with the addition of |
phillipj
commented
Jul 28, 2016
Awesome 👍 On Thursday, 28 July 2016, Johan Bergström notifications@github.com wrote:
|
Refs nodejs/nodejs.org#490
Currently translation working groups will have to translate all pages to their respective
language, if not most pages would end in displaying a (english) 404 page. That's a massive
requirement on translation groups, and keeping up with future changes are probably near impossible.
Lowering the barrier and letting translation groups start on the frontpage and work their way
down a couple of page depths, should be alot simpler and more rewarding.
NB! This only affects local development as nodejs.org runs nginx serving strictly static content.
Getting the same behaviour in production requires changes to the nginx config.
Example of the current 404 issue; navigate any of the headers links in the current Korean translation: https://nodejs.org/ko/. I haven't done my dues when it comes to translating (yet), this is one of the main reasons I've decided not to.