could someone help a newbie with the following question?
It is a very general one.
Let's suppose I create an entity called 'Car'. There is
a car_id as PK and a serie of attributes like wheel_number,
car_colour and so on.
Using an application I'd like to show the name of the attribute
in different languages, like:
Car: Toyota Corolla
Wheel number: 4
In Spanish it would the be:
Auto: Toyota Corolla
Numero de ruedas: 4
What I want to have in different languages is the name of the attribute
(i.e. Car, Wheel Number, Colour)
Am I wrong supposing that this information should be kept in a DB?
I am sure someone had this issue before: is there a standard way
of solving this?
Changing the program's text (for labels, buttons, etc) is pretty straightforward. That is basic internationalization or localization of the code, and you are correct in assuming that the database is a good place to store that data.
Changing the data is a very different story. I don't know of anyone that has successfully cracked that particular nut. The problem is that you get into "free range translation" trying to convert arbitrary (often very colloquial) text from one language to another. There have been quite a few folks that have tried this, but I don't know of anyone with more than very limited success at it.
Admitttedly, changing the data is next to impossible using current technology.
Nevertheless, in certain special cases it may be possible to do so; in particular, in the case where data is constrained to be a reasonably small set of finite values.
In the example you gave, if the colour of the car can only be picked from a drop-down list, then it is reasonable to assume that the list of all available colours is actually stored in the database. If that is true, then it would be a simple matter to store an "english_value", "french-value", "spanish-value", etc., for the colours. Then, knowing the users preference, the data may be displayed appropriately, either "red" or "rojo" as the case may be.
It is not difficult to design this. There are several alternatives, some more flexible than others.
But this technique will work only for those cases where the values are limited to a known domain, no free-form text is permitted.