Skip to content

Conversation

@npeltier
Copy link
Contributor

@npeltier npeltier commented Dec 16, 2025

  • move all locale related logic & constants to locales.js file, including a big(ger) LOCALES object containing wether a locale for a given surface should be considered default or regional,
  • merge all locale pickers (but the mas-variation-creation dialog) to one mas-locale-picker, that can do both top navigation (default languages), and regional ones,
  • add unit tests,
  • make work with recent fragment changes, including create variation & fragment editor,
  • in placeholders change duplicate locale selector to a region selector to be able to edit regional overrides,
  • in copy to sandbox / nala us new picker too

Resolves https://jira.corp.adobe.com/browse/MWPW-181321
QA Checklist: https://wiki.corp.adobe.com/display/adobedotcom/M@S+Engineering+QA+Use+Cases

Please do the steps below before submitting your PR for a code review or QA

  • 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

🧪 Nala E2E Tests

Nala tests run automatically when you open this PR.

To run Nala tests again:

  1. Add the run nala label to this PR (in the right sidebar)
  2. Tests will run automatically on the current commit
  3. Any future commits will also trigger tests as long as the label remains

To stop automatic Nala tests:

  • Remove the run nala label

Note: Tests only run on commits if the run nala label is present. Add the label whenever you need tests to run on new changes.

Test URLs:

@aem-code-sync
Copy link

aem-code-sync bot commented Dec 16, 2025

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


handleLocaleChange(locale) {
this.locale = locale;
this.dispatchEvent(
Copy link
Contributor

Choose a reason for hiding this comment

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

updating a Store value would be an option here.
handling events is more verbose.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i didn't want store logic to be within the component, typically the same component is used for different purposes, with different stores update

Copy link
Contributor

Choose a reason for hiding this comment

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

You are right, I thought about it after I commented as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i thought about your comment though :-p and i could pass in an "abstract" store to the component that the later blindly updates. It would save some lines of code, but the event based setup is kind of clear to read imo

@npeltier
Copy link
Contributor Author

note a separate ticket has been tracked for flag icons (for now emoticons) https://jira.corp.adobe.com/browse/MWPW-185464

@npeltier
Copy link
Contributor Author

will try to fix nala tests

Copy link
Contributor

@honstar honstar left a comment

Choose a reason for hiding this comment

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

Found one issue, the rest LGTM.

@afmicka
Copy link
Collaborator

afmicka commented Dec 18, 2025

@npeltier

  1. Should the locale in the URL also change when the region is changed? For now it stays on the first language locale. In the table will be the correct locale once region is changed, but not in the url, can be confusing and also not possible to go directly to the placeholders in the specific locale via url
Screenshot 2025-12-18 at 14 23 03
  1. The languages and regions do not have alphabetical order (or is there a logic?). English is not at the top, but also not in alphabetical order. I guess the languages are sorted by the abbreviation in the brackets, not by the word :D but still no order. These Chinese are added at the very bottom, so also not easy to find. The region menu starts with the UAE (maybe better United States if we are not keeping them sorted)
Screenshot 2025-12-18 at 14 20 01 Screenshot 2025-12-18 at 14 41 25
  1. The table view (render as well) do not have indication of the region. How do one access the fragments in the specific region?

  2. As part of the previous one, when user creates regional variation in lets say EG_en, saves it and clicks on Fragments table, the user is led to the content page in EG_en locale (loads only fragments in that region) but no indication where exactly you are. There is language picker indicating the language, but no country whatsoever, not even in the table. Only by the price currency you could say that you are in some other country (but still don't know which one)

Screenshot 2025-12-18 at 15 12 21

@npeltier
Copy link
Contributor Author

@afmicka

Should the locale in the URL also change when the region is changed? For now it stays on the first language locale. In the table will be the correct locale once region is changed, but not in the url, can be confusing and also not possible to go directly to the placeholders in the specific locale via url

no, locale in the url is bound to top right language section, so when you change region (placeholder or fragment variation), this should stay the same

The languages and regions do not have alphabetical order (or is there a logic?). English is not at the top, but also not in alphabetical order. I guess the languages are sorted by the abbreviation in the brackets, not by the word :D but still no order. These Chinese are added at the very bottom, so also not easy to find. The region menu starts with the UAE (maybe better United States if we are not keeping them sorted)

this should be fixed (alphabetical sort of language/region labels)

The table view (render as well) do not have indication of the region. How do one access the fragments in the specific region?

only through the variation table of a given fragment

As part of the previous one, when user creates regional variation in lets say EG_en, saves it and clicks on Fragments table, the user is led to the content page in EG_en locale (loads only fragments in that region) but no indication where exactly you are. There is language picker indicating the language, but no country whatsoever, not even in the table. Only by the price currency you could say that you are in some other country (but still don't know which one)

this should be fixed

@afmicka
Copy link
Collaborator

afmicka commented Dec 19, 2025

@npeltier without region, the prices on regional variations are in default language/country. For english for example, every country (Argentina, Egypt, etc) has prices in US dollars instead of local currency when you edit them
Screenshot 2025-12-19 at 09 26 25

Also, after creating this AU variation, i go back to Fragments table. It lands me back to default language table (meaning or suggesting to the user that they are back to en_US), but if i click placeholders, it is landing me on en_AU (with selected region). This is misleading experience, not to know in every moment where i am exactly and what am i looking at

Then being in AU region, i clicked to change the region to US since i wanted to be there in the first place, i got "could not load the placeholders" toast and stayed on AU one

Screenshot 2025-12-19 at 09 32 11

@npeltier
Copy link
Contributor Author

@afmicka fixed currency & region state cleanup

@afmicka
Copy link
Collaborator

afmicka commented Dec 19, 2025

@npeltier prices are still in US$ in the editor for existing variations. Only preview is fixed
Screenshot 2025-12-19 at 13 43 19

const masService = getService();
masService.setAttribute('locale', Store.localeOrRegion());
masService.activate();
document.querySelectorAll('mas-commerce-service').forEach((el) => el.remove());
Copy link
Contributor

Choose a reason for hiding this comment

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

there should be only one mas-commerce-service

masService.setAttribute('locale', Store.localeOrRegion());
masService.activate();
document.querySelectorAll('mas-commerce-service').forEach((el) => el.remove());
const masServiceElement = document.createElement('mas-commerce-service');
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of doing this, I recommend to cause a re-render of the shadow dom.
ideally, the locale should be a store value.
when updated, a subscription updates the mas-commerce-service
and observer mas-fragment-editor.js would re-render after it.
assuming subscription is registered earlier.

@npeltier
Copy link
Contributor Author

hi @afmicka the last issues we talked about offline are due to mismatch between what is defined in "locales", and what is defined in www/io that has partial (and sometimes different) version of possible default language, see the list:
'ar_MENA',
'bg_BG',
'cs_CZ',
'da_DK',
'de_DE',
'el_GR',
'en_US',
'es_ES',
'et_EE',
'fi_FI',
'fil_PH',
'fr_FR',
'he_IL',
'hi_IN',
'hu_HU',
'id_ID',
'it_IT',
'ja_JP',
'ko_KR',
'lt_LT',
'lv_LV',
'ms_MY',
'nl_NL',
'nb_NO',
'pt_BR',
'ru_RU',
'sk_SK',
'sl_SI',
'sv_SE',
'th_TH',
'tr_TR',
'uk_UA',
'vi_VN',

for now i see ar_MENA that should be updated to ar_SA to make things work (i tested locally) and this works, but it would not be a RCP change anymore. Up to you to wait for RCP and do the change in same PR, or to merge it now, and fix this separately

@afmicka
Copy link
Collaborator

afmicka commented Dec 22, 2025

@npeltier there are some conflicts. Could you please resolve them?
I am also not able to create fragment at all in AR(SA) today on Nala surface. I can create it in sandbox, but not in Nala. Therefore, can't write the nala test that we have discussed (i can in other locales but since AR is the one broken, would be good to have it there). We may want to add it with the follow-up PR where it is going to be fixed or write it for some other locale now.

@npeltier
Copy link
Contributor Author

@afmicka done! yes AR will be broken until fast follow PR. Can we make the nala test not using that (non prod yet) language for now?

@afmicka
Copy link
Collaborator

afmicka commented Dec 24, 2025

@npeltier i have added one Nala test for creating fragment from the scratch (covers fragment missing/undefined issue). However, this test is flaky on prod too. The same thing happens occasionally and only in automation. I am not able to reproduce it manually on prod. The difference with your branch is that the bug is there consistently and is reproducible manually every time (basically making it worse).

For creating variation i need a bit of more work because i need to change the cleanup scripts too to clean those locales, beside new methods, etc. I would rather add those tests as a separate PR/jira. I am not sure i can make it on time before PTO but if i do, then you will be able to pull it in. The main issue i have is that cleanup script is not able to delete fragment in en_AU on prod (error 409). When i tried to use the force delete, then the fragment was deleted but apparently not the link somewhere in the backend. There is no variation on the main screen, there is no variation in en_AU locale either but the modal says it exists and i can't create it again (is it possible to fix it somehow now? :)
https://mas.adobe.com/studio.html#page=content&path=nala&query=45e50a68-9bd7-4fc2-9665-12f39140a1be

Screenshot 2025-12-24 at 19 25 10

the same methods i added to this branch, i will need and use in that separate PR as well and refactor

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants