Hi all,
I'm looking for other peoples experiences in creating 'interntionalised' web pages - ie multi-lingual.
Personally I can think of a number of different approaches to the problem, each propose advantages / disadvantages compared to the others. Here I wish to start a discussion to help us site developers choose the most appropriate tools and configuration for their site.
So here are the various options.
Inline definition using lang attribute
This seems like a reasonable solution on first investigation, but it quickly falls down as difficult to manage, this is my (likely naive) evaluation.
Easy to add a lang attribute to any element in your page, then turn these element of / off with a little bit of DOM manipulation, and JQuery. For instance....
Code:
<p lang = "en-uk" display = "true">a paragraph in english</p>
<p lang = "fr" display = "false">Quelque chose ecrit en francais</p>
Then using a cookie and a bit of JQuery you convert this too...
Code:
<p lang = "en-uk" display = "false">a paragraph in english</p>
<p lang = "fr" display = "true">Quelque chose ecrit en francais</p>
and hey presto... you get the language displayed that you would desire.
This seems like a reasonable solution, particularly for menu items, that will generally be short text, but once you get to larger sections you start need to do lots of editing.
Add to the problem that the page will load to the browser with all the languages available, not a big issue... but what if you have large sections with a lot of translations.... you will end up loading a very large page!
So my evaluation is that this is a 'naive' solution, although it may be sufficient in the first instance I can see it rapidly getting out of hand and being hard to manage, also you'll end up with a sort of page that is a complete 'tag soup'.
Include external pages into current page
This solution has some of the problems of the above approach, but now we have placed the lang attribute in the main part of the page, or rather within the
Code:
<hteml lang="en-uk">
of the html document.
The code to modify the displayed content would be easier to handle, you could do something like the following....
Code:
<!DOCTYPE html>
<html lang="en-uk">
<head>
<!-- your other head content and links to files js / css files here .... -->
</head>
<body>
<iframe src="./{lang}/page.html">
<!-- insert static non language constrained content here if required -->
</frame>
</body>
</html>
This feels like a better solution that the initial one, you now just place your specific content into a separate html document, you have a single import to perform, and will send a single page. Also you change only the [code]{lang}</code]part of the src attribute inside the iframe tag.
The downside is that this will take a lot of care and attention to maintain consistency of the structure of the related pages.
I can envisage modifying a page in one language and adding a special div, then the translator arrives you and doesn't notice the new tag and class that you created, and hence the consistency between the presentation for each language begins to drift....
On the other hand it is easy to separate your different languages for your site. You ensure that you use relative links for all your non-text media and the links just stay exactly the same.
Also there is the 'don't use frames' they are bad for search engines' argument.
Store content in a DB
This get down to a more grown up solution, but will mean that you site will not work if your server is offline, this makes it less attractive to create pages that are supposed to be viewed offline, forces the use of a more complex server setup, and will add to complication of the scripting that is used - you will likely now need to be using javascript in your pages, and php to collect and serve your data. Ok I know that javascript can communicate with a back end db, but which technology would you use?? Jnode, googleAppScript, WebKit ???
Also there is again the issue of editing the content.
Content Editor
So you could roll your whole site with a CMS such as joomla or drupal.
However I like to have a working local version of my site on my local pc, usefull for peace of mind if the server goes down, or I decide to change your web host, it is easy to just copy all the pages over and to a new server if they are not hooked into a DB and are just flat files.
Also the few Drupal pages that I have used 'wget' to retrieve for friends are a real mess on the local system with various broken links and mutliple embeded Div that make my head hurt.
it's not that I don't appreciate Drupal, it just creates what I feel is an extremely complex structure, for example just for one of the content sections you get the following
Code:
<div class="region region-highlighted">
<div id="block-block-75" class="block block-block">
<div class="block-inner">
<div class="content"
<!-- bunch of content here -->
</div>
</div>
</div>
</div>
<div class="different section name">
<div id="block-block-75" class="block block-block">
<div class="block-inner">
<div class="content"
<!-- bunch of other content here -->
</div>
</div>
</div>
</div>
which too me seems overkill.
Then of course you have the related CSS, with each of at the 3 or 4 pages being 400 odd lines in length. with each one containing different rules for lists and list items etc (or rather the same rules for lists with different classes or ID).
All of which seems far too complex.
OK I'm sure that the creation of the site is vastly more efficient than if I hand code it, but all these files cause the problems in trying to have an effective off-line copy of your site work on.
So my question here is what are other people using to control and manage their multilingual content?
Are there other solutions that I have though about?
Are there any good lightweight html editors (I mostly use geany, but it can't open multiple editing panes) that can be used to open and view / modify multiple files. I would really like a tool that could display my content side by side, or contain a tab for each language that my site has, so I can i mmediately see how many files I need to modify if I add in new content for one specific language - I could easily insert the same content with a [code]visible="false"[code] to keep if from being displayed whilst I get around to translating the required extra content, I would then be able to easily allow visitors to click a button to view the content in their prefered language.
your reflections and thoughts are appreciated in advance.
David
ps. sorry for the long post!
Bookmarks