1. Go to this page and download the library: Download wufr/php-language-localizer 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/ */
wufr / php-language-localizer example snippets
use wUFr\Translator;
$translator = new Translator(dir: "./locales/", lang: "en_US");
echo $translator->locale("someFolder/testValues", "translateThis");
// outputs "translated value"
$l = [
"translateThis" => "translated value",
"BasedOnNumber" => [
1 => "box",
2 => "boxes",
50 => "a lot of boxes"
],
"thxText" => "Thank you {username} for buying {product}",
"thxTextCounter" => [
1 => "Thank you {username} for buying a piece of {product}",
2 => "Thank you {username} for buying two of {product}",
50 => "Thank you {username} for buying {count} pieces of {product}",
],
];