PHP Classes
elePHPant
Icontem

PHP Get Locale from CountryCode: Determine locale language from country code

Recommend this page to a friend!
  Info   View files Documentation   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-04-09 (1 month ago) RSS 2.0 feedNot enough user ratingsTotal: 148 This week: 3All time: 8,354 This week: 252Up
Version License PHP version Categories
country-to-locale 1.0.0Custom (specified...5Localization, PHP 5, Geography
Description Author

This class can determine locale language from country code.

It can take the code of a country and converts it to the locale name that identifies the country and language used in that country.

For countries that use different languages, it returns a string with all locale names separated by commas.

Innovation Award
PHP Programming Innovation award nominee
April 2017
Nominee
Vote
Locale is the definition of settings that change from country to country, like the language and the way to format values like time, dates and money amounts.

Each locale has a name string formed by the country and the language or languages associated with that country.

This class can determine which locales are associated with each country and returns a string with the names of the country locales.

Manuel Lemos
  Performance   Level  
Name: Peter Kahl <contact>
Classes: 19 packages by
Country: Hong Kong Hong Kong
Age: ???
All time rank: 8314 in Hong Kong Hong Kong
Week rank: 8 Up1 in Hong Kong Hong Kong Up
Innovation award
Innovation award
Nominee: 6x

Details

Country-to-Locale

Determine locale from 2-letter country code. (Can be used as language code.)

Usage

use locale\locale;

echo locale::country2locale('DE'); # 'de_DE'

echo locale::country2locale('CN'); # 'zh_CN'
  Files folder image Files  
File Role Description
Files folder imagesrc (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imagelocale (1 file)

  Files folder image Files  /  src  /  locale  
File Role Description
  Plain text file locale.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:148
This week:3
All time:8,354
This week:252Up