Forums / Developer / Impossible to create a truly multi-lingual web site

Impossible to create a truly multi-lingual web site

Author Message

Sven Ryen

Sunday 03 August 2003 9:45:37 am

As far as I can tell, creating a multi-lingual site with EZ Publish is impossible - at least if you want all content to adhere to the selected Locale.

I have managed to localize the content of template files, through x18n. The current view of the content module displays the language specified in the URI.

But, the _template functions_ do not seem to take into account neither the currently chosen locale, nor the language specified in the querystring, when content is fetched from the database.

The site I'm working on relies heavily on the {fetch("content","list",...)} function, and so far, attempts of receiving content in any language other than Norwegian have been unsucessful.

I have tried browsing through the attributes returned by content list, by using |attribute(show), and have come across objects that contain lists of available translations and locales. I found no data structure that would allow easy access to the translation corresponding to the selected locale.

I know I could be missing something, so if you have any suggestions on what to do, please respond.

Sven Ryen

Sunday 03 August 2003 2:15:15 pm

To clarify: I wanted to dynamically set the current ContentObjectLocale (not just read it from the site.ini-file).

I was able to work around this by modifying the two files:
/kernel/classes/ezcontentobjecttreenode.php
/kernel/classes/ezcontentobject.php

The following code reads out the session variable that has been previously set through another module, and defaults to the value from the ini file if the session variable is empty:

$lang = false;
$xpohttp =& eZHTTPTool::instance();
//$xpohttp->setSessionVariable( "xpoLocale" ,"nor-NO");
if ( $xpohttp->hasSessionVariable( "xpoLocale" ) ) {
$lang = $xpohttp->sessionVariable( "xpoLocale" );
}
if ($lang === false) {
$ini =& eZINI::instance();
$lang = $ini->variable( 'RegionalSettings', 'ContentObjectLocale' );
}

It's odd that this functionality is not built into EZ Publish by default, as few modifications were needed to make this work.

It took some effort to figure out how to accomplish it though.

Feel free to contact me if you want more info. sven[at]maxus.no

Jan Borsodi

Monday 04 August 2003 1:55:51 am

One way to get multilingual site is to use one siteaccess per language and enable url based siteaccess matching.
For instance an article in english would have the url
/en/content/view/full/42
while the japanese version would have
/jp/content/view/full/42

Here the en and jp of the url is the siteaccess. On each siteaccess you will alter the locale and content object locale to the given language (site.ini).

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Sven Ryen

Tuesday 05 August 2003 1:44:29 am

Thanks, Jan, for offering a possible solution!

I'm afraid siteaccesses would not be sufficient for this project, as the client wants to add translations at any given time, and she is not technically capable of editing the ini-files.

Your cms would have much broader appeal to non-programmers, if more tasks could be accomplished without editing the ini's.

Bård Farstad

Tuesday 05 August 2003 2:04:33 am

Sven, take a look at fast.no. This site has nine different languages. Using the site access method.

-bård

Documentation: http://ez.no/doc

Jan Borsodi

Tuesday 05 August 2003 2:23:26 am

How often would new languages be added? Not very often I would guess.

But to make it easier to add new languages I suggest you make a new module which creates the siteaccess with the necessary .ini files.
It shouldn't be too much php code write either.

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Selmah Maxim

Tuesday 05 August 2003 3:13:04 am

Hi Sven ...

You said :
"I'm afraid siteaccesses would not be sufficient for this project, as the client wants to add translations at any given time, and she is not technically capable of editing the ini-files.

Your cms would have much broader appeal to non-programmers, if more tasks could be accomplished without editing the ini's. "

I think this much better for you to gain more money :)

To make new module to creat site ini files and accesse in the best, I don`t think you will find any program can do this for you, actually maybe there is one with C# named 'vignette' the site : http://vignette.com/
some thing like this, but check the price and also read this at sitepoint.com :
http://www.sitepointforums.com/showthread.php?threadid=102813
(you must read this all .. its LOL :) )

The Ezp is you best choice !

cfa cfa

Thursday 14 August 2003 12:55:34 am

any idea of what DATABASE character set fast.no is using? the have one asian language (japanese), so i wonder if they are working with utf-8.

the search function works OK in japanese.