kirby
kirby copied to clipboard
New `language:variables` root
This PR …
This was a more complex problem than I expected (always 🙈). Because the system should be able to read, update and delete language variables both from the language file and from a custom root. It involves a breakage change, but I wanted to remove the code complexity by creating a separate LanguageVariables object.
Fixes
- External language variables setup no longer works since K4's language views #6176
Features
- New
language:variablesroot
$kirby = new Kirby([
'roots' => [
'language:variables' => __DIR__ . '/site/variables'
]
]);
Breaking changes
Language::translations()deprecated, useLanguage::variables()instead$language->translations()returnsLanguageVariablesobject insteadarray. Use$language->translations()->toArray()or$language->variables()->toArray().
Ready?
- [ ] Unit tests for fixed bug/feature
- [ ] In-code documentation (wherever needed)
- [ ] Tests and checks all pass
For review team
- [ ] Add changes to release notes draft in Notion
- [ ] Add to website docs release checklist (if needed)
Excited for this, thanks! Will this include the possibility to add translations (e.g. for the panel) even if the language does not have a content language assigned to it? Some of my pages are German only, but should still have English translations for the panel.
@tobimori In your case; multilingual is not enabled for the frontend, but you want to add translations (for example for blueprint labels) for users in different languages using the panel. Do I understand correctly?
@tobimori In your case; multilingual is not enabled for the frontend, but you want to add translations (for example for blueprint labels) for users in different languages using the panel. Do I understand correctly?
Multilingual is enabled, but the languages in the panel might differ from the languages in the frontend.
Let's say I have de and en in the frontend, but I want to add a french translation for my field labels etc. as well.
Currently, I have a translations directory and load yaml files from a plugin. (https://github.com/tobimori/kirby-baukasten/blob/main/site/plugins/project-extended/index.php#L20)
If there is no FR language (so fr.php language file), unfortunately it will not load custom FR translations. It will only load the translation files for existing languages from a custom root.
😦