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

  • SEARCH
  • Home
  • 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 51303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:43:45+00:00 2026-05-10T16:43:45+00:00

i am looking for opinions if the following problem maybe has a better/different/common solution:

  • 0

i am looking for opinions if the following problem maybe has a better/different/common solution:


I have a database for products which contains the names of the products in english (the default language of this application) and i need translations of the names if available.

Currently i have this setup:

A product table

CREATE TABLE products (   id serial NOT NULL,   'name' character varying(255) NOT NULL,   CONSTRAINT products_pkey PRIMARY KEY (id) ) 

and a product localization table

CREATE TABLE products_l10n (   product_id serial NOT NULL,   'language' character(2) NOT NULL,   'name' character varying(255) NOT NULL,   CONSTRAINT products_l10n_pkey PRIMARY KEY (product_id, language),   CONSTRAINT products_l10n_product_id_fkey FOREIGN KEY (product_id)       REFERENCES products (id) MATCH SIMPLE       ON UPDATE CASCADE ON DELETE CASCADE ) 

and i use the following query to retrieve a list of localized products (german in this case) with fallback to the default english names:

SELECT p.id, COALESCE(pl.name, p.name)  from products p LEFT  JOIN products_l10n pl ON p.id = pl.product_id AND language = 'de'; 

The SQL code is in postgres dialect. Data is stored as UTF-8.

  • 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. 2026-05-10T16:43:46+00:00Added an answer on May 10, 2026 at 4:43 pm

    Looks good to me. The one thing I might change is the way you handle languages: that should probably be a separate table. Thus, you would have:

    CREATE TABLE products_l10n (   product_id serial NOT NULL,   language_id int NOT NULL,   'name' character varying(255) NOT NULL,   CONSTRAINT products_l10n_pkey PRIMARY KEY (product_id, language),   CONSTRAINT products_l10n_product_id_fkey FOREIGN KEY (product_id)       REFERENCES products (id) MATCH SIMPLE       ON UPDATE CASCADE ON DELETE CASCADE   CONSTRAINT products_l10n_language_id_fkey FOREIGN KEY (language_id)       REFERENCES languages (id) MATCH SIMPLE       ON UPDATE CASCADE ON DELETE CASCADE )  CREATE TABLE languages )   id serial not null   'language' character(2) NOT NULL ) 

    Besides that, I think you’ve got just about the best possible solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for some opinions here, I'm building a web application which has the
Just looking for opinions on the following 2 scenarios. We have a table where
I'm looking for some feedback on the following: I currently have two classes, which
I'd like to hear your opinions and maybe better suggestions for the following scenario:
Looking for opinions on if OpenCV could be or has been used to detect
I'm looking for opinions on the following localization technique: We start with 2 tables:
I'm looking for opinions and/or suggestions on this question. On our website we have
Looking for opinions on this: I have broken out various responsibilities into separate objects.
I am looking for opinions of how to handle large binary files on which
I'm looking for a best practice approach to the following problem. I'd like peoples

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.