Open hdodov opened 4 years ago
Just to let you know: I removed Kirby 4 from the title to not give the impression in the ideas repo that Kirby 4 is on the horizon. This is far far in the future.
So far we don't need to discuss this for the reasons @bastianallgeier mentioned (by the time Kirby 4 is on the horizon, our opinions will have changed anyway), but just so that you know why we currently use a file per language:
Of course this doesn't need to stay like this forever, so we'll see once it becomes relevant. Your reasons are definitely valid. :)
This idea builds on top of #523 and is about translation management. It might be more beneficial to store translations in the same file like this:
Yes, you'd have to parse YAML, but with the current setup, you have to parse an entire new file and then merge it on top of the default content. The benefits of this setup are:
site.txt
, notsite.en.txt
,site.de.txt
and so on. This could reduce the complexity of Kirby core?translate: false
in structures, which is currently unsolvable getkirby/kirby#1602How would it work?
By using a prefix in the field key. For example,
title
is a regular field,title:lc
is a localized field. The YAML spec allows for that. So you could have:...and the title would be parsed because it ends with
:lc
, meaning that array values are treated as translations. The toggle would be interpreted as-is because it doesn't end with:lc
due totranslate: false
, for example.With this setup, you could very easily switch the default language too - it would just be a matter of which array key to look up.