PHP code example of oblik / kirby-plurals

1. Go to this page and download the library: Download oblik/kirby-plurals 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/ */

    

oblik / kirby-plurals example snippets


return [
    'code' => 'en',
    'default' => true,
    'name' => 'English',
    'translations' => [
        'apples' => [
            'one' => '{{ count }} apple',
            'other' => '{{ count }} apples'
        ],
        'place' => [
            'one' => '{{ position }}st',
            'two' => '{{ position }}nd',
            'few' => '{{ position }}rd',
            'other' => '{{ position }}th'
        ],
        'cookies' => [
            'other' => '{{ start }}-{{ end }} cookies'
        ]
    ]
];

tp('apples', [ 'count' => 1 ]);                 // 1 apple
tp('apples', [ 'count' => 3 ]);                 // 3 apples
tp('place', [ 'position' => 1 ]);               // 1st
tp('place', [ 'position' => 103 ]);             // 103rd
tp('cookies', [ 'start' => 3, 'end' => 4 ]);    // 3-4 cookies

return [
    'oblik.plurals.map' => [
        'en-us' => 'en',
        'en-gb' => 'en'
    ]
];