How to Configure Custom Language Locales and Codes in Polylang
Content
Many WordPress site owners using the Polylang plugin encounter a common challenge: they need to add a language that isn't pre-defined in the plugin's list or requires a very specific locale code. This is a frequent request for regional language variations, such as English for the United Arab Emirates (en_AE) or Spanish for Latin America (es_419).
Why This Happens
Polylang's default list includes many common languages and locales. However, it cannot include every possible regional variation. Furthermore, Polylang uses a language code (primarily for URLs) that is separate from the WordPress locale (which controls the language of the admin interface and theme/plugin translations). The plugin restricts the language code to letters, hyphens, and underscores for URL compatibility, which is why codes with numbers (like es_419) are not accepted in that field.
How to Manually Add a Custom Language
You are not limited to the pre-defined list. You can manually configure any language you need. Here's how:
- Navigate to Languages in your WordPress admin menu.
- Click the Add new language button.
- In the form that appears, do not select a language from the dropdown. Instead, fill in all the fields manually.
- Name: The full name you want to display (e.g., "English (AE)").
- Locale: This is the crucial WordPress locale (e.g.,
en_AE). You must use a valid locale that WordPress recognizes. You can find a list of locales on the WordPress Translate site. If your desired locale is not listed (likeen_AE), the admin and theme strings will fall back to a similar locale (likeen_US). - Language code: This is used in your site's URLs. It must be unique and can only contain lowercase letters, hyphens, and underscores. If you need multiple versions of the same base language, get creative! For a second English language, you could use codes like
en-ae,en-uk, oren-deto represent different regional contexts. - Complete the other fields like Text direction, Flag, and Order.
- Click Add new language to save.
Important Considerations
- The Locale field controls the language of your WordPress admin and which translation files are loaded for your theme and plugins. If you use a locale not supported by WordPress, those elements will not be translated.
- The Language code is primarily for generating clean URLs. Its value is flexible as long as it is unique.
- This process works the same for any language, whether it's a regional English variant, a specific Chinese dialect, or a less common language like Irish or Luxembourgish.
By manually configuring these settings, you can tailor Polylang to support virtually any language or regional requirement your website has, ensuring a truly localized experience for your visitors.
Related Support Threads Support
-
Set English language BUT with GB + UShttps://wordpress.org/support/topic/set-english-language-but-with-gb-us/
-
Chinese traditionnal and simplified ?https://wordpress.org/support/topic/chinese-traditionnal-and-simplified/
-
Google recaptcha with polylanghttps://wordpress.org/support/topic/google-recaptcha-with-polylang/
-
croatian languagehttps://wordpress.org/support/topic/croatian-language-3/
-
hook tag creationhttps://wordpress.org/support/topic/hook-tag-creation/
-
2 languages 2 websitehttps://wordpress.org/support/topic/2-languages-2-website/
-
Country tag in the URLhttps://wordpress.org/support/topic/country-tag-in-the-url/
-
Adding custom field to a language in the adminhttps://wordpress.org/support/topic/adding-custom-field-to-a-language-in-the-admin/
-
Different script based on languge when using Polyganghttps://wordpress.org/support/topic/different-script-based-on-languge-when-using-polygang/
-
Can I use en-AE with the plugin?https://wordpress.org/support/topic/can-i-use-en-ae-with-the-plugin/
-
Multiple languages source questionhttps://wordpress.org/support/topic/multiple-languages-source-question/
-
automatically generate pages in other languageshttps://wordpress.org/support/topic/automatically-generate-pages-in-other-languages/
-
Add languageshttps://wordpress.org/support/topic/add-languages-3/
-
Polylang admin languagehttps://wordpress.org/support/topic/polylang-admin-language/
-
How to add United Arab Emirates language to sitehttps://wordpress.org/support/topic/how-to-add-united-arab-emirates-language-to-site/
-
Unable to add language code es_419 in Polylanghttps://wordpress.org/support/topic/unable-to-add-language-code-es_419-in-polylang/
-
How to add a new language programmatically?https://wordpress.org/support/topic/how-to-add-a-new-language-programmatically/
-
Inserting different js script depending on chosen languagehttps://wordpress.org/support/topic/inserting-different-js-script-depending-on-chosen-language/
-
Polylang partial translation of content for shortcodehttps://wordpress.org/support/topic/polylang-partial-translation-of-content-for-shortcode/
-
How to add two identical languages when plugin asks for unique Language code?https://wordpress.org/support/topic/how-to-add-two-identical-languages-when-plugin-asks-for-unique-language-code/
-
Export one language from datasehttps://wordpress.org/support/topic/export-one-language-from-datase/
-
Idioma duplicadohttps://wordpress.org/support/topic/idioma-duplicado/
-
How to run a code for only one language?https://wordpress.org/support/topic/how-to-run-a-code-for-only-one-language/
-
Languages orderhttps://wordpress.org/support/topic/languages-order-2/
-
Meta Description for two languagehttps://wordpress.org/support/topic/meta-description-for-two-language/