PHP code example of medienbaecker / kirby-translation-progress

1. Go to this page and download the library: Download medienbaecker/kirby-translation-progress library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

medienbaecker / kirby-translation-progress example snippets


'medienbaecker.translation-progress' => [
    'minValueLength'    => 50,
    'languageVariables' => true,
    'ignoreFieldTypes'  => ['files', 'pages', 'users', 'link', 'color', 'date', 'time'],
    'ignoreVariable'    => null,
    'ignoreField'       => null,
    'ignorePage'        => null,
    'adapters'          => [],
],

'medienbaecker.translation-progress' => [
    // Language variables, by translation key
    'ignoreVariable' => function (string $key, string $value): bool {
        return $key === 'recipe.time';
    },

    // Content fields, by name and template
    'ignoreField' => function (string $name, string $template): bool {
        return $template === 'recipe' && $name === 'duration';
    },

    // Whole pages, by template or anything on the Page object
    'ignorePage' => function (\Kirby\Cms\Page $page): bool {
        return $page->intendedTemplate()->name() === 'recipe';
    },
],

'medienbaecker.translation-progress' => [
    'adapters' => [
        'my-field' => function (string $value): string {
            $data = json_decode($value, true);
            return strip_tags($data['html'] ?? '');
        },
    ],
],