Translations in blueprints of a plugin

Is it possible to use a separate language file in a plugin (like de.php, en.php, etc) and use its values in a blueprint of a plugin, instead of the known yaml syntax:

label:
  de: 
  en:
  etc ... 

Background: I have a plugin with a lot of blueprints and maybe I want to add another language at a later time. It would by much easier to create a new language file and translate all values instead of touching all blueprints again once the work on the blueprints is finished.

I don’t think so but that’s something that could probably be solved through the query language. Sounds like an idea for Nolt.

ok, thank you for your answer :slight_smile:

I just created an entry on Nolt.
See: Translations in blueprints of a plugin · Kirby Feedback

For the community to share, there is already a solution for this:

label: your.plugin.fieldName
Kirby::plugin('your/plugin', [
    'translations' => [
        'en' => [
            'your.plugin.fieldName' => 'Hello World!',
        ],
        'de' => [
            'your.plugin.fieldName' => 'Hallo!',
        ]
    ]
]);

or even

'translations' => array(
	'en'    => require_once __DIR__ . '/en.php',
	'de'    => require_once __DIR__ . '/de.php',
),
2 Likes