PHP code example of alldigitalrewards / language-mapper
1. Go to this page and download the library: Download alldigitalrewards/language-mapper 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/ */
alldigitalrewards / language-mapper example snippets
bash
Returns default en_US since language not found in acceptable list:
$mapper = new LanguageMapper('nz_NZ');
$this->assertSame('en_US', $mapper->getLanguage());
Returns es_ES since language found in acceptable list:
$mapper = new LanguageMapper('es_ES');
$this->assertSame('es_ES', $mapper->getLanguage());
You can pass in short code and/or long code with dashes
$mapper = new LanguageMapper('fr');
$this->assertSame('fr_CA', $mapper->getLanguage());
$mapper = new LanguageMapper('es-ES');
$this->assertSame('es_ES', $mapper->getLanguage());