keymanapp / keyman

Keyman cross platform input methods system running on Android, iOS, Linux, macOS, Windows and mobile and desktop web
https://keyman.com/
Other
390 stars 108 forks source link

bug(windows): attempting to install Naija Type with first language in list instead installed for EN(AU) #7738

Closed mcdurdin closed 1 year ago

mcdurdin commented 1 year ago

Describe the bug

When I installed the Naija Type keyboard, it did not install under the selected language Bacama, but instead installed under English (Australia). Another symptom observed was that there were two elevation dialogs.

Reproduce the bug

https://user-images.githubusercontent.com/4498365/202271220-7f5c0603-4747-4534-8c43-1d0e4e346d38.mp4

Expected behavior

The keyboard should have installed under English (Australia).

Related issues

No response

Keyman apps

Keyman version

16.0.105-beta

Operating system

Windows 10

Device

No response

Target application

No response

Browser

No response

Keyboard name

naijatype

Keyboard version

48

Language name

Bacama

Additional context

No response

rc-swag commented 1 year ago

Adding notes for further investigation. Doing a test on a system where the same thing occurs when instaling "Tibetan direct input". Looking at the attached logs kmshell-3916.log shows that kmn18C1.log" -s -i "C:\Users\ross_\AppData\Local\Temp\kmnE509.dir\tibetan_direct_input.kmp=zau-Tibt-IN" -nowelcome -default-lang en-AU 0C09
was attempted to be installed. However in kmshell-14560.log we can see that the install as had to default back to installing the default system lanugage of "en-AU" instead of "zau-Tibt-IN" 000002831843 2022-12-01 22:21:20.179: TTIPMaintenance.DoInstall('tibetan_direct_input', 'zau-Tibt-IN') enter 000002833390 2022-12-01 22:21:21.720: BCP47Tag = zau-Tibt-IN, CanonicalTag = zau-Tibt-IN, lang.BCP47Code = zau-Tibt-IN 000002833531 2022-12-01 22:21:21.861: Failed to find installation langid .... .... 000002834093 2022-12-01 22:21:22.431: Calling elevated kmshell -register-tip 0C09 "tibetan_direct_input" "en-AU" -default-lang en-AU 0C09 000002840328 2022-12-01 22:21:28.654: Calling user kmshell -install-tip 0C09 "tibetan_direct_input" "en-AU" "" kmshell-tibetan.zip

rc-swag commented 1 year ago

The problem is the Windows system Keyman is running on has hit the limit of 4 Transient languages. Therefore, it drops back to installing the default system language for the user. This is actually working currently as designed. Perhaps we could do better and if we know the keyboard is being installed via the Config UI, we don't use the "-s" parameter when calling the elevated command process. This could have other implications though.

Here is the current relevant comment.

    // We'll silently fall back to installing under the default language;
    // they may have hit the limit of custom languages but an error message
    // is likely to be very confusing.
    Result := DoInstallTipForKeyboard(TTIPMaintenance.GetUserDefaultLanguage);
    if not Result then
    begin
      if not FSilent then
        ShowMessage(MsgFromIdFormat(SKInstallLanguageTransientLimit, [BCP47Tag]));
    end;
mcdurdin commented 1 year ago

Perhaps we could do better and if we know the keyboard is being installed via the Config UI, we don't use the "-s" parameter when calling the elevated command process.

It's important to keep the UI in the calling process, rather than the elevated process, as otherwise weird things can happen, like dialogs popping under instead of on top.

Agree we can probably improve on this at some point -- but it's hard to know what we can do apart from showing an obtuse error message :grin:

rc-swag commented 1 year ago

Following the discussion above we will close this issue as working as designed. The improvement of this message would fall be just on part of the refactoring of the installation process in the distant future.