On 10/17/2019 6:10 PM, Sverre Moe wrote:
I wonder if there is something I can contribute with to improve the
localization. Perhaps work further with the existing Localization that
exists for WiX in jpackage.
Currently English, Japanese and Chinese Simplified localization files
are provided with jpackage. Though all are English localization.
Correct. Translations will be provided later. Japanese and Chinese
Simplified localization files are just stubs for now.
I made some changes to the jpackage localization, that I can
contribute (mentioned in Change 1). The 2 other changes mentioned
below require a little discussion before beginning to implement.
*Change 1:* Add some missing localization for Strings on the installer
information dialog for when folder already exists.
installer.folder.exists.dialog.title = Setup
installer.folder.exists.dialog.button.yes = Yes
installer.folder.exists.dialog.button.no
<http://installer.folder.exists.dialog.button.no> = No
These are the Dialog Strings defined strictly in jpackage template.wxs
for the JpInvalidInstallDir dialog.
I'm confused. Do you mean main.wxs? There is no template.wxs file in the
sandbox, but there is main.wxs with JpInvalidInstallDir dialog.
The jpackage WiX template file is using the built-in WixUI_InstallDir
dialog, and it has its own localization.
https://wixtoolset.org//documentation/manual/v3/wixui/dialog_reference/wixui_installdir.html
WiX has some support for localization. Perhaps extensive enough for most:
en-us, hr-HR, lv-LV, ro-RO, uk-UA, ar-SA, es-es, hu-HU, ru-ru, zh-CN,
bg-BG, et-EE, sk-SK, zh-HK, ca-ES, it-it, nb-NO, sl-SI, zh-TW, cs-CZ,
fi-FI, ja-jp, nl-NL, sr-Latn-CS, da-DK, fr-fr, kk-KZ, pl-pl, sv-SE,
de-de, he-IL, ko-KR, pt-BR, th-TH
The culture switch must be provided to light.exe in order to use
anything other than English.
Use "-culture:nb-no" for the nb_NO localization.
The cultures switch is not provided to light.exe by jpackage, and it
is recommended by WiX.
> The -loc flag is used to specify the language file to use. It is
important to include the -cultures flag on the command line to ensure
the correct localized strings are included for extensions such as
WiXUIExtension.
I have tested this by manually running light.exe and it works fine. I
got the Norwegian localization for the installer when I specified
"-culture:nb_NO".
What type of localization you are looking for? MSI installers can be
built with multilingual support. I.e. you can build an MSI package that
would include English, Norwegian, German, etc. localizations and pick
the one at installation time. But this is quite a complicated thing -
https://www.firegiant.com/wix/tutorial/transforms/morphing-installers/.
If you need only one language in your installer, then simple
"-culture:nb_NO" would be sufficient, of course.
*Change 2:* Add --win-culture, or --win-localization option to jpackage
Provide the culture switch to light.exe as specified from the
localization option.
The second option is probably the best name. I would not even know
what culture was about before looking into WiX, but everyone knows
what localization means. The option approach would also allow users to
run multiple executions of jpackage in order to build multiple
installers in different languages.
Adding --win-localization command line option looks reasonable. In case
of missing .wxl file for requested localization in OpenJDK you would
drop one in resource directory. Of course we need to fix jpackage to
hook up .wxl files from resource directory. This functionality is
missing at the moment.
One caveat though: We need to support the same number of localizations
in jpackage as WiX does. Otherwise if jpackage does not have its own
localization for the specified culture switch, then building the
installer will fail. It will fail for uknown localization variables on
jpackage's own Strings.
light.exe -culture:nb_NO MsiInstallerStrings_en.wxl
error The localization variable !(loc.message.install.dir.exist) is
unknown.
There are many localization files in WiX, but luckily jpackage has
only 4 Strings of its own. It should not be that much work to make an
MsiInstallerStrings file for each of the WiX localizations.
I don't think we would support any localization beyond English, Japanese
and Chinese Simplified in OpenJDK. Who would provide translations in
multiple languages on regular basis?
Using a culture that WiX has no localization for will not fail
building the installer, but just throw a warning, and fallback to
English localization.
-culture:un-known MsiInstallerStrings_en.wxl
*Change 3:*
All the WiX localization Strings can be overridden in the provided
-loc MsiInstallerStrings.en.wxl file.
We could support custom localization files in resource directory. It
could allow users to provide localization which WiX does not have
built-in support for, or just with different text for the existing
localization Strings.
> Using MsiInstallerStrings_en.wxl localization (specify
application-name.wxl in resource-dir to customize)
This is good idea.
- Alexey
/Sverre
--
tor. 10. okt. 2019 kl. 20:56 skrev Alexey Semenyuk
<alexey.semen...@oracle.com <mailto:alexey.semen...@oracle.com>>:
Sverre,
I've captured your input in [1]. Currently Windows installers are not
localized. We just have sources structured to support localization.
This is a major effort to implement if multiple languages in msi
installers generated by jpackage are required.
[1] https://bugs.openjdk.java.net/browse/JDK-8232136
- Alexey
On 10/10/2019 1:46 PM, Sverre Moe wrote:
> It should be possible to provide localized strings to the
Windows installer
> with jpackage.
>
> WiX supports building localized installers through the use of
language
> files that include localized strings.
>
https://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/make_installer_localizable.html
>
> There are three localization resources for Windows in jpackage.
> Though there is only one String in those three localization files,
> "message.install.dir.exist", all in English and there are more
Strings in
> English in the main.wxs file that are not localized.
> MsiInstallerStrings_en.wxl
> MsiInstallerStrings_ja.wxl
> MsiInstallerStrings_zh_CN.wxl
>
> These could be customized by providing an application_en.wxl or
> application_es.wxl, or any other language to the resource directory.
> Perhaps also allow for further customization by providing an
> application.wxs to the resource directory to use instead of the
main.wxs.
>
> /Sverre