What is a language code?
A language code is a short label for a language. It is like a name tag. Instead of writing "English", a program uses en. PHP is a language that runs many websites. A PHP app reads the code to show text in the right language.
The short code usually has two letters. It comes from a standard called ISO 639-1. A longer code adds the country after an underscore or dash. For example, en_US means English as used in the United States. en_GB means English as used in Great Britain.
Common codes
| Language | Short code | Example with country |
|---|---|---|
| English | en | en_US, en_GB |
| Spanish | es | es_ES, es_MX |
| French | fr | fr_FR, fr_CA |
| German | de | de_DE |
| Italian | it | it_IT |
| Portuguese | pt | pt_PT, pt_BR |
| Dutch | nl | nl_NL |
| Russian | ru | ru_RU |
| Arabic | ar | ar_SA |
| Hindi | hi | hi_IN |
| Chinese (Simplified) | zh | zh_CN |
| Chinese (Traditional) | zh | zh_TW |
| Japanese | ja | ja_JP |
| Korean | ko | ko_KR |
| Turkish | tr | tr_TR |
| Polish | pl | pl_PL |
| Swedish | sv | sv_SE |
| Indonesian | id | id_ID |
How to use a code
- Find your language in the table.
- Open the settings or config file of your PHP app.
- Look for a setting named something like
lang,localeorlanguage. - Type the code. Keep the same style the app already uses.
- Save the file and reload your site.
In plain PHP, you can set the locale like this.
setlocale(LC_ALL, 'fr_FR.UTF-8');
This asks PHP to use French formats for dates and numbers. The server must have that language installed.
en-US. Others use an underscore, like en_US. Copy the style your app already shows.Ask Hostvento support through a support ticket if a language is missing on your server.
