Global Configuration
You can configure the Content Translator Panel view button or set global defaults for Content Translator sections in your config.php
file.
Available Options
You can configure all section-level options globally to apply to the Panel view button and all sections. For individual sections, these options can be overridden in their respective blueprints.
See the section configuration page for detailed descriptions of each option:
label
– Custom label for the sectionimportFrom
– Control import directionimport
– Enable/disable import functionalitybatch
– Enable/disable batch translationtitle
– Include title in translationslug
– Include slug in translationconfirm
– Show confirmation dialogsfieldTypes
– Which field types to translateincludeFields
– Specific fields to includeexcludeFields
– Specific fields to excludekirbyTags
– KirbyTags translation configuration
Panel View Button
The same options as for the section can be used to configure the Content Translator Panel view button. The only difference is that the options have to be set in the config.php
file.
As a quick reminder, here is how to enable the Content Translator view button in your blueprints:
- In Kirby 5, you can enable the Content Translator view buttons per blueprint. The following example shows how to reference the default buttons and add the
content-translator
dropdown button to thesite
,pages
, andfiles
views:buttons: - preview - content-translator # Re-order the button as needed - languages
buttons: - preview - settings - content-translator # Re-order the button as needed - languages - status
buttons: - preview - settings - content-translator # Re-order the button as needed - languages
- In Kirby 4, Panel view buttons are not supported. But the feature has been backported 🎉. The
content-translator
button is always placed after the language dropdown and cannot be moved. If you want to disable the button, set theviewButton
option tofalse
:config.phpreturn [ 'johannschopplich.content-translator' => [ 'viewButton' => false ] ]
Global Section Defaults
Rather than defining the configuration in each blueprint, you can define global defaults in your config file. This is useful when every page's content should be translated by the same fields, for example. Set the global defaults in your config.php
file:
return [
'johannschopplich.content-translator' => [
'fieldTypes' => [
'blocks',
'text',
'textarea'
],
'kirbyTags' => [
'link' => ['text', 'title'],
'image' => ['alt', 'caption'],
'file' => ['text', 'title']
],
'title' => true,
'slug' => true,
'confirm' => false
]
]
Customizing Plugin Labels
If you prefer to overwrite the default translations of the plugin, you can do so by adding translations for your language in the languages
directory of your Kirby installation.
translations.php
for the full list of translation keys.For example, to change the translation of the import button to Synchronize
in English, append the following translations
array to the languages/en.php
file:
return [
'code' => 'en',
'name' => 'English',
// ... Other language configuration
'translations' => [
'johannschopplich.content-translator.import' => 'Synchronize'
]
];