Multi-language installer package

Hi,

I am building an installer package for macOS using pkgbuild and productbuild. I would ideally like to make a multi-language installer that does the following:

  • Allows the user to select the language, but defaults to the OS language.

  • Displays the installer Welcome, Readme, and License based on that language.

  • Installs a different .app and some specific support files based on the selected language.

  • Runs a language specific postinstall script.

I have localized text files (license, readme, welcome) in the resources directory in subfolders named en.lproj, de.lproj, fr.lproj etc.

When I build and test this installer on my English mac, it displays only the English readme, though it does allow me to select the License language which is a start.

To what extent is the above possible?

Thanks, Andrew

Replies

Unless the application you're planning to distribute is very huge or is using a cross platform framework that makes it a nightmare to support multiple localization in an app, the best solution would be to just include all the localizations in your app and support files.

There is not really a way to support what you are tying to achieve with the localized text files. At best, you could create a custom installer plugin to display the ReadMe file in multiple languages but this would still not allow you to do the same with the Welcome (and Conclusion) steps. And synchronizing the language selected in the fake ReadMe step would not be easy or possible.

Allowing to install a different version of the app and some support files depending on a selected language could be possible using choices and using the custom installation mode by default. But again, there's not really a way to synchronize the selected language in the License pane (or your custom fake ReadMe pane).

Honestly, your 2 best options are:

  • when in macOS do as the macOSians do: let the system language settings decide which localization to use for the app and the Welcome, ReadMe (and Conclusion). And have an application bundle/components that include all the localizations
  • distribute 1 installation package per language.

I don't believe that merging the Welcome, ReadMe and EULA in a single file and use that file for the License step is a user friendly solution.

Ok, thanks for the reply.

So as far as the installers go, localization is pretty much restricted to a few readme / license text files, and the system decides the rest based on the user's currently selected language in system preferences. It also seems like it might be tricky to determine the user's language in a postinstall script since the installer runs as root.

  • You can find the language because you can check:

    that the installation is not run from installer(8) or a deployment solution such as Apple Remote Desktop.which user has requested the installation through the $USER env var.

    From there you can find the language preferences for the user (unless the root user can not check the contents of the Library/Preferences folder anymore…)

Add a Comment