psy Posted August 16, 2023 Share Posted August 16, 2023 (edited) I developed at multi-lang site in Australia with the default lang as English UK. One of the other lang choices was English US. It all worked perfectly until the live site was moved to a US host. Now the lang switcher (as per documentation) gets confused between the two. It appears to default to English UK but in reality is defaulting to English US. When using the lang switcher, it even gets the lang names & flags mixed up. It's also breaking some javascript. When the js tries to identify the English US lang via the URL, it simply cannot with the WireException "Unknown language". I've tried changing the SET_LOCAL and HTML to en_us with no effect. Other langs on the site work perfectly. Any and all suggestions on how to fix most welcome Solution: There were 3 things causing problems: 1. Typo from me in the default language title field. ?♀️ This resulted in the wrong language name displaying in the language switcher 2. My language names for English US and English UK did not match the name values in @Sebi fab AppApiPage.module resulting in "Language not found" for en-us. English UK being the default wasn't affected. Changed them to match, ie: $languageCodes = [ // 'en-gb' => 'english-united-kingdom', 'en-gb' => 'english-uk', // 'en-us' => 'english-united States', 'en-us' => 'english-us', ] 3. In @Wanze great SeoMaestro module, line 157 of the PageFieldValue.php class assumes that the language names are the language codes, eg en-us instead of English US resulting in incorrect alternate hreflang meta tags. I changed it to: // $code = $language->isDefault() ? $defaultLang : $language->name; $code = $language->isDefault() ? $defaultLang : $this->wire('pages')->get(1)->getLanguageValue($language, 'name'); Edited August 17, 2023 by psy Problem solved Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now