php - Language Country Code Conversion -


does know how convert language country codes ones below name of actual language?

en_us de_de en_gb it_it fr_fr 

i have dynamic input , need convert language country code corresponding name of language (i.e en_us = english, fr_fr = french).

check code , works fine have used codes http://msdn.microsoft.com/en-us/library/ms533052%28v=vs.85%29.aspx

<?php     $strlcodes = '<tr><td>af</td><td>afrikaans </td><td>sq</td><td>albanian </td></tr>     <tr><td>ar-sa</td><td>arabic (saudi arabia) </td><td>ar-iq</td><td>arabic (iraq) </td></tr>     <tr><td>ar-eg</td><td>arabic (egypt) </td><td>ar-ly</td><td>arabic (libya) </td></tr>     <tr><td>ar-dz</td><td>arabic (algeria) </td><td>ar-ma</td><td>arabic (morocco) </td></tr>      <tr><td>ar-tn</td><td>arabic (tunisia) </td><td>ar-om</td><td>arabic (oman) </td></tr>     <tr><td>ar-ye</td><td>arabic (yemen) </td><td>ar-sy</td><td>arabic (syria) </td></tr>     <tr><td>ar-jo</td><td>arabic (jordan) </td><td>ar-lb</td><td>arabic (lebanon) </td></tr>     <tr><td>ar-kw</td><td>arabic (kuwait) </td><td>ar-ae</td><td>arabic (u.a.e.) </td></tr>      <tr><td>ar-bh</td><td>arabic (bahrain) </td><td>ar-qa</td><td>arabic (qatar) </td></tr>     <tr><td>eu</td><td>basque </td><td>bg</td><td>bulgarian </td></tr>     <tr><td>be</td><td>belarusian </td><td>ca</td><td>catalan </td></tr>     <tr><td>zh-tw</td><td>chinese (taiwan) </td><td>zh-cn</td><td>chinese (prc) </td></tr>      <tr><td>zh-hk</td><td>chinese (hong kong sar) </td><td>zh-sg</td><td>chinese (singapore) </td></tr>     <tr><td>hr</td><td>croatian </td><td>cs</td><td>czech </td></tr>     <tr><td>da</td><td>danish </td><td>nl</td><td>dutch (standard) </td></tr>     <tr><td>nl-be</td><td>dutch (belgium) </td><td>en</td><td>english </td></tr>      <tr><td>en-us</td><td>english (united states) </td><td>en-gb</td><td>english (united kingdom) </td></tr>     <tr><td>en-au</td><td>english (australia) </td><td>en-ca</td><td>english (canada) </td></tr>     <tr><td>en-nz</td><td>english (new zealand) </td><td>en-ie</td><td>english (ireland) </td></tr>     <tr><td>en-za</td><td>english (south africa) </td><td>en-jm</td><td>english (jamaica) </td></tr>      <tr><td>en</td><td>english (caribbean) </td><td>en-bz</td><td>english (belize) </td></tr>     <tr><td>en-tt</td><td>english (trinidad) </td><td>et</td><td>estonian </td></tr>     <tr><td>fo</td><td>faeroese </td><td>fa</td><td>farsi </td></tr>     <tr><td>fi</td><td>finnish </td><td>fr</td><td>french (standard) </td></tr>      <tr><td>fr-be</td><td>french (belgium) </td><td>fr-ca</td><td>french (canada) </td></tr>     <tr><td>fr-ch</td><td>french (switzerland) </td><td>fr-lu</td><td>french (luxembourg) </td></tr>     <tr><td>gd</td><td>gaelic (scotland) </td><td>ga</td><td>irish </td></tr>     <tr><td>de</td><td>german (standard) </td><td>de-ch</td><td>german (switzerland) </td></tr>      <tr><td>de-at</td><td>german (austria) </td><td>de-lu</td><td>german (luxembourg) </td></tr>     <tr><td>de-li</td><td>german (liechtenstein) </td><td>el</td><td>greek </td></tr>     <tr><td>he</td><td>hebrew </td><td>hi</td><td>hindi </td></tr>     <tr><td>hu</td><td>hungarian </td><td>is</td><td>icelandic </td></tr>      <tr><td>id</td><td>indonesian </td><td>it</td><td>italian (standard) </td></tr>     <tr><td>it-ch</td><td>italian (switzerland) </td><td>ja</td><td>japanese </td></tr>     <tr><td>ko</td><td>korean </td><td>ko</td><td>korean (johab) </td></tr>     <tr><td>lv</td><td>latvian </td><td>lt</td><td>lithuanian </td></tr>      <tr><td>mk</td><td>macedonian (fyrom)</td><td>ms</td><td>malaysian </td></tr>     <tr><td>mt</td><td>maltese </td><td>no</td><td>norwegian (bokmal) </td></tr>     <tr><td>no</td><td>norwegian (nynorsk) </td><td>pl</td><td>polish </td></tr>     <tr><td>pt-br</td><td>portuguese (brazil) </td><td>pt</td><td>portuguese (portugal) </td></tr>      <tr><td>rm</td><td>rhaeto-romanic </td><td>ro</td><td>romanian </td></tr>     <tr><td>ro-mo</td><td>romanian (republic of moldova) </td><td>ru</td><td>russian </td></tr>     <tr><td>ru-mo</td><td>russian (republic of moldova) </td><td>sz</td><td>sami (lappish) </td></tr>     <tr><td>sr</td><td>serbian (cyrillic) </td><td>sr</td><td>serbian (latin) </td></tr>      <tr><td>sk</td><td>slovak </td><td>sl</td><td>slovenian </td></tr>     <tr><td>sb</td><td>sorbian </td><td>es</td><td>spanish (spain) </td></tr>     <tr><td>es-mx</td><td>spanish (mexico) </td><td>es-gt</td><td>spanish (guatemala) </td></tr>     <tr><td>es-cr</td><td>spanish (costa rica) </td><td>es-pa</td><td>spanish (panama) </td></tr>      <tr><td>es-do</td><td>spanish (dominican republic) </td><td>es-ve</td><td>spanish (venezuela) </td></tr>     <tr><td>es-co</td><td>spanish (colombia) </td><td>es-pe</td><td>spanish (peru) </td></tr>     <tr><td>es-ar</td><td>spanish (argentina) </td><td>es-ec</td><td>spanish (ecuador) </td></tr>     <tr><td>es-cl</td><td>spanish (chile) </td><td>es-uy</td><td>spanish (uruguay) </td></tr>      <tr><td>es-py</td><td>spanish (paraguay) </td><td>es-bo</td><td>spanish (bolivia) </td></tr>     <tr><td>es-sv</td><td>spanish (el salvador) </td><td>es-hn</td><td>spanish (honduras) </td></tr>     <tr><td>es-ni</td><td>spanish (nicaragua) </td><td>es-pr</td><td>spanish (puerto rico) </td></tr>     <tr><td>sx</td><td>sutu </td><td>sv</td><td>swedish </td></tr>      <tr><td>sv-fi</td><td>swedish (finland) </td><td>th</td><td>thai </td></tr>     <tr><td>ts</td><td>tsonga </td><td>tn</td><td>tswana </td></tr>     <tr><td>tr</td><td>turkish </td><td>uk</td><td>ukrainian </td></tr>     <tr><td>ur</td><td>urdu </td><td>ve</td><td>venda </td></tr>      <tr><td>vi</td><td>vietnamese </td><td>xh</td><td>xhosa </td></tr>     <tr><td>ji</td><td>yiddish </td><td>zu</td><td>zulu </td></tr>     ';     error_reporting(e_parse | e_error);     $dom = new domdocument();     $dom->loadhtml($strlcodes);      $xml = simplexml_import_dom($dom);     $path = $xml->xpath('//td');     echo "<pre>";     $strpath  = implode('|',$path);      echo str_replace(' |', '<br/>',$strpath);     echo "</pre>";  ?> 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -