Page 1 of 1

any ideas for developing multilingual websites

Posted: Fri Feb 15, 2008 8:30 am
by seco
Hi
im asking about good ideas of developing multilingual websites
i can save articles in db and there is a column called lang which has language value and load data based on a url parameter
this is my small idea
any other good ideas ?

the second question what is i have already a one language website and i want to develop it to accept more languages?

thanks in advance.

Re: any ideas for developing multilingual websites

Posted: Fri Feb 15, 2008 11:57 am
by anjanesh
You can create a separate table for your language text.

Code: Select all

CREATE TABLE IF NOT EXISTS `language strings` (
  `StringID` bigint(20) NOT NULL auto_increment,
  `English` varchar(255) NOT NULL default '',
  `French` text NOT NULL,
  `Spanish` text NOT NULL,
  `German` text NOT NULL,
  PRIMARY KEY  (`StringID`),
  UNIQUE KEY `English` (`English`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1';
For each block of english text, you can enter its other-language equivalent.
Only problem is, you got to enter the equivalent for all such block, which can be huge if you have a large database of translations. For non-english characters, store their html-entity codes.

Re: any ideas for developing multilingual websites

Posted: Fri Feb 15, 2008 2:57 pm
by seco
do you mean that html entities are less in size that the actual representation that the actual characters of non English text?

Re: any ideas for developing multilingual websites

Posted: Fri Feb 15, 2008 7:18 pm
by Christopher
I often just create subdirectories for templates for each language like:

Code: Select all

templates/
template/EN/
template/ES/
template/FR/
Then when they pick the language you insert the language code into the path when loading.

Re: any ideas for developing multilingual websites

Posted: Fri Feb 15, 2008 10:01 pm
by anjanesh
seco wrote:do you mean that html entities are less in size that the actual representation that the actual characters of non English text?
It should be the same in size I guess.
If you can store non-english characters directly, then your mysql-interface supports unicode. Internally, its still stored as html-entity-code.

Re: any ideas for developing multilingual websites

Posted: Sat Feb 16, 2008 3:23 am
by seco
thanks for reply
arborint says a solution that create templates for each language and then choose the appropriate one
but my content is all dynamic i mean i load the data from db does your way for dynamic contents
would you mind clarify your way

thanks in advance.

Re: any ideas for developing multilingual websites

Posted: Sat Feb 16, 2008 3:49 am
by anjanesh
arborint says a solution that create templates for each language and then choose the appropriate one
Its mostly done that way as loading time is minimized.

But if you have article content in a database and want to display a translated version of the article, then one way is to store the translations into the database too.

For smaller strings, you can store its translation into the database too, but your loading time would be much higher as you would end up making many queries to extract the translation text. Using cached results from the db-table is a good idea.