A layout field that forces translations to have the same structure.

Overview

Kirby translatedlayout plugin

A layout field that forces translations to have anidentical structure to the one of the default language.

This is an experimental draft for trying to bring some translation logic to blocks and layouts.

Note: If you manually edit content files, it's not recommended to use this plugin.

Implementation

  • Seconday languages are always syncronized (on parse) with layouts and blocks from the default language using their unique id. If a block has no translation, it's replaced with the default language. If a block translation is not available in the default.
  • In secondary languages, some simple GUI limitations prevent panel users from changing the layout and/or adding blocks.
  • The syncronized translation is saved as a regular layout in the content file. This duplicates the structure in every language, but it facilitates the implementation and ensures full compatibility with core blocks and layouts.

Screenshot of Kirby 3 plugins TranslatedLayout

Installation

Requirements

  • Kirby 3.6 or above.
  • Warning! If you already have a layout with translated content, switching to this field will erase all translations unless you manually give the same id to blocks/rows/columns in the translations.
    Please also note that during the beta phase, there remains a risk of data loss. Do not use without backups.

Download

Download and copy this repository to /site/plugins/translatedlayout.

Git submodule

git submodule add https://github.com/daandelange/kirby3-translatedlayout.git site/plugins/translatedlayout

Setup

In your page blueprints, you can simply replace a type: layout field by type: translatedlayout.

Example setup :

sections:
  content:
    type: fields
    fields:
      layout:
        label: TranslatedLayout Demo
        type: translatedlayout
        translate: true # <--- enables syncing of translations
        layouts:
          - "1/1"
          - "1/2, 1/2"
          - "1/3, 1/3, 1/3"
        fieldsets:
          translateable:
            label: Fully Translateable Blocks
            type: group
            fieldsets:
              heading:
                extends: blocks/heading
                translate: true # same as default value
              - list
              - text
          partiallytranslateable:
            label: Blocks with some translateable fields
            type: group
            fieldsets:
              image: # over-rule the translated option of an existing fields
                label: Image (non translateable src)
                type: image
                translate: false
                fields:
                  link:
                    translate: false
              url: # custom block example
                name: Url (non-translateable source)
                icon: cog
                fields:
                  link:
                    type: url
                    translate: false
                    required: true
                  text:
                    type: text
                    translate: true
                  
          nontranslateable:
            label: Non-translated blocks
            type: group
            fieldsets:
              line:
                extends: blocks/line
                translate: false

Options

There are no options available yet. Would you like to contribute some ?

Development

  • npm install : Install the required dependencies.
  • npm run dev : Develop mode (listen/compile).
  • npm run build : Compile for publishing.

License

MIT - Free to use, free to improve !

However, for usage in commercial projects, please seriously consider to improve the plugin a little and contribute back the changes with a PR, or hire someone to do so.

Credits

You might also like...
Bundle providing Honeypot field for the Form Builder in Ibexa DXP Experience/Commerce (3.X)

IbexaHoneypot Bundle providing Honeypot field for the Form Builder in Ibexa DXP Experience/Commerce (3.X) What is Honey pot? A honey pot trap involves

A measurement field for ProcessWire

Fieldtype Measurement This fieldtype allows a measurement unit to be stored with a corresponding measurement value ('magnitude'). The relevant details

Markdownfield - Markdown field for SilverStripe

MarkdownField This module introduces a new DB field type Markdown & Markdown Editor. It uses github style Markdown style. And uses the simple markdown

This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every translatable field.
This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every translatable field.

Autotranslate This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every

A Symfony2 bundle that integrates Select2 as a drop-in replacement for a standard entity field on a Symfony form.
A Symfony2 bundle that integrates Select2 as a drop-in replacement for a standard entity field on a Symfony form.

select2entity-bundle Introduction This is a Symfony bundle which enables the popular Select2 component to be used as a drop-in replacement for a stand

Magento 2 extension. Strekoza_GoogleCategory. Add Category Attribute (field) - "Google Category"

Magento 2 extension. Strekoza_GoogleCategory Magento 2 extension. Add Category Attribute (field) - "Google Category" This exstension will add Category

Nagios/Icinga plugin for checking SATEON field network device status

check_sateon Nagios/Icinga plugin for checking SATEON field network device status Max.Fischer [email protected] Tested on CentOS GNU/Linux 6.5 with Ici

Ranting field for the Filament forms
Ranting field for the Filament forms

Ranting field for the Filament forms

Multi-language field export/import tool for ProcessWire

Language field export/import for ProcessWire Typically the way you translate page field values in ProcessWire is to edit a page, view the text in one

Comments
  • Php error on second language after adding a block in first language

    Php error on second language after adding a block in first language

    Panel error on second language after adding a block in first language : array_key_exists(): Argument #2 ($array) must be of type array, null given in file: /Users/seb/Sites/proprietes.fr/site/plugins/translatedlayout/src/classes/TranslatedLayoutField.php line: 188

    opened by seb-celinedesign 2
  • Not working

    Not working

    Something seems to be wrong with the plugin. If I set up a basic example as in the instructions, when I edit the second language the text is not saved and reverts back to the primary language value.

    opened by Small-Systems 4
Releases(0.1.1-beta)
Owner
Daan de Lange
Creative coder & digital artist exploring the relationship between digital and organic worlds
Daan de Lange
🇸🇮 Slovenian translations - language package for Magento 2

Magento 2 Slovenian translations Slovenian (Slovenia) - sl_SI translations for Magento Community Edition 2.x. Translations follow Slovenian grammar an

Symfony Slovenia 11 Dec 2, 2022
H&O Magento 2 Nederlandse vertalingen / Dutch Translations

Abandoned / End-of-life We're sorry, but this extension is no longer actively maintained. Please use https://github.com/magento-l10n/language-nl_NL in

Reach Digital 28 Mar 5, 2021
Handles ActiveRecord's attribute translations

TranslateableBehavior for Yii2 This behavior has been inspired by the great work of Mikehaertl's Translatable Behavior for Yii 1.*. It eases the trans

2amigOS! Consulting Group 67 May 21, 2022
Magento commands to find translations that are present in one CSV file but not in another, and to translate CSV dicts with DeepL

Hyvä Themes - Magento translation CSV comparison command hyva-themes/magento2-i18n-csv-diff This module adds the bin/magento i18n:diff-csv and i18n:tr

Hyvä 6 Oct 26, 2022
Laravel-Crowdin Integration - Automate translations uploading/downloading

Laravel-Crowdin Integration Automate uploading/downloading translations Installation Install the package via composer: composer require georgii-web/la

Joris van Willigen 0 May 25, 2022
Shiki is a beautiful syntax highlighter powered by the same language engine that many code editors use.

Shiki is a beautiful syntax highlighter powered by the same language engine that many code editors use. This package allows you to use Shiki from PHP.

Spatie 229 Jan 4, 2023
Making multiple identical function calls has the same effect as making a single function call.

Making multiple identical function calls has the same effect as making a single function call.

李铭昕 4 Oct 16, 2021
Share value objects that contain the same primitive value as a singleton

sharable-value-objects Share value objects that contain the same primitive value as a singleton. Singletons are kept under WeakReference objects. Inst

mpyw 5 Nov 14, 2021
Alerts users in the SilverStripe CMS when multiple people are editing the same page.

Multi-User Editing Alert Alerts users in the SilverStripe CMS when multiple people are editing the same page. Maintainer Contact Julian Seidenberg <ju

Silverstripe CMS 15 Dec 17, 2021
A Magento 2 module that allows for creating discrete PDP (Product Detail Pages) page layouts for customers landing on the site from a PPC (Pay Per Click) link/ad by allowing routing to the same pages using a `/ppc/` prefix in the URL path.

A Magento 2 module that allows for creating discrete PDP (Product Detail Pages) page layouts for customers landing on the site from a PPC (Pay Per Click) link/ad by allowing routing to the same pages using a `/ppc/` prefix in the URL path.

null 16 Nov 11, 2022