Topic: Multilang forum and categories.
Hi,
I plan to develop an internationalization mod for PunBB.
I already did a dirty hack for phpBB for one of my boards, but I'd like to make something cleaner for punbb.
One of the functions of the mod would be to get forums, descriptions and categories in the user's language.
So I add 2 tables, one for the alternate forum languages, and another one for the description.
In each table, I put an ID in each table (as primary key), the original categorie and forum ID, the translation and the language.
But I'm very noob at using complex queries.
I think it will be possible to get the alternative language using the original (big) query, but all my tries failled.
I could make simpler queries, but I think that the number of queries would not be acceptable.
The original query in index.php:
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
Do you think this is a good approach? Would there be a simpler system to do this cleanly?
How would you do this?
I used the $lang[] system for my phpBB hack, but this is dirty ... even if it is the simplest way to do it.
Thanks.