Trying to translate menu items on a panel

I’ve built my html for a UXP panel for Photoshop with placeholder text. In the panel show function I’m reading translations from a file and then poking those into the textContent of each sp-label or sp-menu-item element.

This approach works fine with modal dialogs, presumably because all the text is amended before calling uxpShowModal. And it works fine for sp-label fields in a panel. But it doesn’t work well for items within a menu. If I drop down the menu I can see the options have been translated, but the value shown when the menu is not opened is the placeholder text.

In this example the upper-case ‘AUTO’ is placeholder text and the picker is dropped down below it. The translation ‘Auto’ is clearly selected, but just releasing the drop-down does not change the ‘AUTO’ to ‘Auto’.

image

In case it’s relevant I’m using sp-menu-item inside sp-menu, inside sp-picker.

I’ve tried doing this replacement in a panel create or show function, or in a plugin create function, all specified in entrypoints.setup. They all fail in the same way.

If I walk the sp-picker item in UDT the innerHTML and textContent for all elements looks correct. I’m guessing that this is a caching issue of some kind, but I have not been able to find any way around it. Any suggestions as to what I’m missing here, or how to dynamically add the translations some other way?

As always, the best way to solve a problem is to give up and ask for help …

I’d already tried building the HTML for the sp-menu and its children and poking that as innerHTML into the picker.

Just now I built the HTML for the sp-picker, sp-menu and children and poked it as outerHTML into the picker.

Bingo, it’s working :slight_smile:

Sorry to waste your time!