Localize buttons makes them squared inside group

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

schroef
Posts: 33
Joined: Sat Apr 11, 2020 6:22 am

Localize buttons makes them squared inside group

Post by schroef »

Im updating this CEP panel which has many script and a couple dialog windows. Ive started now adding localize to it and notice some weird behavior which i can find in the resources ive found.

The "issue" im seeing is that when buttons have hard-coded text, defined when they are created. Buttons show with round borders. When i use localize and they are placed inside a group, they get squared off in the corners. But when it uses English they show with rounded corners.
buttons inside groups squared dutch

Ive got an example script here. Its perhaps hard to test since you need to have Photoshop with different languages installed. Ive installed different languages by copying the packs when you install the app. Some are old so i guess its misses some parts.

Do you perhaps have knowledge of this? Is this normal behavior of buttons inside a group?
I see this happening on Windows by the way, OSX doesnt show this.

Ive looked in the Javscript toolguide, the ScriptUI for dummies by Peter Kahrel, tried PS-Script.com (nothing found yet)

Code: Select all

// enable double clicking from the Finder or Explorer
#target photoshop

//Make Photoshop the front most application
app.bringToFront();

// Javascript toolsguide cs5
var locCancelBtn = {
    en: "Cancel",
    es: "Cancelar",
    fr: "XXXXXXXXX",
    nl: "Annuleer",
    ch: "XXXXXXXX"
};
testLbl = {
    en: "Test",
    nl: "Testen"
};
$.localization = true;

var dlg = new Window("dialog", "Alert Box Builder");
    btnPnl = dlg.add("panel", undefined, "Build it");

var testBtn = btnPnl.add("button", undefined,  localize(testBtn), {
    name: "test"
});
var buildBtn = btnPnl.add("button", undefined, "Build", {
    name: "ok"
});
var cancelBtn = btnPnl.add("button", undefined, "Cancel", {
    name: "cancel"
});
// BUTTONGROUP
    // ===========
    var buttonGroup = dlg.add("group", undefined, {name: "buttonGroup"}); 
        // buttonGroup.orientation = "row"; 
        // buttonGroup.alignChildren = ["right","center"]; 
        // buttonGroup.spacing = 8; 
        // buttonGroup.margins = [0,10,0,0]; 
        // buttonGroup.alignment = ["fill","top"]; 
var testBtn = buttonGroup.add("button", undefined,  localize(testLbl), {
    name: "test"
});
var buildBtn = buttonGroup.add("button", undefined, "Build", {
    name: "ok"
});
var cancelBtn = buttonGroup.add("button", undefined, "Cancel", {
    name: "cancel"
});
dlg.show();
Attachments
buttons inside groups squared dutch.png
buttons inside groups squared dutch.png (8.97 KiB) Viewed 25244 times

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

schroef
Posts: 33
Joined: Sat Apr 11, 2020 6:22 am

Re: Localize buttons makes them squared inside group

Post by schroef »

What ive found this far is the first buttons which are assigned as ok and cancel seem to be getting rounded. When i comment out that first panel, then i do see other buttons getting rounded as well
hide-panel-rounds-otherbuttons.png
hide-panel-rounds-otherbuttons.png (5.12 KiB) Viewed 25243 times
When i set the last buttons to be ok and cancel, then those get rounded. Seem like its some behavior to show the dialog buttons i guess.

Code: Select all

var buildenBtn = buttonGroup.add("button", undefined, "Build", {
    name: "ok"
});
var cancelenBtn = buttonGroup.add("button", undefined, "Cancel", {
    name: "cancel"
});
var testenBtn = dialogButtons.add("button", undefined,  "Ok", {
    name: "ok"
});
make last buttons ok and cancel.png
make last buttons ok and cancel.png (7.57 KiB) Viewed 25243 times
User avatar
Kukurykus
Posts: 531
Joined: Mon Jul 25, 2016 12:36 pm

Re: Localize buttons makes them squared inside group

Post by Kukurykus »

When you remove {name: 'name'} part they all should be square.
schroef
Posts: 33
Joined: Sat Apr 11, 2020 6:22 am

Re: Localize buttons makes them squared inside group

Post by schroef »

Well my goal was to make the buttons which are the main dialog buttons stay rounded. ive noticed there is something about the naming doing this as well. But i see different buttons in say the preferences dialog of photoshop have more buttons rounded.

Ive now used ok and cancel for name in those buttons and they stay now rounded, also when i use localization. I also asked this on the github of SciptUI from Joonas, he also doesnt really fully know how this part works.

its also not consistent between adobe apps like illustrator and indesign. In those apps all buttons are always rounded

Here's a link to that github issue; https://github.com/joonaspaakko/ScriptU ... /issues/96
duenalexander
Posts: 2
Joined: Mon May 05, 2025 4:27 am

Re: Localize buttons makes them squared inside group

Post by duenalexander »

schroef wrote: Sat Jan 15, 2022 8:14 pm Im updating this CEP panel which has many script and a couple dialog windows. Ive started now adding localize to it and notice some weird behavior which i can find in the resources ive found.

The "issue" im seeing is that when buttons have hard-coded text, defined when they are created. Buttons show with round borders. When i use localize and they are placed inside a group, they get squared off in the corners. But when it uses English they show with rounded corners.
buttons inside groups squared dutch

Ive got an example script here. Its perhaps hard to test since you need to have Photoshop with different languages installed. Ive installed different languages by copying the packs when you install the app. Some are old so i guess its misses some parts.

Do you perhaps have knowledge of this? Is this normal behavior of buttons inside a group?
I see this happening on Windows by the way, OSX doesnt show this.

Ive looked in the Javscript toolguide, the ScriptUI for dummies by Peter Kahrel, tried PS-Script.com (nothing found yet)
rice purity test

Code: Select all

// enable double clicking from the Finder or Explorer
#target photoshop

//Make Photoshop the front most application
app.bringToFront();

// Javascript toolsguide cs5
var locCancelBtn = {
    en: "Cancel",
    es: "Cancelar",
    fr: "XXXXXXXXX",
    nl: "Annuleer",
    ch: "XXXXXXXX"
};
testLbl = {
    en: "Test",
    nl: "Testen"
};
$.localization = true;

var dlg = new Window("dialog", "Alert Box Builder");
    btnPnl = dlg.add("panel", undefined, "Build it");

var testBtn = btnPnl.add("button", undefined,  localize(testBtn), {
    name: "test"
});
var buildBtn = btnPnl.add("button", undefined, "Build", {
    name: "ok"
});
var cancelBtn = btnPnl.add("button", undefined, "Cancel", {
    name: "cancel"
});
// BUTTONGROUP
    // ===========
    var buttonGroup = dlg.add("group", undefined, {name: "buttonGroup"}); 
        // buttonGroup.orientation = "row"; 
        // buttonGroup.alignChildren = ["right","center"]; 
        // buttonGroup.spacing = 8; 
        // buttonGroup.margins = [0,10,0,0]; 
        // buttonGroup.alignment = ["fill","top"]; 
var testBtn = buttonGroup.add("button", undefined,  localize(testLbl), {
    name: "test"
});
var buildBtn = buttonGroup.add("button", undefined, "Build", {
    name: "ok"
});
var cancelBtn = buttonGroup.add("button", undefined, "Cancel", {
    name: "cancel"
});
dlg.show();
It sounds like you're encountering a common issue with how ScriptUI handles button styling based on localization. The squared corners for localized buttons inside a group could be a quirk of the language packs or how the UI elements are rendered in different languages. Since it seems to be specific to Windows, it might be worth checking for any updates or patches for your Photoshop installation that address this behavior. Additionally, experimenting with different panel settings or styles could help achieve a more consistent look across languages.
User avatar
Scriptor
Posts: 32
Joined: Tue Oct 01, 2019 12:07 pm

Re: Localize buttons makes them squared inside group

Post by Scriptor »

I recommend using this tool for styling, then placing your code in/around the dialouge as you see fit:
https://scriptui.joonas.me/

Makes the whole process much more efficient.
Alex_Builder.png
Alex_Builder.png (1.45 MiB) Viewed 971 times