1. Go to this page and download the library: Download leanadmin/gloss 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/ */
leanadmin / gloss example snippets
use Gloss;
Gloss::$underscoreHelper = false;
use Gloss;
Gloss::$shouldReplaceTranslator = true;
___('Create :Resource', ['resource' => 'product']);
// 'resources.edit' => 'Show :Resource :title'
gloss('resources.create', ['resource' => 'product', 'title' => 'MacBook Pro 2019']); // Show Product MacBook Pro 2019
// 'notifications.updated' => ':Resource :title has been updated!'
Gloss::get('resources.edit', ['resource' => 'product', 'title' => 'iPhone 12']); // Product iPhone 12 has been updated!
// 'foo.apple' => 'There is one apple|There are many apples'
Gloss::choice('foo.apple', ['count' => 2]); // There are many apples
// Original in English: 'create' => 'Create :Resource',
'create' => 'Vytvořit :Resource',
// 'pagination' => 'Zobrazeno :start až :end z :total výsledků',
// Zobrazeno <span class="font-medium">10</span> až <span class="font-medium">20</span> z <span class="font-medium">50</span> výsledků
// 'apples' => '{0} There are no apples|[1,*]There are :count apples'
Gloss::extend('foo.apples', fn ($apples, $replace) => $replace($apples, [
':count' => '<span class="font-medium">:count</span>',
]));
gloss()->choice('foo.apples', 0); // There are no apples
gloss()->choice('foo.apples', 5); // There are <span class="font-medium">5</span> apples
// So elegant!
fn ($string, $replace) => $replace($string, [
'elegant' => 'eloquent',
]);
// So eloquent!