PHPackages                             daandelange/translatedlayout - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. daandelange/translatedlayout

ActiveKirby-plugin[Localization &amp; i18n](/categories/localization)

daandelange/translatedlayout
============================

Layout and blocks fields with embedded translation logic.

1.0.5(1y ago)1714↓62.5%1[2 issues](https://github.com/Daandelange/kirby-TranslatedLayout/issues)MITPHP

Since Nov 28Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Daandelange/kirby-TranslatedLayout)[ Packagist](https://packagist.org/packages/daandelange/translatedlayout)[ Docs](https://github.com/daandelange/kirby-translatedlayout)[ RSS](/packages/daandelange-translatedlayout/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (15)Used By (0)

Kirby TranslatedLayout field plugin
===================================

[](#kirby-translatedlayout-field-plugin)

This plugin brings translation logics into the native `layouts` fields.

### Experimental

[](#experimental)

While the kirby team is waiting for some heavy refactoring for recursively bringing translation logics into their "complex fields", this plugin aims to provide a temporary workaround for multi-language websites.

This is an experimental draft trying to bring some translation logic to blocks, columns and layouts. It turns out to be quite powerful already with just a minimal set of changes compared to the native field behaviour.

**Current state** :
Tested on a single configuration, works well but not extensively tested. Therefore, please note that **there remains a risk of data loss**. (Do not use without backups!)
There is no `translatedblocks` fields nor `toTranslatedBlocks` method (yet?), please use layouts instead.

### Implementation

[](#implementation)

- The **primary language** (default) inherits the default `LayoutField` behaviour and remains *(almost?)* identical to the native Kirby Layout field.
- The **seconday languages** (translations) of this field are always syncronized on parse (aka `$field->fill($value)`).
    - **Identical structures** : The layouts and blocks structures are defined by the default language using their unique `id`.
    - **Fallback** : If a block has no translation, it's replaced with the default language.
    - **Sanitation** : If a block translation is not available in the default language, it's removed. All blocks from the default language are guaranteed to be available for translation in the panel.
    - **Panel GUI** : Non-translateable fields and blocks are disabled, preventing panel users from changing the layout and adding blocks in translations.
    - **Data** : The syncronized translation is saved as a blocks and columns array and parsed on retrieval. (this saves some disk space and makes data more readable).

[![Screenshot of Kirby 3 plugins TranslatedLayout](TranslatedLayout.gif)](TranslatedLayout.gif)

Requirements
------------

[](#requirements)

- Version `0.3.3-beta` : Kirby 3.8 or above.
- *(Kirby 4 compatibility should be easy to implement; mainly a few changed function signatures and namespace renames)*
- Version `1.0.0` : Kirby 5 or above.
- **Note**: This plugin heavily relies on the use of the panel. If you'd like to manually edit a `translatedlayout` field via the text content file, it's not recommended to use this plugin, as it's probably not recommended to use blocks without the panel. (Meanwhile, it still is possible, and this plugin even simplifies the translation files).

Installation
------------

[](#installation)

*Choose one:*

- Download: Download and copy this repository to `/site/plugins/translatedlayout`.
- Git submodule: `git submodule add https://github.com/daandelange/kirby-translatedlayout.git site/plugins/translatedlayout`.
- Composer: `composer require daandelange/translatedlayout`.

Setup
-----

[](#setup)

### Import existing data

[](#import-existing-data)

- The default language saves as the native Kirby layouts field.
- Translations have a different content structure and only save the translated block fields.

**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 data structure. There is no automatic script available.
The same happens when you change the default language so make sure it's correct, and to never change it again.

### Blueprints

[](#blueprints)

In your page blueprints, you can simply replace a `type: layout` field by `type: translatedlayout`. Read more about how to use the respective fields in the official Kirby docs.

The only difference is an extra `translate` property on fields, please refer to this example:

```
sections:
  content:
    type: fields
    fields:
      mylayout:
        label: Translated Layout Demo
        type: translatedlayout
        translate: true # toTranslatedLayout()` in your templates to fetch &amp; render the field contents. Like the native `LayoutField`'s `toLayouts`, a `Kirby\Cms\Layouts` object is returned. There is absolutely no difference as the plugin acts during the data parse state.

Options
-------

[](#options)

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

Development
-----------

[](#development)

- A small hack to fix KirbyUp's alias `@KirbyPanel` sub-includes : ([more info](https://github.com/johannschopplich/kirbyup/issues/7))
    - osx: `cd /path/to/translatedLayout/ && ln -s "../../../../kirby/panel/src/mixins" ./src/mixins`
    - linux: *todo*
    - other: Create an alias/symlink pointing from `translatedlayout/src/mixins` to `/kirby/panel/src/mixins`.
- `npm install` : Install the required dependencies.
- `npm run dev` : Develop mode (listen/compile).
- `npm run build` : Compile for publishing.

Feature ideas
-------------

[](#feature-ideas)

- Plugin options : Set rather to fill with (untranslated) default language, or leave the translateable blocks empty ? (on translation creation only).
- Write some test cases.

Similar Plugins
---------------

[](#similar-plugins)

- [Synced-Structure](https://gist.github.com/lukaskleinschmidt/1c0b94ffab51d650b7c7605a4d25c213) : Syncs structures across languages using UUIDs. Note: *This method doesn't work with `Layouts` and `Blocks` fields because they use the `FieldClass` instead of Kirby's field blueprints.*

License
-------

[](#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.
For contribution suggestions, you can search for `todo` in the source code or refer to open issues.

Credits
-------

[](#credits)

- [Daan de Lange](https://daandelange.com/)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance46

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~96 days

Recently: every ~0 days

Total

14

Last Release

382d ago

Major Versions

0.3.3-beta → 1.0.02025-04-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/1042ade2129860410fbad8fa2b0c5eb8059a3af12590091a5542b54d3781963d?d=identicon)[daandelange](/maintainers/daandelange)

---

Top Contributors

[![Daandelange](https://avatars.githubusercontent.com/u/1329784?v=4)](https://github.com/Daandelange "Daandelange (49 commits)")

---

Tags

kirby-cmskirby-plugkirby3kirby3-pluginkirby5kirby5-pluginkirby-pluginkirby-cmskirby5kirby3kirby-panel-pluginkirby-field-plugin

### Embed Badge

![Health badge](/badges/daandelange-translatedlayout/health.svg)

```
[![Health](https://phpackages.com/badges/daandelange-translatedlayout/health.svg)](https://phpackages.com/packages/daandelange-translatedlayout)
```

###  Alternatives

[arnoson/kirby-vite

Vite helper for Kirby CMS

9759.2k3](/packages/arnoson-kirby-vite)[beebmx/kirby-env

Enable env variables to Kirby

2037.9k2](/packages/beebmx-kirby-env)[bnomei/kirby3-redirects

Setup performant HTTP Status Code Redirects from within the Kirby Panel

269.1k](/packages/bnomei-kirby3-redirects)[pechente/kirby-admin-bar

Kirby Admin Bar

512.2k](/packages/pechente-kirby-admin-bar)[beebmx/kirby-courier

Courier offers a convenient and painless solution for creating emails tailored for your Kirby website.

403.0k2](/packages/beebmx-kirby-courier)[beebmx/kirby-db

Enable database support for Illuminate\\Database in Kirby

192.6k](/packages/beebmx-kirby-db)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
