I wonder if this would be doable ? To insert an array into one field in the database.
For instance I have a title, I want to have that title with only one id, but it’s going to be bilingually used on the website.
It feels a bit unnecessary to make another table to have their global ids and then another table with the actual titles linked to the table with the global id.
I just want to have something like this
ID TITLE 1 Array("english title", "nederlandse titel");
I’m using PHP/MSYQL, so if it would be doable could you please explain in these languages.
Oh yeah I figured that I could format it funky and use the split function to turn it into an array again. But I wonder if I could just store it as an array right away, I case the user might type something with the same formatting (one out of a million)
Arrays do violate normalization; in my experience with internationalization databases I’ve found that having a the phrases normalized is the best design,
I allows you to easily make wholesale copies of rows – for instance ‘es’ to ‘es-mx’ or ‘en’ to ‘en-US’, ‘en-GB’, and my favorite: ‘xx-piglatin’. In an array schema, you would either have to re-write every record or add complex parsing or use something more complex than arrays, like XML.
It is relatively easy to use LEFT JOINs for find untranslated phrases for work and also to use COALESCE to return a default so the program remains usable even if the phrase is not translated.
You must be logged in to reply to this topic.