PHPackages                             daandelange/clavisverbum - 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/clavisverbum

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

daandelange/clavisverbum
========================

A multilanguage taxonomy field for Kirby.

0.2.1(5mo ago)20[1 issues](https://github.com/Daandelange/kirby-ClavisVerbum/issues)MITPHP

Since Nov 19Pushed 5mo agoCompare

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

READMEChangelogDependencies (2)Versions (5)Used By (0)

Clavis Verbum
=============

[](#clavis-verbum)

A duo of 2 fields for managing your multilanguage keywords (and other simple taxonomy).
*Clavis verbum is the literal latin translation of "key-word".*

Benefits compared to the native structure and tag fields :

- Multilanguage support.
- Centralised taxonomy storage.
- Easily modify your taxonomy.

Provided
--------

[](#provided)

Fields:

- `translatedstructure` : An extended structure field with translateable entries.
    All content is stored in the default language and translateable fields are automatically cloned for each language and.
- `taxonomystructure` : A field for handling your multilanguage keywords and other taxonomy.
- `taxonomytags` : An extended tags field for selecting and creating keywords.

Frontend tools:

- Utilities to sanitize and translate a list of taxonomy.
- Utilities to bind a field to another field.

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

[](#requirements)

A Kirby 5 multilanguage website. *Using this plugin in a single language setup is not tested.*This plugin depends on [daandelange/kirby-helpers](https://github.com/Daandelange/kirby-helpers).

Install
-------

[](#install)

- Composer : `composer require daandelange/clavisverbum`
- GIT : `git submodule add https://github.com/Daandelange/kirby-ClavisVerbum.git ./site/plugins/clavisverbum``cd /site/plugins/clavisverbum && composer install``git submodule add https://github.com/Daandelange/kirby-helpers.git ./site/plugins/daans-helpers``cd /site/plugins/daans-helpers && composer install`

---

Usage
-----

[](#usage)

### Plugin options

[](#plugin-options)

You can change the plugin behaviour using the following options :

```
return [
    // Field names to hide from the preview columns
    'preview.hideFields' => false, // false | array
    // The label of a field preview. Template args: `field` and `language`. Global scope, can be overridden by blueprint
    'preview.label' => '{{ field.label }} / {{ language.code }}',
    // The label of a newly duplicated field. Template args: `field` and `language`. Global scope, can be overridden by blueprint
    'field.duplicationLabel' => '{{ field.label }} / {{ language.name }}',
];
```

---

### Field : Translated Structure

[](#field--translated-structure)

This field tries to solve translation issues often encountered with the native structure field.
It's simply a structure field with translateable field entries. All content is stored in the default language and translateable fields are automatically cloned for each language.

This field is used by the `taxonomystructure` field, but you can also use it standalone.

#### Blueprint Properties

[](#blueprint-properties)

Blueprint options are inherited from the native structure field, except the following ones :
Note: *Some defaults have been changed for convenience.*

```
    # Section fields...
    fields:
        myfield:
            # A translated structure
            type: translatedstructure
            # To validate any unique fields
            validate: noduplicates
            # Field names to remove from the preview column
            hiddenpreviewfields: # default=[]
                - myfieldname_fr # hide a french field
                - myfieldname # hide a non translated field
            # Show all languages of a field on one line ?
            spreadlangsoverwidth: true # default=false
            # Show default language fields only in preview columns.
            previewShowDefaultOnly: true # default=false
            # Show current language fields only in preview columns.
            previewShowCurrentOnly: false # default=true
            # The label of a newly duplicated fields. Template args: `field` and `language`.
            previewLabel: '{{ field.label }} / {{ language.code }}' # default=as-example
            # Your regular fields with extra props
            fields:
                somefield:
                    # Set either to translate this field or not
                    translate: true
                    # The required prop can be set to `defaultlang`
                    # which will require a value only for the default language
                    required: defaultlang # default=false
                    # Don't allow duplicate entries for this field (for the panel field validator on save)
                    unique: true #default=false
                    # Todo:
                    #translationfallback: defaultLang # a field name or '' to use if no translation is available.
                    # The label can be array, static strings or even a translation variable. (see also options.field.duplicationLabel)
                    label:
                        en: Some field
                        fr: Un champ

```

#### Frontend template

[](#frontend-template)

You can use `toTranslatedStructure()` to fetch the data; usage is like `toStucture()` but it sanitizes the data, restricting the data fields to the available fields. Also, you can call `$translatedStructureObject->mytranslatedfieldname($lang=null)` to automatically grab the current language.

```
