Why it matters
og:localetells Facebook, WhatsApp and other apps what language a shared page is in. Left at a theme's or plugin's default (en_US), an Arabic page is labelled English, which can change how an app shows it, translates it or offers it to people.- It is a different tag from
langand from hreflang: nothing fills it from them, so a page can be right in two places and wrong in the third. - An Open Graph locale is a language and a territory joined by an underscore, as Facebook documents (
ar_AR,ar_SA,en_US). A hyphen is not a value the apps expect.
Example
<meta property="og:locale" content="en_US" />
<meta property="og:locale" content="ar_SA" />
How to fix
Set og:locale to the page's language with an underscore:
html
<html lang="ar" dir="rtl">
<meta property="og:locale" content="ar_SA" />- Choose the territory your readers are in (
ar_SA,ar_AE,ar_EG…) orar_AR, the general Arabic locale. - In WordPress with an SEO plugin, set the site's language to Arabic: the plugin writes
og:localefrom it. On a platform, set the store's language; the theme writes the tag. - On a page with a translation, list it with
og:locale:alternate(en_US).
How we detect
- The page needs a
langon<html>and a non-emptyog:locale. - The
languagemessage: the language part of the two (before the hyphen or underscore, lowercase) is not the same. - The
formatmessage: the locale has a hyphen.