Multilingual features Multilingual features
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Multilingual features

Started by lu-x, January 17, 2005, 10:21:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lu-x

I would like to have my database not only in German but also in English.
Do I have to have 2 databases? Is there a simple way to connect to a different database, depending on language?
Or would it be simpler to connect a special language file somewhere.

I'm stuck.

Does anybody know?

kegobeer

Are you talking about having German and English titles, descriptions, comments, etc for your pictures?  The items that are stored in your MySQL database?
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

lu-x

Yes exactly. I am talking about not only about the whole navigational framework - as it is now - but for a whole different database connect, depending on the language request [index.php?lang=en or de].

Is that easier than attaching a kind of customized php.language file, that contains and translates only the set of the used words of the database into the other language?

I have no idea.

kegobeer

#3
For comments this would be pretty easy, since it's a separate table.

Create a new table called [yourCPGprefix]_commentsgerman.  The easiest way would be to copy the table and rename it, or you can look in sql/schema.sql and find CPG_comments.  Rename the table to [yourCPGprefix]_commentsgerman, copy that section and execute it with phpMyAdmin.
CREATE TABLE [yourCPGprefix]_commentsgerman (
  pid mediumint(10) NOT NULL default '0',
  msg_id mediumint(10) NOT NULL auto_increment,
  msg_author varchar(25) NOT NULL default '',
  msg_body text NOT NULL,
  msg_date datetime NOT NULL default '0000-00-00 00:00:00',
  msg_raw_ip tinytext,
  msg_hdr_ip tinytext,
  author_md5_id varchar(32) NOT NULL default '',
  author_id int(11) NOT NULL default '0',
  PRIMARY KEY  (msg_id),
  KEY com_pic_id (pid)
) TYPE=MyISAM;


In init.inc.php, before
if (!file_exists("lang/{$CONFIG['lang']}.php")) $CONFIG['lang'] = 'english';
add
if ($CONFIG['lang'] == 'german' ) {
    $CONFIG['TABLE_COMMENTS'] .= "german";
}


That should display German comments only to German users, and everyone else gets the English comments.

Titles and captions would be harder, since they are in the pictures table.  It would be easier to have both German and English in the title and caption instead of trying to change the table structure and make changes to the code.

Web translators don't seem to work too well, so I wouldn't try to adapt one to your site.  If you choose that option, you'll have to figure out how to do it - I wouldn't know where to start.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

lu-x

Thank you very much for your efforts - this may be a  start. I do not like the solution with 2 languages in one database [English and German titles and captions] - it may be the easiest way to set up coppermine at two different urls each with a different DB in the background and then connect them with links...

The comments are not so important for me.

see the problem at: http://www.lu-x.de/base/

P.S. If I can be of any help in questions of design - let me know.
Ludwig

kegobeer

Why don't you want everything in one database?  Duplicating an entire install just to have a different language is unnecessary.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

lu-x

This may be feasible just for English and German but if I want to go on and add Spanish an Chinese later on...?
I would need special fields for every language right - e.g. with a prefix 'en_' or 'de_'....and then wouldn't it be easier upon loading the index.php to find out which language the user has and then just connect to a different database?

? ???

kegobeer

Multiple databases are totally unnecessary.  I have a bunch of different apps using the same database; there isn't any need to create a separate database for each one.  Each app uses a different table prefix (smf_, cpg_, etc) so you can easily tell which table belongs to which app.

Choosing a language specific title/caption would require changing the structure of the pictures table, and changing each query that gathers picture information.  You would have to remove the title/caption from the picture table and put it in a separate table.  That table would have this type of structure: the picture id, the picture title, the picture caption, the language used.  Each picture could be listed numerous times, and Coppermine would choose the entry based on the language field.

To edit all the data for each picture, you could use phpMyAdmin or alter the picture editing functions to pull and display all titles/captions and comments for all languages.

Coppermine wasn't designed to do what want it to do.  The changes required are extensive and would mean any future upgrades wouldn't work without applying all the changes to the new version before you upgrade.

If you want to have a database for each language, you'll have to create a database each time you want to add a language, edit each database every time you upload/edit/delete a picture, and then hard code a switch in config.inc.php to use the correct database name/user/password/table prefix for each language.

In case you misunderstood, I was not offering my services to code this for you.  I don't have the time to do it.  I'm just giving you ideas on how to go about adapting Coppermine to meet your requirements.  If you need someone to underake this task, you should post in the freelancers/paid help board.

From a developer's standpoint, this is something the majority of Coppermine users would never need, so I don't think you'll see this ever becoming core code.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

lu-x

Thank you very much for your answer.

See - I am a designer and photographer not a programmer. In any case I will need some professional help to accomplish having multiple languages in the gallery.

Cyclist

Quote from: kegobeer on January 19, 2005, 05:46:29 PM
From a developer's standpoint, this is something the majority of Coppermine users would never need, so I don't think you'll see this ever becoming core code.

Are you sure about that? It's nothing for the majority of the english speaking users or users who have an onelingual website but for everybody with multilingual website ist's really importan. As far as I know only Exhibition Engine is able to do that and it's a pity that Coppermine can't!