PDA

View Full Version : Language switching in css



Zipotron
10-04-2005, 02:19 PM
Hi, i want to make a bilingual site (english & french) with css only if possible.

I've see somthing like that somewere but it had a 2 pages in a page structure
like:
<div id="En">
..
</div>
<div id="Fr">
..
</div>

but i want a struture like this:
<div class="En">
..
</div>
<div class="Fr">
..
</div>
<div class="En">
..
</div>
<div class="Fr">
..
</div>

but they use ID and it can't be use more than once in a page
i've try to find something using CLASS element to be able to use it more than once...

can someone help? :confused:

Thanks !

jscheuer1
10-04-2005, 03:41 PM
Sounds like javascript would be required in either case. Care to post a link to the one that does it using only css and id?

Zipotron
10-04-2005, 05:19 PM
Ok, i don't find the pure css one anymore, lost in my favorites..

I have find some with a small javascript in it. http://simon.incutio.com/code/js/easytoggle/example2.html

http://www.saila.com/attic/sandbox/hide-show_blocks.html

http://www.sitepoint.com/article/structural-markup-javascript/2

but i had one with no java...

i'll search again but my favorites it's a jungle... lol

thanks if you can help..

jscheuer1
10-04-2005, 05:36 PM
Don't feel bad, you probably imagined it. I envision that with id it could be done with a very small onclick event to a button or link. With class it could also be done that way except the onclick event would have to be a bit more complex, best passed off to a function. Still, if you are going to all the trouble of writing all your content in two languages, make up alternate pages. That way no javascript will be required, kinder to the browsing public, many of whom may not have javascript enabled.

Zipotron
10-04-2005, 07:00 PM
I wanna manage only one set of page for the bilingual site (1 set it's ok, but 2 set it's hard, for me anyway).

I just had i idea !

If i put the french text on a z-index and the english text on an other one
and i use 2 set of css (1 will hide french, the other english).

than i'll use a button to activate..

no java, for this anyway, ok i have already javascript on the site but.. this is not the question..lol

what do you think of that?

jscheuer1
10-04-2005, 07:45 PM
I still don't see how a button can activate a stylesheet without using javascript or some kind of scripting. It would be nice if it could and I certainly may be missing something.

The z-index is not as reliable as display for hiding and revealing content. If you can switch stylesheets, switch ones utilizing the display property.

mwinter
10-04-2005, 11:16 PM
Hi, i want to make a bilingual site (english & french) with css only if possible.There are a couple of ways to manage multilingual sites, but CSS is not one of them.

This isn't an issue I've ever had to deal with personally, but I've seen bits of material around on the subject. The most extensible solution is to pull localised data from a database. You should be able to find decent results (http://groups.google.co.uk/groups?q=multilingual+%7C+languages+site+%7C+sites+group:alt.html+%7C+group:comp.infosystems.www.authoring.html&start=0&scoring=d&hl=en) on Usenet (a good place to discuss the topic) and the Web, but I've lost threads that I've found interesting in the past. A thread from last year (http://groups.google.co.uk/group/alt.html/browse_frm/thread/dd00892f36e5d244/51863ce8831bb539?tvc=1&q=multilingual+%7C+languages+site+%7C+sites+group:alt.html+%7C+group:comp.infosystems.www.authoring.html&hl=en#51863ce8831bb539), though very brief, has some ideas.

You should also consider delivery of the site. It is preferable that the user gets served their preferred language, a default (probably English) if it's not available, and links to other language versions (for cases where their browser is misconfigured). This is best achieved with language negotiation, but it has a few issues to consider. Alan J. Flavell's Language Negotiation Notes (http://ppewww.ph.gla.ac.uk/~flavell/www/lang-neg.html) is a frequently cited source, as is Jukka Korpela's Techniques for multilingual Web sites (http://www.cs.tut.fi/~jkorpela/multi/) and On multilingual Web sites and CSS (http://www.cs.tut.fi/~jkorpela/www/multicss.html).

What you're considering may certainly be easier from an author's perspective, but it really isn't the way to go.

There is software that can help you with this. Can't think of any name off the top of my head, though.

Mike

Zipotron
10-05-2005, 12:03 AM
Thanks for the answers guys !

I'll try to use dhtml with cookies to keep the user choice.
I don't wanna use the language tags cause', i think user may want to use an other language than the one config in there browser.

but i'm not sure how to begin.

bye, thanks again