Getting Started
Step 1: Install the Plugin
Although it is a commercial plugin, you can download and test the plugin in your local environment before purchasing it.
Composer
The recommended way to install the plugin is via Composer. To install the plugin, run the following command in your terminal:
composer require johannschopplich/kirby-content-translator
Download
Head over to the releases page and download the latest version of the plugin as a ZIP file. Extract the contents of this ZIP file to your site/plugins
folder. It should look like this:
site/plugins/
├─ kirby-content-translator/
│ └─ … All plugin files
Step 2: Configure DeepL
By default, this plugin uses the DeepL API to translate your content. However, you can also use any other translation service by defining a custom translator function.
In order to use the DeepL API, you have to create an account and generate an API key. The free account is sufficient for most use cases (500,000 characters per month).
Store the API key in your config.php
file:
return [
'johannschopplich.content-translator' => [
'DeepL' => [
// API key for the DeepL free or pro plan
'apiKey' => '<deepl-api-key>'
]
]
];
Step 3: Blueprint Setup
View Button v3.0+
Kirby 5 introduces new extensions that allow you to add custom view buttons to most Panel views (e.g. page, site, or file). The Content Translator plugin provides a dropdown button that can be added alongside the default buttons, such as the languages dropdown button.
To add the content-translator
dropdown button to a particular view, set the buttons
option in the corresponding blueprint. The following example shows how to reference the default buttons and add the content-translator
button to the site
, pages
, and files
views:
buttons:
- preview
- content-translator # Re-order the button as needed
- languages
This way, you can reference the default buttons and decide where to place the content-translator
button.
content-translator
button has been backported 🎉. It is always placed after the language dropdown and cannot be moved. Follow the configuration guide for more information or how to disable it.Section
The Content Translator section gives you fine-grained control over which blueprints should have content translation buttons. This allows you to decide which content is translatable and which is not.
Add the following basic section configuration to a blueprint file:
sections:
contentTranslator:
type: content-translator
This is how the section will look in the default language:
When switching to secondary languages, the section buttons will change to Import and Translate:
Note that during the testing process, a license notice will be displayed below the translation buttons. You can remove this notice by purchasing a license.
Step 4: Translate Your Content
Open the Panel and navigate to the page to be translated. Select one of the secondary languages from the Kirby's language drop-down list. The Content Translator Panel view button and section both feature the same buttons: Import and Translate.
- Click the Import button to copy the content from the default language to the currently active language.
- Click the Translate button to translate the content of the freshly imported content (which is still in the default language) to the currently selected secondary language.
Step 5: Buy a License
You can test the plugin locally. However, you need to purchase a license to use the plugin in production environments.
Visit the product page on Lemon Squeezy and purchase a license. Then, open any Panel page that contains the Content Translator section. Click the Activate link to open the activation form:
Enter the email you used for the purchase and the order number and hit the submit button. Done! Thanks for supporting our work. Once you activate your license, the license activation buttons will disappear.
/site/config/.kirby-tools-licenses
file. Make sure to add this file to your .gitignore
file to keep your license key private.