Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4238096
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:51:36+00:00 2026-05-21T02:51:36+00:00

I’ve developed a website more than a year ago. The content were/is in two

  • 0

I’ve developed a website more than a year ago. The content were/is in two languages and now I need to build a database driven update/data insertion system for them to inserte some news, events etc.
Is the best approach to create tables like this:

news_id         int(10) unsigned PK
lang_id         int(2)
status          tinyint(1)
title           varchar(255)
title_en        varchar(255)
title_es        varchar(255)
content         text
content_en      text
content_es      text
date_inserted   datetime
date_modified   datetime
type            varchar(45)
atach           text

then create a table for the languages

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T02:51:37+00:00Added an answer on May 21, 2026 at 2:51 am

    You should only care about one language for any one particular request. While you could only select the language that the page request requires, it still isn’t best practice to organise your content in such a way.

    What you should do is use locales and provide defaults for a content. Because while you might think you will always create two versions of a piece of content, in a less than perfect world this doesn’t always happen.

    So, you would first create your model to reflect this relationship. For simplicity I will just refer to this as content. But you could of course have your content to be anything.

    `content` (The Table)
    id
    status
    title
    content
    dataCreated
    dateModified
    owner
    
    `contentTranslations` (The Table)
    id
    contentId (FK)
    locale
    title
    content
    dateCreated
    dateModified
    

    Now, you just need a way to know which locale the user wishes to use. I prefer using Zend_Locale for managing all of my locales, and Zend_Translate for short key=>value translations. (This isn’t suitable for long content translations though).

    When you know which locale you want to use, all you need to do is perform your query to select with a join.

    The Beauty

    The beauty of all of this however, is that if you haven’t created your content for a particular language version, then you can still default and roll onto your base language which the original article/content was written in.

    SELECT c.id, c.status, c.title, c.content
    FROM content as c
    LEFT JOIN contentTranslations as t
    ON c.id = t.contentId
    WHERE c.id = 21231 AND t.locale = X
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my XML file chapters tag has more chapter tag.i need to display chapters
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.