PHP code example of los / losi18n

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

    

los / losi18n example snippets


$languagesService = $sm->get('losi18n-countries');
// All languages translated to pt_BR
$languages = $countriesService->getAllLanguages('pt_BR');
// All languages in their native names
$languages = $countriesService->getNativeLanguages();
// Brazilian Portuguese in English
$language = $countriesService->getLanguage('pt_BR', 'en);

$countriesService = $sm->get('losi18n-countries');
// All officially assigned countries translated to English
$countries = $countriesService->getAllCountries('en');
// All countries translated to English
$countries = $countriesService->getAllCountries('en', false);
// United States translated to Brazilian Portuguese
$country = $countriesService->getCountry('US','pt_BR');

$regionsService = $sm->get('losi18n-regions');
$regions = $countriesService->getAllRegions('pt_BR');