[opensuse-web] Dynamic counter change according to locale
Hi, I add a few codes into frontpage.js in landing-page here they are: // dynamic change counter $(document).ready(function() { var path = $(location).attr('href'); // 24 = http://www.opensuse.org/ if (path.length > 24) { // should return string like "cn" "ja" "fr" path = path.substring(path.lastIndexOf("/")-2); path = path.substring(0,path.length-1); //test if the counter exists var counter = new Image(); counter.src = "http://counter.opensuse.org/medium."+path+".png"; if (counter.width > 0) { $("h1").css("background-image","http://counter.opensuse.org/medium."+path+".png"); } } }); basically it'll at first detect if default en page, if not, then see if the local counter exists, if exists, then change the English counter with the local one. Enjoy! Anyone please merge pull request 2 at https://github.com/openSUSE/landing-page/pulls Marguerite -- To unsubscribe, e-mail: opensuse-web+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-web+owner@opensuse.org
Marguerite Su wrote:
[...] basically it'll at first detect if default en page, if not, then see if the local counter exists, if exists, then change the English counter with the local one.
Actually the apache config is supposed to do that automatically. It just fails for chinese for some reason. Other locales work. If you deploy the suggested change you likely break other languages. Check the quick locale switcher add-on of firefox to see the effect. Someone with knowledge about rewrite rules would have to take a look at the apache config to fix this properly. cu Ludwig -- (o_ Ludwig Nussel //\ V_/_ http://www.suse.de/ SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: opensuse-web+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-web+owner@opensuse.org
On Thu, Aug 30, 2012 at 11:26 PM, Ludwig Nussel <ludwig.nussel@suse.de> wrote:
Actually the apache config is supposed to do that automatically. It just fails for chinese for some reason. Other locales work. If you deploy the suggested change you likely break other languages. Check the quick locale switcher add-on of firefox to see the effect. Someone with knowledge about rewrite rules would have to take a look at the apache config to fix this properly.
oh that's embarrassing... not Chinese only... http://www.opensuse.org/fr/ http://www.opensuse.org/cs/ also display the English counter I thinks javascript solution is universal and better than apache config... Marguerite -- To unsubscribe, e-mail: opensuse-web+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-web+owner@opensuse.org
Hi,
Od: Marguerite Su <i@marguerite.su> Předmět: Re: [opensuse-web] Dynamic counter change according to locale Datum: 30.8.2012 17:40:45 ---------------------------------------- On Thu, Aug 30, 2012 at 11:26 PM, Ludwig Nussel <ludwig.nussel@suse.de> wrote:
Actually the apache config is supposed to do that automatically. It just fails for chinese for some reason. Other locales work. If you deploy the suggested change you likely break other languages. Check the quick locale switcher add-on of firefox to see the effect. Someone with knowledge about rewrite rules would have to take a look at the apache config to fix this properly.
oh that's embarrassing...
not Chinese only...
also display the English counter
Czech counter is displayed in Czech, when you have set Czech locales (i suppose). Because if I go there from Czech environment, there is the Czech message. If I go from English environment, there is the English message. I noticed that localized counter images (<size>.cs.png, eg. wide.cs.png) aren't available, but when I use general address, it works localised according to some locales settings. Do I understand it well? Jan Papež (honyczek) -- To unsubscribe, e-mail: opensuse-web+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-web+owner@opensuse.org
honyczek-mailing@email.cz wrote:
Od: Marguerite Su <i@marguerite.su> Předmět: Re: [opensuse-web] Dynamic counter change according to locale Datum: 30.8.2012 17:40:45 ---------------------------------------- On Thu, Aug 30, 2012 at 11:26 PM, Ludwig Nussel <ludwig.nussel@suse.de> wrote:
Actually the apache config is supposed to do that automatically. It just fails for chinese for some reason. Other locales work. If you deploy the suggested change you likely break other languages. Check the quick locale switcher add-on of firefox to see the effect. Someone with knowledge about rewrite rules would have to take a look at the apache config to fix this properly.
oh that's embarrassing...
not Chinese only...
also display the English counter
Czech counter is displayed in Czech, when you have set Czech locales (i suppose). Because if I go there from Czech environment, there is the Czech message. If I go from English environment, there is the English message.
I noticed that localized counter images (<size>.cs.png, eg. wide.cs.png) aren't available, but when I use general address, it works localised according to some locales settings.
Exactly. There's a firefox add-on that let's you switch locales per site. Useful for testing. cu Ludwig -- (o_ Ludwig Nussel //\ V_/_ http://www.suse.de/ SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: opensuse-web+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-web+owner@opensuse.org
participants (3)
-
honyczek-mailing@email.cz
-
Ludwig Nussel
-
Marguerite Su