On Windows 7, we will no longer attempt to canonicalize BCP 47 tags in
the same was as on later OS versions, because there appear to be some
significant differences in how they work, for example, zh-CN is not
converted to zh-Hans-CN on Windows 7, whereas it is on Windows 10.
This commit also refreshes the `KLog` unit which is useful for debugging
these types of scenarios.
Fixes#5091.
If the user has a default language that is not a minimal BCP47 tag, such
as `zh-Hans-CN` vs `zh-CN`, or if the default language does not have a
mapping in our `TLanguageCodeUtils.TranslateWindowsLanguagesToBCP47`
function, then kmshell would crash on install of a keyboard that had no
language metadata specified (i.e. neither legacy metadata in .kmx nor
modern metadata in .kmp).
This crash arose because the elevated instance of kmshell would install
a local-machine reference to `zh-CN` (as it back-translated from a
LangID), but the current user install would look for `zh-Hans-CN`, read
from the Windows registry `HKCU\Control Panel\International\User Profile`.
To further complicate matters, it is possible for the current user to
have a different default language than the elevated user on the machine.
Keyman was assuming that the default language was the same in both
cases.
This fix passes in the current user's default BCP47 and LangID to the
elevated portion of the keyboard install, so we can guarantee that
keyboard install which needs to use the default language, actually
installs for the current user's actual language code, and not a
canonicalized version (or a totally different code in the case of
elevation to an alternate admin user account).
May fix#4889.
In some situations, Keyman is unable to precisely match the user's
default language with its own keyboard settings. In this situation,
Keyman may crash when attempting to install the TIP, or may give a
spurious error such as "Too many transient languages" or similar.
I have been unable to reproduce the crash described in #4889 on my
machines so this is an attempted fix.
This does fix a bug with default languages in any case so is a good fix
to include: if the user's default language is not found in Keyman's LCID
table, then Keyman would fail to install the TIP when the keyboard is
installed and would return an error message (but not crash).
Fixes#4886.
This patch includes 5 separate fixes for the various scenarios we
encountered during package installation.
1. RunTools.pas: don't attempt to install TIPs if package is not also
being installed.
2. Keyman.Setup.System.OnlineResourceCheck.pas, OnlineUpdateCheck.pas:
handle online update check for packages with spaces or periods in the
id (legacy packages only).
3. Keyman.Setup.System.InstallInfo.pas: Handle browsers renaming
downloaded files with `(n)` and `[n]` patterns as well as the current
` (n)` pattern.
4. Keyman.Setup.System.InstallInfo.pas: Handle browsers renaming
downloaded files with `_n` pattern. See code comments for details.
5. Keyman.Configuration.System.TIPMaintenance.pas: Avoid crashing if
`kmshell -install-tips-for-packages` is passed an invalid package
name.
The crash is actually fixed in point 5 above, but the root causes are
addressed in the other points.
Fixes#3749.
Fixes#3759.
Adds a warning dialog when user attempts to add a transient language to
a keyboard but the maximum number of transient languages is already
installed.
If this issue arises when a user is installing a keyboard for the first
time, Keyman instead installs the keyboard for the user's default
language. This may be a little confusing, but the error condition is
difficult to explain and non-technical users will probably be stuck
and need to install under their default language in any case. Happy to
receive any pushback on this decision.
If the user does not specify a language in the bootstrap install,
then the package would be installed without any language selection.
Also, the elevated portion was doing a register and install instead
of just register.
This splits the registration and installation of TIPs according to the
elevation context during the installation process, so that the current
user gets the correct configuration, regardless of who the elevated user
is.