Is there a simple way to get the language code from a country code in PHP

后端 未结 5 1700
日久生厌
日久生厌 2020-12-17 16:15

I\'m using ISO 3166-1-alpha 2 codes to pass to an application to retrieve a localised feed e.g. /feeds/us for the USA. I have a switch statement which serves a feed based on

5条回答
  •  生来不讨喜
    2020-12-17 17:18

    You will want to cross reference these files:

    http://www.ethnologue.com/codes/LanguageIndex.tab http://www.ethnologue.com/codes/CountryCodes.tab http://www.ethnologue.com/codes/LanguageCodes.tab

    ..or get them all in one zip here: http://www.ethnologue.com/codes/Language_Code_Data_20110104.zip

    There is no current set PHP function that returns this data that I'm aware of.

提交回复
热议问题