@tristantbg Did you actually work it out? I wonder if it really makes sense to use different fields for different languages or whether or not it would make more sense to add a language code column in the database and have one entry per language. Otherwise we would end up with a lot of duplicate fields (not in this example with few fields but likely IRL). Also, with such a setup it is easily possible to add additional languages without having to change the structure of the tables.
IMO, that would make it easier to update fields in different languages without accidentally updating the wrong field.
What do others think would be the best approach for multi-language content? @distantnative? @bastianallgeier? @lukasbestle? Anyone ever done this before in a real project?
Having said that, it probably depends on the database structure you start with (if you don’t set it up for the purpose).
For comments the suggestion to use a separate language code column and only one column for the text is probably the way to go. Multiple columns for each language only make sense if you are planning to translate the comments between the languages – not very common for comments (for other types of content it may make sense though).
So it all depends on the use-case and also, as @texnixe said, on existing DB structures etc.
Actually I just need to get some data from a database and then I merge the data with what I have in Kirby’s content.
For example the title of the page is coming from the SQL DB but the images of the page are inside Kirby.
What would be the best approach to merge the data ? Here is how I did it in my Shopify plugin :
Thank you for the inventory tip, but now that I have a lot of page items the panel is now very slow… I guess it is a bit like the index() method, the more you have the slower you get.
I switched back to my hack of getting the specific txt text file directly and it goes fast again but it is not very clean… maybe you’ll have a better idea ?