Daandelange / k3-translations

Translations menu replacement, field and section for Kirby 3.
29 stars 0 forks source link
kirby3 kirby3-plugin

Kirby Translations

Beta: This plugin started as a port of k2-translations to Kirby 3. Please note that the much loved "saved" state of a field is not yet implemented. For now, the plugin provides revert and delete functions for translations, and replaces the native Kirby languages menu by a more advanced one, indicating the translation status of each language.

License Kirby

This plugin enhances the translation handling of content pages for Kirby 3. By default, it replaces the original language switch by an enhanced one; but you can also use it as a section (and in the future as a field to indicate the translation status).

Kirby 3 Translations plugin screenshot

Requirements

This plugin works with Fiber, so you probably need Kirby 3.6.

Although, there are is a chance that it works on versions below. (if so, please report back!)

Installation

Download

Download this repository, extract it and drop it into the plugins folder of your Kirby installation.

site/plugins/k3-translations

Composer

If you are using Composer, you can install the plugin with

composer require daandelange/k3-translations:~0.x.x-beta

Note: While k3-translations is still alpha, there is no stable channel for composer, so you need to specify the unstable version.

Git submodule

git submodule add https://github.com/daandelange/k3-translations.git site/plugins/translations

Setup

Replacing Kirby's native language menu

Within your website project, you can customise the language switching menu in the header by setting the following options:

// Site /site/config/config.php
return [
  'daandelange.translations' => [
    'header' => [
      'replaceKirbyLanguages' => false, // To disable replacing the native lang menu. Default = true.
      'compactMode' => true, // To enable a more compact mode. Default = false. (alpha! only affects fields/sections)
      'deletable' => false, // To disallow deleting a language. Default = true.
      'revertable' => false, // To disallow reverting a language. Default = true.
      'showEditLanguage' => false, // To hide the menu link to the panel language. Default = true.
    ],
  ],
];

Translations Section

Add the following section to your blueprint(s). (optional)

sections:
  translations:
    type: translations

Advanced usage

Options

The following options are available for any translations section or field:

Development

This plugin follows the standard Kirby PluginKit structure, see their plugin guide for more details on using it. These steps are optional, for building development versions.

If you're using a modified Kirby folder structure, you probably have to fix the relative path to the kirby folder in kirbyup.config.ts (in the alias section).

License

MIT

Commercial Usage

This plugin is free but if you use it in a commercial project please consider to contribute an improvement, or hire someone to do so.

Alternatives / Similar

Credits

This is a Kirby 3 port of @Flokosiol's kirby-translations (which is for Kirby 2); thanks to him for initiating this plugin ! :)
Special thanks to all contributors as well as the original kirby2-translations contributors !