Expose the Page Language to JavaScript
Adds a small window.wpideLang object with the current locale, language code and text direction, so your scripts can format dates, numbers or messages correctly without guessing.
Snippet Library
3,040 free snippets from the WPIDE team and the community. Copy the code, or add any snippet to your site in one click with WPIDE.
Adds a small window.wpideLang object with the current locale, language code and text direction, so your scripts can format dates, numbers or messages correctly without guessing.
Uses translations from a closely related language when the visitor's exact locale has none, for example German (Germany) files on a Swiss German site or Spanish (Spain) on a Mexican Spanish site, instead of falling back to English.
Starts calendars and date pickers on Sunday or Monday depending on the current language, instead of one fixed setting for every visitor.
Mirrors arrows, chevrons and other directional icons when the page is right-to-left, so "next" and "back" point the right way in Arabic, Hebrew and Persian.
Switches to fonts that cover the script of the page or block language, for example Arabic, Hebrew, Japanese, Chinese, Korean, Thai and Hindi, while keeping your theme font for Latin text.
Removes the language dropdown below the login form on sites that have extra languages installed.
Shows each user's chosen dashboard language in Users > All Users, which helps when you send emails or support in their language.
Adds a [wpide_wpml_switcher] shortcode that prints an accessible list or dropdown of your WPML languages, with native names, codes or flags, anywhere you can place a shortcode.
Adds a [wpide_wpml_link id="123"] shortcode that links to the translation of a page in the language being viewed, using that translation's title, so internal links never send visitors to the wrong language.
Looks for custom .mo files in wp-content/languages/custom/ before the official ones, so your edited translations of a plugin or theme survive updates.
Adds a [wpide_money] shortcode that formats an amount in a currency using the conventions of the current language, like $1,234.50, 1.234,50 € or ¥1,235.
Adds a [wpide_number] shortcode that prints a number with the thousands and decimal separators of the current language, for example 1,234.5 or 1.234,5.
Turns on Polylang translation for custom post types registered by your theme or a plugin, even when they do not appear in Languages > Settings.
Turns on Polylang translation for custom taxonomies, such as product types or event categories, that are not offered in Languages > Settings.
Adds a short notice above posts that WPML displays in the default language because no translation exists yet ("display as translated" mode), so visitors know why the text is not in their language.
Adds pll_language and pll_translations fields to posts and pages in the REST API, which Polylang's free version does not provide, so headless sites and apps can link translations.
Adds a [wpide_pll_switcher] shortcode that prints an accessible Polylang language list or dropdown anywhere, with flags, names or both.
Adds a "Translations" toolbar menu on posts and pages with links to edit each existing language version, plus links to create the missing ones.
Registers chosen Customizer text settings, such as footer copyright or a header phone number, in Polylang's string translations and shows the right translation in each language.
Adds or replaces the x-default hreflang link Polylang prints, pointing it at the language you choose so search engines know which version to show everyone else.
Lets administrators add ?wpide_rtl=1 to any URL to see the site and dashboard laid out right-to-left, so themes can be checked for Arabic or Hebrew without switching the site language.
Adds a language menu to the toolbar so each user can switch their own dashboard language in one click, using the languages installed on the site.
Sends visitors who land on the homepage to the matching language section (such as /fr/ or /de/) based on their browser language, once; their choice is then remembered.
Stops Fluent Forms submissions that are written mostly in Cyrillic, Chinese or another script your business does not receive genuine messages in.