Additional possibility to store translations of a blueprint within a plugin in an extra file, e.g. en.php
, de.php
, etc. instead of the known yaml syntax:
label:
en:
de:
etc ...
It would by much easier to create a new language file if you want to add another language at a later time and just translate all the values instead of touching all blueprints again, once the work on the blueprints is finished.
If I understand correctly, it is already possible to do this.
label: your.plugin.fieldName
Kirby::plugin('your/plugin', [
'translations' => [
'en' => [
'your.plugin.fieldName' => 'Hello World!',
],
'de' => [
'your.plugin.fieldName' => 'Hallo!',
]
]
]);
Thank you, that worked. I was referring to a suggestion from Sonja https://forum.getkirby.com/t/translations-in-blueprints-of-a-plugin/21034
, but this helps perfectly.
I can use it that way and havE exactly what I need.
'translations' => array(
'en' => require_once __DIR__ . '/en.php',
'de' => require_once __DIR__ . '/de.php',
),