Visitar URL original
First-launch language is chosen from regional format, not Windows display language · Issue #4208 · sqlitebrowser/sqlitebrowser · GitHub
Skip to content

First-launch language is chosen from regional format, not Windows display language #4208

Description

@Albin-Gedda

Details for the issue

What did you do?

Started the app for the first time (fresh install, no existing settings file).

What did you expect to see?

The GUI in English, matching my Windows display language.

What did you see instead?

The GUI in a mix of Swedish and English (the Swedish translation seems incomplete).
My Windows display language is English. My region and regional format are Sweden/Swedish.
Image

Image

Cause (from reading the source)

In src/Settings.cpp, the default for General/language is:

return QLocale::system().name();

This is derived from the regional format (sv_SE), not the Windows display language. src/Application.cpp then loads sqlb_<that value> and saves it back with Settings::setValue("General", "language", name), so the choice sticks after the first launch.

Suggested fix

Use the first entry of QLocale::system().uiLanguages() as the default, which reflects the display language. As far as I can tell, the value needs - converted to _, because QTranslator::load() only splits on _ and .:

const QStringList ui = QLocale::system().uiLanguages();
if(!ui.isEmpty())
    return ui.first().replace('-', '_');
return QLocale::system().name();

I haven't built or tested this, and I haven't checked tags with a script such as zh-Hans-CN (Simplified Chinese).

Useful extra information

DB4S v3.13.1 [built for i386-little_endian-ilp32] on Windows 10 Version 2009 (winnt/10.0.26200) [x86_64]
using SQLite Version 3.46.1
and Qt 5.15.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions