Download the PHP package daandelange/k3-translations without Composer
On this page you can find all versions of the php package daandelange/k3-translations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download daandelange/k3-translations
More information about daandelange/k3-translations
Files in daandelange/k3-translations
Package k3-translations
Short Description Translations menu replacement, field and section for Kirby 3
License MIT
Homepage https://github.com/Daandelange/k3-translations
Informations about the package k3-translations
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.
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).
- The language menu explicitly shows if the translation exists:
- RED: The translated
.txt
-file doesn't exist, the content is not translated in this language. - GREEN: The translated
.txt
-file exists, the content is translated in this language.
- RED: The translated
- All languages are always visible, for faster switching between translations.
- For all non-default languages you can:
- Delete a translation content file (without deleting the whole page).
- Resynchronise translations with the default language file (revert).
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.
Composer
If you are using Composer, you can install the plugin with
Note: While k3-translations
is still alpha, there is no stable channel for composer, so you need to specify the unstable version.
Git submodule
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:
Translations Section
Add the following section
to your blueprint(s). (optional)
Advanced usage
$page->isTranslated(string|bool|array $langCode = false)
Returns if a page content translation is available.
$langCode
:false
: For the current languagetrue
: For all languages.'fr'
: For a specific language.['fr', 'en']
: For specific languages.
Options
The following options are available for any translations section or field:
-
Disallow deleting content translations:
-
Disallow reverting a translation to the default language:
-
Use a more compact layout:
-
Set a custom label:
- Hide the "Edit language in panel" menu item:
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).
- Npm requirements (optional) :
npm install -g kirbyup
- Setup :
cd /path/to/website/site/plugins/translations && npm install
- While developing :
npm run dev
- Compile a production build :
npm run build
- Update dependencies :
npm update
- Composer install & update :
composer update
License
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
- If you need to sync specific fields between languages, there's the kirby3-language-sync plugin.
- To get an overview of your pages' translation status in the panel, you can use k3-translation-status.
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 !