PHP code example of borges / localization

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

    

borges / localization example snippets


return array(
    'color'     => 'Colour',
    'hello'     => 'Hello',
    'welcome'   => 'Welcome',
    'another-string' => 'Another String'
);

return array(
    'color'     => 'Color'
);

return array(
    'color'     => 'Cor',
    'hello'     => 'Olá',
    'welcome'   => 'Bem-vindo'
);

App::setLocale('en');
echo Lang::get('app.welcome');  # prints 'Welcome'
echo Lang::get('app.color');  # prints 'Colour'
echo Lang::get('app.hello');  # prints 'Hello'

App::setLocale('en-US');
echo Lang::get('app.welcome');  # prints 'Welcome'
echo Lang::get('app.color');  # prints 'Color'
echo Lang::get('app.hello');  # prints 'Hello'

App::setLocale('pt');
echo Lang::get('app.welcome');  # prints 'Bem-vindo'
echo Lang::get('app.color');  # prints 'Cor'
echo Lang::get('app.hello');  # prints 'Olá'

echo Lang::get('another-string');  # prints 'Another String' if 'useDefault' is true or else prints 'another-string'

App::setLocale('en');
echo Locale::number(1234567.890); # prints '1, 234, 567.89'
echo Locale::int(1234567.890); # prints '1, 234, 568'
echo Locale::date(Carbon\Carbon::now()); # prints 'Tuesday, December 17, 2013'

App::setLocale('en-US');
echo Locale::number(1234567.890); # prints '1, 234, 567.89'
echo Locale::int(1234567.890); # prints '1, 234, 568'
echo Locale::date(Carbon\Carbon::now()); # prints 'Tuesday, December 17, 2013'

App::setLocale('pt');
echo Locale::number(1234567.890); # prints '1 234 567,89'
echo Locale::int(1234567.890); # prints '1 234 568'
echo Locale::date(Carbon\Carbon::now()); # prints '17 de Dezembro de 2013'