Giter VIP home page Giter VIP logo

k3-translations's Introduction

Kirby Translations

Beta : This is a work in progress port of translations to Kirby 3. The "saved" state of a field is not yet enabled.

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).

  • 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.
  • All languages are always visible, for faster switching between translations.
  • For all non-default languages you can:
    • Delete a translation (without deleting the whole page).
    • Resynchronise translations with the default language file (revert).

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 and extract this repository, rename the folder to translations and drop it into the plugins folder of your Kirby installation. You should end up with a folder structure like this:

site/plugins/translations/

Composer

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

composer require daandelange/k3-translations

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.options.header.replaceKirbyLanguages': false, // To disable replacing the native lang menu. Default = true.
  'daandelange.translations.options.header.compactMode': true, // To enable a more compact mode (alpha!). Default = false.
  'daandelange.translations.options.header.deletable': false, // To disallow deleting a language. Default = true.
  'daandelange.translations.options.header.revertable': false, // To disallow reverting a language. Default = true.
];

Translations Section

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

sections:
  translations:
    type: translations

Options

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

  • Disallow deleting content translations:
    deletable: false # default = true
  • Disallow reverting a translation to the default language:
    revertable: false # default = true
  • Use a more compact layout:
    compactmode: true # default = false
  • Set a custom label:
    label: Labelized! # default = [empty]

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

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.

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 !

k3-translations's People

Contributors

daandelange avatar fk-3st avatar flokosiol avatar pqml avatar sylvainjule avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.