klembot / twinejs

Twine, a tool for telling interactive, nonlinear stories
https://twinery.org
GNU General Public License v3.0
2k stars 296 forks source link

Twine launches in system language instead of language chosen in settings before switching #1287

Open AlyxMS opened 2 years ago

AlyxMS commented 2 years ago

Describe the bug.

If the language of the operating system is not the same as the language selected in preferences (In my case: system language: Simplified Chinese, Twine language: English), the desktop app will still launch in the system language and it can take over 10 seconds for Twine to change the language to the one selected in settings.

If the user is editing the story while the language change is happening, strange behavior can occur. (Passage text start to jump between versions before switching happened and after switching happened. See video in Step to Reproduce)

Steps to reproduce:

Set system language to a language supported by Twine. Choose another language in Twine's Preferences. Close and re-launch Twine desktop app. Twine launches in system language. Immediately open a story passage and start typing. Continue to type and wait for the language change to happen. Notice text in passage seemingly jumping between 2 versions. The "jumping" stops after ~2 seconds of no typing.

https://user-images.githubusercontent.com/7328128/189825918-43c28494-0cf2-4a26-b9c0-f04786169b6d.mp4

Expected behavior:

Idealy Twine should launch right into the language chosen in settings. If not, switching language should not cause issues with the editor.

Additional context on this problem.

Tested in desktop app on Windows 10. The PC specification is mainstream/not particularly slow(i5 10400 , NVME SSD), I think the performance factor can be ruled out.

The problem might also be present on the web app however the language switch is much quicker(less than 2 seconds on first load, near-instant subsequently) so the user is unlikely to be editing the story while language change is happening.

Twine version number

2.5.1

Does this problem occur with the web version of Twine or the desktop app?

Desktop app

What operating system does this problem occur on?

Windows

If this problem is occurring with the web version of Twine, what browser does it occur on?

Chrome/Chromium

Presubmission checklist

klembot commented 2 years ago

Could you specify what version of Windows you're using? I don't think that's a factor but it'll help reproducing.

The long delay is odd to me. I feel like something else is happening besides a long file load. Do you see any messages in Help > Troubleshooting > Show Debug Console?

AlyxMS commented 2 years ago

Capture

Huh, that's weird. The app.asar file is there. The fail to load resource ones pop up immediately on launch. The GET fails pop up seconds later as the language switch from Chinese to English. I did try a reinstall at D:\Program Files\ in case this is related to access premission of C:\ or something. But it isn't:

Capture2

The Windows version is Windows 10 Enterprise LTSC version 1809.

Also this is the PC at my workplace. It had some weird group policy settings and a pretty intrusive encryption software.

The PC had some weird problems like both VSCode and Twine is unable to perform file deletion(Twine would warn "Failed to perform delete operation" and VSC would too but also give an option to permanently delete the file instead, which would work. The file deletion problem does not occur on my home PC). I'll test it on my home PC this weekend. Apology in advance if this issue is solely related to my setup.

AlyxMS commented 2 years ago

Confirm I can replicate this on my home PC. My home PC's language is English but the system locale is Chinese.

If I set Twine's language to Chinese and do a fresh launch, I get no error in the console on Launch. If I then attempt to switch to English after launch, this appears in console. With about ~1 second interval before finally switching to English. (Process takes a few seconds)

Capture

If I set Twine's language to English, Twine launches in English but this appears in console.

Capture

If I then attempt to switch to Chinese after launch, the language switch happens instantly with no additional error in console.

Here's a video. Something odd while recording it. While switching to Chinese on an English launch, Twine immediately switch back to English. Had to switch the language Twice.

https://user-images.githubusercontent.com/7328128/190854764-b15ad2a4-9d75-4461-9453-0dece5a05599.mp4