Only overwrite languageId when requested - #388
Conversation
| if (oslo.collection) { | ||
| languageId = supportedLocalesDetails.find(l => l.code === osloLang || l.pack === osloLang)?.id; | ||
| const doc = document.documentElement; | ||
| if (doc.hasAttribute('data-custom-lang') && oslo.collection) { |
There was a problem hiding this comment.
The attribute will come from https://github.com/Brightspace/lms/pull/89913
There was a problem hiding this comment.
I'm confused... where do data-custom-lang and data-language-id get set? That linked PR is just emptying out data-custom-lang in content pages.
There was a problem hiding this comment.
It's a boolean. Empty string sets the attribute. delete is what removes it.
There was a problem hiding this comment.
And data-language-id would be set by an author on their content in edge cases.
There was a problem hiding this comment.
We talked about this offline -- on the same page now.
106d9e4 to
879cd05
Compare
| languageId = supportedLocalesDetails.find(l => l.code === osloLang || l.pack === osloLang)?.id; | ||
| const doc = document.documentElement; | ||
| if (doc.hasAttribute('data-custom-lang') && oslo.collection) { | ||
| languageId = Number(doc.dataset.languageId) || supportedLocalesDetails.find(l => l.code === osloLang || l.pack === osloLang)?.id; |
There was a problem hiding this comment.
This allows content authors to declare a preferred (custom) languageId that will be respected regardless of any locale code confusion
| if (oslo.collection) { | ||
| languageId = supportedLocalesDetails.find(l => l.code === osloLang || l.pack === osloLang)?.id; | ||
| const doc = document.documentElement; | ||
| if (doc.hasAttribute('data-custom-lang') && oslo.collection) { |
There was a problem hiding this comment.
We talked about this offline -- on the same page now.
|
🎉 This PR is included in version 3.40.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
GAUD-10152: OSLO > Custom languages are not resolved via oslo - falls back to parent language
In order for OSLO to pull down custom langpacks that use (via a custom locale) locale codes that we already support, we need to limit overwriting the
languageId. Currently we always check if there is a mismatch between the document language and the OSLOlanguageId. With a custom langpack/locale, this mismatch could be intentional.