SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2007
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    News database with multiple languages

    Okay, basically I am creating a database.

    It will have multiple posts, but each post will be translated in to a different language. Originally I had

    id
    language_id
    headline
    etc

    but that wouldn't be efficient because if you change the language on the site you wouldn't be able to correctly search by the id because i have it set to auto increment.

    Also ... this isn't the only part on the site with multiple languages. So if I did do something like create a table for each language, I would do it for each part of the site.

    What would be the most efficient way to go about doing this ?

    Should I have a table for each language ? Or ?

  2. #2
    SitePoint Evangelist
    Join Date
    Mar 2006
    Location
    Sweden
    Posts
    451
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you explain a bit more about what you are trying to do? Will your database contain info for multiple sites, or just one site?

    I can't really see why the approach with storing language_id would be inefficient? One table for each language would be more inefficient, since you would need to alter all tables if you wanted to change the table structure for news, instead of just having to alter one.

  3. #3
    An average geek earl-grey's Avatar
    Join Date
    Mar 2005
    Location
    Ukraine
    Posts
    1,403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can make a general posts table containing data, such as: post time and author. And for actual texts in different langages, create post_translations table, containing post_id, language_id, title and subject. That way, post's translations are associated and you can perform operations on them all at once, eg.: delete all translations of a post.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •