Re: [css-d] Language switching
From: Paul Novitski [EMAIL PROTECTED] Here's an example of one technique that I produced using English Japanese text: http://laurietobyedison.com/WOJwords.asp?lang=EN Every bilingual page on the site contains both languages, with only one of them displayed at a time. In the absence of javascript, the Japanese/English toggle requests the current page from the server with the requested language selected (by specifying it in the body class). With javascript enabled, the language toggle simply switches the body class and the displayed language changes immediately. At 3/5/2007 06:28 PM, Chris Chen wrote: Could you elaborate a bit on what you mean by switch body class with a simple example? Hi Chris, Here's one example of this technique. Plug the requested language into the body class: body class=langEN or body class=langES then mark up language-specific strings in the page: p class=langENThis is English/p p class=langESEsto es español/p Then you can style: /* first hide all the language-specific paragraphs */ p.langEN, p.langES { position: absolute; left: -1000em; } /* now show the current language */ body.langEN p.langEN, body.langES p.langES { position: static; } The body class can be changed either by a server-side script while the page is being constructed or by a client-side script while the page is being used. In other situations, I use the body id class to target styling rules to particular pages from within a global stylesheet: body id=index or body id=about then: /* highlight the nav menu item for the current page */ body#index ul#nav li.index, body#about ul#nav li.about { color: #F00; } Regards, Paul __ Paul Novitski Juniper Webcraft Ltd. http://juniperwebcraft.com __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d IE7 information -- http://css-discuss.incutio.com/?page=IE7 List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Re: [css-d] Language switching
Paul Novitski wrote: From: Paul Novitski [EMAIL PROTECTED] Here's an example of one technique that I produced using English Japanese text: http://laurietobyedison.com/WOJwords.asp?lang=EN Every bilingual page on the site contains both languages, with only one of them displayed at a time. In the absence of javascript, the Japanese/English toggle requests the current page from the server with the requested language selected (by specifying it in the body class). With javascript enabled, the language toggle simply switches the body class and the displayed language changes immediately. At 3/5/2007 06:28 PM, Chris Chen wrote: Could you elaborate a bit on what you mean by switch body class with a simple example? Hi Chris, Here's one example of this technique. Plug the requested language into the body class: body class=langEN or body class=langES so for every language you have a seperate html file? Erik __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d IE7 information -- http://css-discuss.incutio.com/?page=IE7 List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Re: [css-d] Language switching
From: Paul Novitski [EMAIL PROTECTED] Every bilingual page on the site contains both languages, with only one of them displayed at a time. In the absence of javascript, the Japanese/English toggle requests the current page from the server with the requested language selected (by specifying it in the body class). With javascript enabled, the language toggle simply switches the body class and the displayed language changes immediately. At 3/5/2007 06:28 PM, Chris Chen wrote: Could you elaborate a bit on what you mean by switch body class with a simple example? Paul Novitski wrote: Here's one example of this technique. Plug the requested language into the body class: body class=langEN or body class=langES At 3/6/2007 01:08 PM, Erik Visser wrote: so for every language you have a seperate html file? No. I suppose that's a possible approach, but I never work like that. Most of the time I keep variable content in an SQL database and merge it with a template (providing the additional advantage of making it easy for a non-technical client to modify the text without mucking with the layout and styling). In any event I wouldn't maintain two marked up pages with different language text unless there were some overriding reason -- such as two languages being so different that they require different markup -- although, again, I'd still be inclined to keep the text in the database and merge it with two separate templates. If a round-trip to the server is used to switch language, each downloaded page instance can contain just one language. If you want to be able to switch language instantly, you have to download all texts in a single page and toggle between them dynamically. This would obviously get sluggish with long texts or a large number of languages. Although it's fun to be able to switch languages instantly, most multilingual sites don't require such immediate response time. Once a visitor selects their preferred language they tend to stay there. Downloading multiple texts when only one is needed seems needlessly inefficient. It might make a lot of sense in a language training website, for example, when the visitor can switch back and forth rapidly to check their own translation of a text with the one offered. Regards, Paul __ Paul Novitski Juniper Webcraft Ltd. http://juniperwebcraft.com __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d IE7 information -- http://css-discuss.incutio.com/?page=IE7 List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Re: [css-d] Language switching
This is a functionality or content issue and not in the realm of CSS. The main problems is how to organize the site maintenance so that changes will be made in a coordinated manner. However, if you use the same markup and the same style sheet, basically intending to modify the textual content only, then you may need to consider some internationalization issues in CSS. For example, setting widths in pixels is particularly problematic, since the length and formatting requirements of a piece of text may greatly differ from the requirements of its translations. You might find it necessary to divide the style sheet into two parts, a general part and a language-specific part. Apart from the potential CSS formatting issue, is it common practice for multi-language websites to simply keep multiple versions of the same pages and switch according to user's preference (which is not impractical at all given that I only need to deal with two languages)? Thanks, Chris _ Rates near 39yr lows! $430K Loan for $1,399/mo - Paying Too Much? Calculate new payment http://www.lowermybills.com/lre/index.jsp?sourceid=lmb-9632-18226moid=7581 __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d IE7 information -- http://css-discuss.incutio.com/?page=IE7 List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Re: [css-d] Language switching
At 3/4/2007 11:17 PM, Chris Chen wrote: I am help maintain a website that needs to support switching between English and Chinese languages (preferrably just by clicking on a button/link). Does CSS prescribe a recommended way to do such language switching? Thanks, Pai-Hung I would say yes and no. CSS provides a language pseudo-class (:lang) for indicating the language of an expression, for example when mixing two languages together on the same page: CSS 2.1 Specification 5 Selectors 5.11.4 The language pseudo-class: :lang http://www.w3.org/TR/CSS21/selector.html#lang However, the only behavior that CSS really supports for content switching is hover (known in javascript as mouseover). In order to get content to change on click you need either server-side scripting or client-side scripting or both. Here's an example of one technique that I produced using English Japanese text: http://laurietobyedison.com/WOJwords.asp?lang=EN Every bilingual page on the site contains both languages, with only one of them displayed at a time. In the absence of javascript, the Japanese/English toggle requests the current page from the server with the requested language selected (by specifying it in the body class). With javascript enabled, the language toggle simply switches the body class and the displayed language changes immediately. Regards, Paul __ Paul Novitski Juniper Webcraft Ltd. http://juniperwebcraft.com __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d IE7 information -- http://css-discuss.incutio.com/?page=IE7 List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
[css-d] Language switching
Hi, I am help maintain a website that needs to support switching between English and Chinese languages (preferrably just by clicking on a button/link). Does CSS prescribe a recommended way to do such language switching? Thanks, Pai-Hung _ Play Flexicon: the crossword game that feeds your brain. PLAY now for FREE. http://zone.msn.com/en/flexicon/default.htm?icid=flexicon_hmtagline __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d IE7 information -- http://css-discuss.incutio.com/?page=IE7 List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Re: [css-d] Language switching
On Sun, 4 Mar 2007, Chris Chen wrote: I am help maintain a website that needs to support switching between English and Chinese languages (preferrably just by clicking on a button/link). Does CSS prescribe a recommended way to do such language switching? This is a functionality or content issue and not in the realm of CSS. The main problems is how to organize the site maintenance so that changes will be made in a coordinated manner. However, if you use the same markup and the same style sheet, basically intending to modify the textual content only, then you may need to consider some internationalization issues in CSS. For example, setting widths in pixels is particularly problematic, since the length and formatting requirements of a piece of text may greatly differ from the requirements of its translations. You might find it necessary to divide the style sheet into two parts, a general part and a language-specific part. -- Jukka Yucca Korpela, http://www.cs.tut.fi/~jkorpela/ __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d IE7 information -- http://css-discuss.incutio.com/?page=IE7 List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/