For the most part this is going to depend on how often this will be used and how often multiple languages will be needed for the same allergen. Unless this is going to be the cornerstone of your application (IE a transaction table or some kind of lookup table which 90%+ of your transactions will use) I would not overthink it. I have heard it said before:
...premature optimization is the root of all evil...
Wikipedia - Premature Optimization
With that said, in my personal opinion I would separate your names and your actual allergens. Since they are two different data elements. Likely you will want to be able to build code and query the data by allergen, not by it's name.
EX: You will want to write code/reports around people who are allergic to latex (in English), and reference that with a common name/ID/Code. You most likely will not want to reference it on the backend by all of it's various names (which will grow as the number of languages/countries this application uses grows).
If it was me implementing the solution, I would have two separate tables Allergen
and AllergenTranslation
. I would do something like what you have above. I would recommend that you have some kind of common name or code that is either always the same language or is language ambiguous. That way as you move these records from environment to environment, you don't have to ensure that the numeric id Allergen.Id
is the same across the environments and you don't have to keep a list of what each ID means. Something like:
CREATE TABLE [Allergen] (
[Id] int PRIMARY KEY IDENTITY(1, 1),
[CommonName\Code] nvarchar(255) NOT NULL UNIQUE
)
CREATE TABLE [AllergenTranslation] (
[Id] int PRIMARY KEY IDENTITY(1, 1)
[AllergenId] int,
[LanguageId] int,
[Name] nvarchar(255),
)
You could always fulfill the need of that CommonName\Code
column if you always have at least one record in [AllergenTranslation]. I personally would not want to have that be a requirement (but I also work in an environment that basally exclusively works in English).
Let me know if there is anymore help that can be provided or if any part of this does not make sense.