deltachat / deltachat-desktop

Email-based instant messaging for Desktop.
GNU General Public License v3.0
887 stars 166 forks source link

Auto-detect GUI language on Windows with empty user profile (first launch, or purged-up launch) #1712

Closed the-Arioch closed 4 years ago

the-Arioch commented 4 years ago

One the cleansed launch (usual first launch was impossible due to #1597) the file/edit/etc menu was not translated to Russian, which is default OS user locale

I know i can switch it manually, but i believe newb-oriented program should "just work" before any user's tuning

On Linux you typically can get RFC-like language string from LOCALE environment variable.

On Windows that preceeded those they made their own infrasturcture.... First one can get numeric code (LC_ID) from AFAIR GetThreadLocale Win32 function. It would be 1049==0x419 for Russian.

Win7+ also has this per-user setting, but i am not sure those are reliable... Have no Win2k or XP to check. HKEY_CURRENT_USER\Control Panel\International Locale=00000419 LocaleName=ru-RU

And if empty, less correct, but maybe more simple is to get computer-global default language as default values from HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Language (REG_SZ "00000419" to me). Then translating it to "ru" via HKEY_CLASSES_ROOT\MIME\DataBase\Rfc1766

the-Arioch commented 4 years ago

Just realized, it was not only about Chrome window decoration but about "electron" GUi too, see "welcome window" screenshot at #1711

So it is not merely file/edit menu!

Simon-Laux commented 4 years ago

Basically we need the feature to auto detect the system language and set it on the first start. We could probably use https://www.electronjs.org/docs/api/locales for this. app.getLocale()

gerryfrancis commented 4 years ago

Have no Win2k or XP to check.

@the-Arioch It does not matter, these operating systems are no longer supported.