Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8338918: Remove non translated file name from WinResources resource bundle #21100

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 42 additions & 14 deletions src/jdk.jpackage/share/classes/jdk/jpackage/internal/I18N.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,36 +24,64 @@
*/
package jdk.jpackage.internal;

import java.util.ArrayList;
import java.util.List;
import java.util.ListResourceBundle;
import java.util.Map;
import jdk.internal.util.OperatingSystem;

import java.util.ResourceBundle;
import static java.util.stream.Collectors.toMap;
import java.util.stream.Stream;

class I18N {

static String getString(String key) {
if (PLATFORM.containsKey(key)) {
return PLATFORM.getString(key);
}
return SHARED.getString(key);
return BUNDLE.getString(key);
}

private static final ResourceBundle SHARED = ResourceBundle.getBundle(
"jdk.jpackage.internal.resources.MainResources");
private static class MultiResourceBundle extends ListResourceBundle {

MultiResourceBundle(ResourceBundle... bundles) {
contents = Stream.of(bundles).map(bundle -> {
return bundle.keySet().stream().map(key -> {
return Map.entry(key, bundle.getObject(key));
});
}).flatMap(x -> x).collect(toMap(Map.Entry::getKey, Map.Entry::getValue, (o, n) -> {
// Override old value with the new one
return n;
})).entrySet().stream().map(e -> {
return new Object[]{e.getKey(), e.getValue()};
}).toArray(Object[][]::new);
}

@Override
protected Object[][] getContents() {
return contents;
}

private final Object[][] contents;
}

private static final ResourceBundle PLATFORM;
private final static MultiResourceBundle BUNDLE;
alexeysemenyukoracle marked this conversation as resolved.
Show resolved Hide resolved

static {
List<String> bundleNames = new ArrayList<>();

bundleNames.add("jdk.jpackage.internal.resources.MainResources");

if (OperatingSystem.isLinux()) {
PLATFORM = ResourceBundle.getBundle(
"jdk.jpackage.internal.resources.LinuxResources");
bundleNames.add("jdk.jpackage.internal.resources.LinuxResources");
} else if (OperatingSystem.isWindows()) {
PLATFORM = ResourceBundle.getBundle(
"jdk.jpackage.internal.resources.WinResources");
bundleNames.add("jdk.jpackage.internal.resources.WinResources");
bundleNames.add("jdk.jpackage.internal.resources.WinResourcesNoL10N");
} else if (OperatingSystem.isMacOS()) {
PLATFORM = ResourceBundle.getBundle(
"jdk.jpackage.internal.resources.MacResources");
bundleNames.add("jdk.jpackage.internal.resources.MacResources");
} else {
throw new IllegalStateException("Unknown platform");
}

BUNDLE = new MultiResourceBundle(bundleNames.stream().map(ResourceBundle::getBundle)
.toArray(ResourceBundle[]::new));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ resource.setup-icon=setup dialog icon
resource.post-app-image-script=script to run after application image is populated
resource.post-msi-script=script to run after msi file for exe installer is created
resource.wxl-file=WiX localization file
resource.wxl-file-name=MsiInstallerStrings_en.wxl
resource.main-wix-file=Main WiX project file
resource.overrides-wix-file=Overrides WiX project file
resource.shortcutpromptdlg-wix-file=Shortcut prompt dialog WiX project file
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#


resource.wxl-file-name=MsiInstallerStrings_en.wxl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#


resource.wxl-file-name=MsiInstallerStrings_de.wxl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#


resource.wxl-file-name=MsiInstallerStrings_ja.wxl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#


resource.wxl-file-name=MsiInstallerStrings_zh_CN.wxl
Original file line number Diff line number Diff line change
Expand Up @@ -30,46 +30,45 @@ msi.bundler.name=MSI-Installationsprogrammpackage

param.menu-group.default=Unbekannt

resource.executable-properties-template=Vorlage für das Erstellen der ausführbaren Eigenschaftendatei
resource.setup-icon=Symbol für Dialogfeld "Setup"
resource.post-app-image-script=Auszuführendes Skript nach dem Auffüllen des Anwendungsimages
resource.post-msi-script=Auszuführendes Skript nach dem Erstellen der MSI-Datei für das EXE-Installationsprogramm
resource.executable-properties-template=Vorlage f�r das Erstellen der ausf�hrbaren Eigenschaftendatei
alexeysemenyukoracle marked this conversation as resolved.
Show resolved Hide resolved
resource.setup-icon=Symbol f�r Dialogfeld "Setup"
resource.post-app-image-script=Auszuf�hrendes Skript nach dem Auff�llen des Anwendungsimages
resource.post-msi-script=Auszuf�hrendes Skript nach dem Erstellen der MSI-Datei f�r das EXE-Installationsprogramm
resource.wxl-file=WiX-Lokalisierungsdatei
resource.wxl-file-name=MsiInstallerStrings_de.wxl
resource.main-wix-file=Haupt-WiX-Projektdatei
resource.overrides-wix-file=Überschreibt WiX-Projektdatei
resource.shortcutpromptdlg-wix-file=Dialogfeld für Verknüpfungs-Prompt der WiX-Projektdatei
resource.installdirnotemptydlg-wix-file=Nicht leeres Installationsverzeichnis in Dialogfeld für WiX-Projektdatei
resource.launcher-as-service-wix-file=WiX-Projektdatei für Serviceinstallationsprogramm
resource.overrides-wix-file=�berschreibt WiX-Projektdatei
resource.shortcutpromptdlg-wix-file=Dialogfeld f�r Verkn�pfungs-Prompt der WiX-Projektdatei
resource.installdirnotemptydlg-wix-file=Nicht leeres Installationsverzeichnis in Dialogfeld f�r WiX-Projektdatei
resource.launcher-as-service-wix-file=WiX-Projektdatei f�r Serviceinstallationsprogramm
resource.wix-src-conv=XSLT stylesheet converting WiX sources from WiX v3 to WiX v4 format

error.no-wix-tools=Can not find WiX tools. Was looking for WiX v3 light.exe and candle.exe or WiX v4/v5 wix.exe and none was found
error.no-wix-tools.advice=Laden Sie WiX 3.0 oder höher von https://wixtoolset.org herunter, und fügen Sie es zu PATH hinzu.
error.version-string-wrong-format.advice=Setzen Sie den Wert des --app-version-Parameters auf eine gültige ProductVersion des Windows-Installationsprogramms.
error.no-wix-tools.advice=Laden Sie WiX 3.0 oder h�her von https://wixtoolset.org herunter, und f�gen Sie es zu PATH hinzu.
error.version-string-wrong-format.advice=Setzen Sie den Wert des --app-version-Parameters auf eine g�ltige ProductVersion des Windows-Installationsprogramms.
error.msi-product-version-components=Versionszeichenfolge [{0}] muss zwischen 2 und 4 Komponenten aufweisen.
error.msi-product-version-major-out-of-range=Hauptversion muss im Bereich [0, 255] liegen
error.msi-product-version-build-out-of-range=Build-Teil der Version muss im Bereich [0, 65535] liegen
error.msi-product-version-minor-out-of-range=Nebenversion muss im Bereich [0, 255] liegen
error.version-swap=Versionsinformationen für {0} konnten nicht aktualisiert werden
error.icon-swap=Symbol für {0} konnte nicht aktualisiert werden
error.invalid-envvar=Ungültiger Wert der {0}-Umgebungsvariable
error.version-swap=Versionsinformationen f�r {0} konnten nicht aktualisiert werden
error.icon-swap=Symbol f�r {0} konnte nicht aktualisiert werden
error.invalid-envvar=Ung�ltiger Wert der {0}-Umgebungsvariable
error.lock-resource=Sperren nicht erfolgreich: {0}
error.unlock-resource=Aufheben der Sperre nicht erfolgreich: {0}
error.read-wix-l10n-file=Datei {0} konnte nicht geparst werden
error.extract-culture-from-wix-l10n-file=Kulturwert konnte nicht aus Datei {0} gelesen werden

message.icon-not-ico=Das angegebene Symbol "{0}" ist keine ICO-Datei und wird nicht verwendet. Stattdessen wird das Standardsymbol verwendet.
message.potential.windows.defender.issue=Warnung: Windows Defender verhindert eventuell die korrekte Ausführung von jpackage. Wenn ein Problem auftritt, deaktivieren Sie das Echtzeitmonitoring, oder fügen Sie einen Ausschluss für das Verzeichnis "{0}" hinzu.
message.outputting-to-location=EXE für Installationsprogramm wird generiert in: {0}.
message.potential.windows.defender.issue=Warnung: Windows Defender verhindert eventuell die korrekte Ausf�hrung von jpackage. Wenn ein Problem auftritt, deaktivieren Sie das Echtzeitmonitoring, oder f�gen Sie einen Ausschluss f�r das Verzeichnis "{0}" hinzu.
message.outputting-to-location=EXE f�r Installationsprogramm wird generiert in: {0}.
message.output-location=Installationsprogramm (.exe) gespeichert in: {0}
message.tool-version=[{0}]-Version [{1}] erkannt.
message.creating-association-with-null-extension=Verknüpfung mit Nullerweiterung wird erstellt.
message.creating-association-with-null-extension=Verkn�pfung mit Nullerweiterung wird erstellt.
message.wrong-tool-version=[{0}]-Version {1} wurde erkannt. Erforderlich ist jedoch Version {2}.
message.version-string-too-many-components=Versionszeichenfolge kann bis zu 3 Komponenten aufweisen: major.minor.build.
message.use-wix36-features=WiX {0} erkannt. Erweiterte Bereinigungsaktion wird aktiviert.
message.product-code=MSI-ProductCode: {0}.
message.upgrade-code=MSI-UpgradeCode: {0}.
message.preparing-msi-config=MSI-Konfiguration wird vorbereitet: {0}.
message.generating-msi=MSI wird generiert: {0}.
message.invalid.install.dir=Warnung: Ungültiges Installationsverzeichnis {0}. Installationsverzeichnis muss ein relativer Unterpfad unter dem Standardinstallationsverzeichnis wie "Programme" sein. Der Anwendungsname "{1}" wird als Standardwert verwendet.
message.invalid.install.dir=Warnung: Ung�ltiges Installationsverzeichnis {0}. Installationsverzeichnis muss ein relativer Unterpfad unter dem Standardinstallationsverzeichnis wie "Programme" sein. Der Anwendungsname "{1}" wird als Standardwert verwendet.

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ resource.setup-icon=設定ダイアログ・アイコン
resource.post-app-image-script=アプリケーション・イメージを移入した後に実行するスクリプト
resource.post-msi-script=exeインストーラのmsiファイルが作成された後に実行するスクリプト
resource.wxl-file=WiXローカリゼーション・ファイル
resource.wxl-file-name=MsiInstallerStrings_ja.wxl
resource.main-wix-file=メインWiXプロジェクト・ファイル
resource.overrides-wix-file=WiXプロジェクト・ファイルのオーバーライド
resource.shortcutpromptdlg-wix-file=ショートカット・プロンプト・ダイアログWiXプロジェクト・ファイル
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ resource.setup-icon=设置对话框图标
resource.post-app-image-script=要在填充应用程序映像之后运行的脚本
resource.post-msi-script=在为 exe 安装程序创建 msi 文件之后要运行的脚本
resource.wxl-file=WiX 本地化文件
resource.wxl-file-name=MsiInstallerStrings_zh_CN.wxl
resource.main-wix-file=主 WiX 项目文件
resource.overrides-wix-file=覆盖 WiX 项目文件
resource.shortcutpromptdlg-wix-file=快捷方式提示对话框 WiX 项目文件
Expand Down