Skip to content

Commit e4925a3

Browse files
akashcheAlexey Semenyuk
authored and
Alexey Semenyuk
committed
8291924: jpackage: l10n for Windows context menu label
Reviewed-by: naoto, asemenyuk, almatvee
1 parent 7b029ea commit e4925a3

File tree

7 files changed

+18
-2
lines changed

7 files changed

+18
-2
lines changed

src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixAppImageFragmentBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ private List<String> addFaComponents(XMLStreamWriter xml,
528528

529529
xml.writeStartElement("Verb");
530530
xml.writeAttribute("Id", "open");
531-
xml.writeAttribute("Command", "Open");
531+
xml.writeAttribute("Command", "!(loc.ContextMenuCommandLabel)");
532532
xml.writeAttribute("Argument", "\"%1\" %*");
533533
xml.writeAttribute("TargetFile", Id.File.of(fa.launcherPath));
534534
xml.writeEndElement(); // <Verb>

src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_de.wxl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
<String Id="ShortcutPromptDlgDesktopShortcutControlLabel">Desktopverknüpfung(en) erstellen</String>
1313
<String Id="ShortcutPromptDlgStartMenuShortcutControlLabel">Startmenüverknüpfung(en) erstellen</String>
1414
<String Id="InstallDirNotEmptyDlg_Title">[ProductName]-Setup</String>
15+
<String Id="ContextMenuCommandLabel">Open with [ProductName]</String>
1516
</WixLocalization>

src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_en.wxl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
<String Id="ShortcutPromptDlgDesktopShortcutControlLabel">Create desktop shortcut(s)</String>
1313
<String Id="ShortcutPromptDlgStartMenuShortcutControlLabel">Create start menu shortcut(s)</String>
1414
<String Id="InstallDirNotEmptyDlg_Title">[ProductName] Setup</String>
15+
<String Id="ContextMenuCommandLabel">Open with [ProductName]</String>
1516
</WixLocalization>

src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_ja.wxl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
<String Id="ShortcutPromptDlgDesktopShortcutControlLabel">デスクトップ・ショートカットの作成</String>
1313
<String Id="ShortcutPromptDlgStartMenuShortcutControlLabel">スタート・メニューのショートカットの作成</String>
1414
<String Id="InstallDirNotEmptyDlg_Title">[ProductName]セットアップ</String>
15+
<String Id="ContextMenuCommandLabel">Open with [ProductName]</String>
1516
</WixLocalization>

src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/MsiInstallerStrings_zh_CN.wxl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
<String Id="ShortcutPromptDlgDesktopShortcutControlLabel">创建桌面快捷方式</String>
1313
<String Id="ShortcutPromptDlgStartMenuShortcutControlLabel">创建开始菜单快捷方式</String>
1414
<String Id="InstallDirNotEmptyDlg_Title">[ProductName] 安装程序</String>
15+
<String Id="ContextMenuCommandLabel">Open with [ProductName]</String>
1516
</WixLocalization>

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,18 @@ PackageTest addHelloAppFileAssociationsVerifier(FileAssociations fa) {
283283
HelloApp.verifyOutputFile(appOutput, expectedArgs,
284284
Collections.emptyMap());
285285
});
286+
287+
if (TKit.isWindows()) {
288+
// Verify context menu label in registry.
289+
String progId = WindowsHelper.queryRegistryValue(
290+
String.format("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\%s", fa.getSuffix()), "");
291+
TKit.assertNotNull(progId, "context menu progId found");
292+
String contextMenuLabel = WindowsHelper.queryRegistryValue(
293+
String.format("HKEY_CLASSES_ROOT\\%s\\shell\\open", progId), "");
294+
TKit.assertNotNull(contextMenuLabel, "context menu label found");
295+
String appName = cmd.getArgumentValue("--name");
296+
TKit.assertTrue(String.format("Open with %s", appName).equals(contextMenuLabel), "context menu label text");
297+
}
286298
});
287299

288300
return this;

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/WindowsHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ private void verifyFileAssociations(boolean exists, String suffix,
356356
private final String name;
357357
}
358358

359-
private static String queryRegistryValue(String keyPath, String valueName) {
359+
static String queryRegistryValue(String keyPath, String valueName) {
360360
var status = Executor.of("reg", "query", keyPath, "/v", valueName)
361361
.saveOutput()
362362
.executeWithoutExitCodeCheck();

0 commit comments

Comments
 (0)