Opened 12 years ago

Closed 6 years ago

#833 closed enhancement (fixed)

Redirect if the browser/window language is one of the supported

Reported by: fgdrf Owned by: fgdrf
Priority: minor Milestone: OSGeoLive11.0
Component: OSGeoLive Keywords: 5.5
Cc: live-demo@…

Description

in case of the browser has set en, de, el, jp, es or pl the relevant index page should be loaded by redirecting. IMHO this should only happen if the user came from an other side .

Its possible to achieve this behavior by adding a javascript right under 'doc/_static/<path>/<the_java_script_file.js>' and register it in the python script conf.py by the following additional lines:

def setup(app):
    app.add_javascript('<path>/<the_java_script_file.js>')

the js-File can access the language environment:

var supported_languages=["el", "es", "pl", "en", "de", "jp"];

var langCode = navigator.language || navigator.systemLanguage;
var lang = langCode.toLowerCase();
lang = lang.substr(0,2);

// check last page and if it's not live.osgeo.org and 
// browser language is one of the supported and
// requested page was index.html, 
// redirect to the relevant <lang>/index page
// TODO code here

Change history (14)

comment:1 by fgdrf, 12 years ago

Summary: Redirect if the browser/window is one of the supportedRedirect if the browser/window language is one of the supported

comment:2 by camerons, 12 years ago

Keywords: 5.5 added

I think this is a great idea. I assume that the update would work at the http://live.osgeo.org site as well, (when we copy the files across)? If so, then I'd be keen to see this suggestion implemented.

fgdrf, Please feel free to commit an update into OSGeoLive, then test. If implementing the patch, we should do so between builds (such as now in Nov 2011). We probably don't want to include it into the build process just before a release, when we may break the doc build while people are flat out writing docs.

Cameron Shorter

comment:3 by fgdrf, 12 years ago

Owner: changed from live-demo@… to fgdrf
Status: newassigned

comment:4 by fgdrf, 12 years ago

committed on trunk and ready for testing ;) The index.rst file has been updated and calls javascript function redirectToUserLanguage() from osgeolive.js.

comment:5 by hamish, 12 years ago

Cc: live-demo@… added

is it fixed?

comment:6 by fgdrf, 12 years ago

Some unresolved problems with local deployment on localhost (at livedvd itself I guess), Cameron created a ticket (#946) and reverted the changes.

Still open ;)

comment:7 by hamish, 10 years ago

Milestone: OSGeoLive8.0

comment:8 by hamish, 10 years ago

Milestone: OSGeoLive8.0OSGeoLive8.5

comment:9 by kalxas, 9 years ago

Milestone: OSGeoLive8.5OSGeoLive9.0

comment:10 by kalxas, 9 years ago

Milestone: OSGeoLive9.0OSGeoLive9.5

Ticket retargeted after milestone closed

comment:11 by kalxas, 8 years ago

Milestone: OSGeoLive9.5OSGeoLive10.0

Ticket retargeted after milestone closed

comment:12 by kalxas, 8 years ago

Milestone: OSGeoLive10.0OSGeoLive10.5

comment:13 by kalxas, 7 years ago

Milestone: OSGeoLive10.5OSGeoLive11.0

Ticket retargeted after milestone closed

comment:14 by kalxas, 6 years ago

Resolution: fixed
Status: assignedclosed

Fixed since we moved to transifex.

Note: See TracTickets for help on using tickets.