| Lurk all you'd like, but why not register and post some pics? Registering also makes it easier to find the good stuff. Need help? |
|
|||||||
| Register | FAQ | Shooters | Calendar | Reviews | Tutorials | Gallery | Books | Search | Today's Posts | Mark Forums Read |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
with a SmugMug Her0es touch
|
Tutorial - creating a bilingual site
Had some fellow dgrinners over here helping me in creating my dual language site. Now I did create a little tutorial out of it, because I already got 2 mails asking for some help in getting this done (Michael and James
).It all got a bit technical, so if you've got any problems or questions, feel free to ask! If someone got solutions for the problems I listed at the end, I would be very glad! Here we go: Copy this into your Javascript section: Code:
The following part launches the whole script and now goes into the head-tag (if you have the following lines still in your header-section please remove them from their) New: added <noscript>-tag that sets a standard language for visitors without javascript-support. Just replace my sample link with the full address to the language-css-file of your choice (in my case I set the default to English with eng.css). Code:
Now comes the language switcher in the footer. On click this creates a cookie with the selected language: Code:
Now come the little css-files which need to be hosted externally: eng.css: Code:
ger.css: Code:
The external hosted css-files should be pretty self-explanatory. In the eng.css the '.ger'-class is hidden and in the ger.css the '.eng'-class is hidden. After you've done all this you should be able to add bi-lingual captions, gallery descriptions and a bio. This is done according to a scheme where both languages are surrounded by a span-tag and only one of the tags is displayed according to the user's language choice. It goes like this: <html>Text that is displayed independent from any language choice<span class="ger"> Deutscher Text - German text</span><span class="eng"> English text - notice the space after the beginning span-tag: It's to separate the language specific text from the language independent text.</span></html> Problems: - doesn't work in previewed descriptions on homepage and category navigation, because html is filtered there - also doesn't work in traditional view, smugmaps and full screen slideshow, because html is filtered out of the caption. This displays both languages. - alt-tag (when image can't be displayed) always contains both languages (html is filtered) - both languages are shown when external server isn't availiable Hope this is useful for some of you. It might be even possible to simply add some more languages. In thinking about it I didn't see any problems, but there might occur some in the actual realization. If someone's interested, we could work this out together. Sebastian EDIT: Updated the script according to the new customization options of smugmug from 11/27 (see big, bold text in my post). No more need for CSS-hacks - it's now according to the standards. EDIT2: Include support for browser's having javascript disabled - instead of seeing both languages they get one default language set by you!
__________________
look on the bright side http://www.SebastianHosche.com (smugmug name: rainforest1155) Last edited by rainforest1155 : May-20-2006 at 04:08 AM. Reason: Added support for browser's without javascript! |
|
|
|
|
|
#2 |
|
I � Unicode
|
Does this work anymore considering that you cannot hack the CSS box to insert stuff into the header? If so, how do you get around it?
__________________
Y'all don't want to hear me, you just want to dance. http://photos.mikelanestudios.com/ |
|
|
|
|
|
#3 | |
|
with a SmugMug Her0es touch
|
Quote:
Sebastian
__________________
look on the bright side http://www.SebastianHosche.com (smugmug name: rainforest1155) |
|
|
|
|
|
|
#4 | |
|
Happy Snapper
|
Quote:
The 'illegal' parts are adding <link> elements (acting as links to external CSSs), through javascript, after the <body> link as been opened. But, i guess, as long as one does this before any other (visual) element within the <body> tag has been started/opened, it is fine.
__________________
I can't grasp the notion of time. When I hear the earth will melt into the sun, in two billion years, all I can think is: "Will that be on a Monday?" ========================== http://www.streetsofboston.com http://blog.antonspaans.com |
|
|
|
|
|
|
#5 | |
|
Happy Snapper
|
Quote:
The 'illegal' placement is handled awkwardly by Netscape 7 (i don't know about version 8) and especially Opera 8 (and up?). This is what happens: First the page is loaded only using the style-sheets specified inside the <HEAD> tag! You'll see this first (default smugmug style). Then a fraction of a second later, the CSS is loaded from the 'illegal' spot and the new CSS selectors will be applied and the page looks OK. But this 'flashing' effect is bothersome!
__________________
I can't grasp the notion of time. When I hear the earth will melt into the sun, in two billion years, all I can think is: "Will that be on a Monday?" ========================== http://www.streetsofboston.com http://blog.antonspaans.com |
|
|
|
|
|
|
#6 | |
|
Happy Snapper
|
Quote:
Even IE and FireFox seem to have some issues with it: The page goes white for a fraction of a second before redrawing the page as it should be.
__________________
I can't grasp the notion of time. When I hear the earth will melt into the sun, in two billion years, all I can think is: "Will that be on a Monday?" ========================== http://www.streetsofboston.com http://blog.antonspaans.com |
|
|
|
|
|
|
#7 | |
|
with a SmugMug Her0es touch
|
Quote:
I also checked your site...it's fine. I'm on Win2000 - maybe that's a factor. I remember setting my Opera to that it should reveal itself as Opera and not as IE which was set after installing it. Thanks for taking the time to check this! Sebastian
__________________
look on the bright side http://www.SebastianHosche.com (smugmug name: rainforest1155) |
|
|
|
|
|
|
#8 | |
|
Happy Snapper
|
Quote:
I removed my external CSS and JavaScript files and put them into the co-branding fields in smugmug. Only the 'includeBrowserCSS()' genernates links to external CSS files. This fixed most, if not all, 'flashing' on IE. It fixed all 'flashing' on FireFox and minized it on most other browsers (but still visible). I think the biggest problem is this: When the browser encounters an open <BODY> tag, it draws a background. If no CSS yet loaded, the background is white. If a CSS is loaded, the style of the BODY is applied (including any background images). If the CSS is loaded before the BODY tag --> No 'flashing'. If the CSS is loaded after opening the BODY tag --> 'Flashing'. Also, loading a javascript file after the open <BODY> tag takes a little extra time --> The 'flash' last longer before the BODY (and the rest) draws itself correctly. By adding my main CSS and main JavaScript to the co-branding fields instead, the CSS and JavaScripts are loaded in the HEAD, before the BODY --> no more flashing.
__________________
I can't grasp the notion of time. When I hear the earth will melt into the sun, in two billion years, all I can think is: "Will that be on a Monday?" ========================== http://www.streetsofboston.com http://blog.antonspaans.com |
|
|
|
|
|
|
#9 | |
|
with a SmugMug Her0es touch
|
Quote:
Sebastian
__________________
look on the bright side http://www.SebastianHosche.com (smugmug name: rainforest1155) |
|
|
|
|
|
|
#10 |
|
with a SmugMug Her0es touch
|
Smugmug update 11/27
Updated the script according to the new customization options of smugmug from 11/27 (see big, bold text in my first post). No more need for CSS-hacks - it's now according to the standards.
Have fun, Sebastian
__________________
look on the bright side http://www.SebastianHosche.com (smugmug name: rainforest1155) |
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|