Skip to content

Conversation

@3ch023
Copy link
Contributor

@3ch023 3ch023 commented Jan 27, 2026

Resolves MWPW-185900

Locale changes in Studio & /mas/io

In acom and express

  • add en_GB and pt_PT in top nav
  • in acom, en_AU and en_IN are variations of en_GB, not en_US
  • in express only en_IN is a variation of en_GB, en_AU is not supported
  • user can no longer create en_GB variation of en_US

To retest in Studio:
Top nav, placeholders & creation of regional variations.

  • C1. Cover code with Unit Tests
  • C2. Add a Nala test (double check with #fishbags if nala test is needed)
  • C3. Verify all Checks are green (unit tests, nala tests)
  • C4. PR description contains working Test Page link where the feature can be tested
  • C5: you are ready to do a demo from Test Page in PR (bonus: write a working demo script that you'll use on Thursday, you can eventually put in your PR)
  • C.6 read your Jira one more time to validate that you've addressed all AC's and nothing is missing

Test URLs Studio:

en_GB&acom (sandbox,nala) - becomes 'default lang'

pt_BR&acom - becomes 'default lang'

pt_PT&acom - becomes 'default lang'

pt_PT&ccd - stay 'variation lang' of pt_BR

corner case - variation language fr_LU&acom:

Test URLs /mas/io:

CCD gallery (Nala rules are same as acom)

There is not content in en_GB, so before it was falling back to en_US. Now its a default language so it will 404.

en_IN and en_AU fallback to en_GB, so 404
https://main--mas--adobecom.aem.live/web-components/docs/ccd.html?locale=en_IN&mas-io-url=https://14257-merchatscale-3ch023.adobeioruntime.net/api/v1/web/MerchAtScale
https://main--mas--adobecom.aem.live/web-components/docs/ccd.html?locale=en_AU&mas-io-url=https://14257-merchatscale-3ch023.adobeioruntime.net/api/v1/web/MerchAtScale

en_KW falls back to en_US, so 200
https://main--mas--adobecom.aem.live/web-components/docs/ccd.html?locale=en_KW&mas-io-url=https://14257-merchatscale-3ch023.adobeioruntime.net/api/v1/web/MerchAtScale

corner case - bu_BU unexisting locale - 404

@aem-code-sync
Copy link

aem-code-sync bot commented Jan 27, 2026

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

@3ch023 3ch023 changed the title MWPW-185900: MWPW-185900: refactor locales structure Jan 27, 2026
@3ch023 3ch023 marked this pull request as ready for review February 2, 2026 11:55
Copy link
Contributor

@npeltier npeltier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • code feedbacks are mostly comments
  • expected results in tests things i actually request to change

regionLocalesCache[cacheKey] = LOCALES.filter((locale) =>
isRegionLocale(locale, surface, language, includeDefault),
).sort((a, b) => getCountryName(a.country).localeCompare(getCountryName(b.country)));
const [lang, country] = localeCode.split('_');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know it's a simple operation, but i would still factorize localeCode -> [lang, country] code somewhere in this file (you are using it l423 too)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines 14 to 17
function getCorrespondingLocale(surface, locale) {
const defaultLocale = getDefaultLocaleCode(surface, locale);
return defaultLocale || locale;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove this, and just use getDefaultLocaleCode? to me that corresponding wording (i created) just introduces confusion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i just need to test it via customized method then
reason why i kept this method was that its easy for unit test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

});
});

it('should return 503 if language is not supported', async function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, it should return 400 or 403 depending how we want to phrase it, but it's not a server error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

const locale = getCorrespondingLocale('zh_TW');
expect(locale).to.equal('zh_TW');
describe('corresponding locale corner case', function () {
it('locale with no default should be returned as is', async function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming we remove getCorrespondingLocale and just keep default one. I think we should in here just return null: there is not default locale for bb_BB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -19,14 +19,10 @@ export class EditorContextStore extends ReactiveStore {
if (!fragmentPath) return { isVariation: false, defaultLocale: null };
const pathMatch = fragmentPath.match(/\/content\/dam\/mas\/[^/]+\/([^/]+)\//);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could probably extract logic from io/www fetchFragment here too

Comment on lines +165 to +173
handleMenuOpen() {
this.updateComplete.then(() => {
const search = this.shadowRoot.querySelector('sp-search');
if (search) {
search.focus();
}
});
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not related to that PR but ok

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was hard to test it without this :D

Copy link
Contributor

@npeltier npeltier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

return { status, message };
}
const baseFragment = skimFragmentFromReferences(body);
//todo check
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add more details to this todo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants