mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-11 21:39:11 +00:00
This change updates the UI to allow for dynamic changes of language and locale at runtime. Right now none of the language translations are finished yet or in releasable shape so it also adds a new option to the build that enables/disables the feature. By default no translations are currently enabled to be built as part of a release. Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
@@ -33,13 +33,18 @@ int main(int argc, char *argv[])
|
||||
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
QTranslator translator;
|
||||
bool success = translator.load(":/i18n/gpt4all_en.qm");
|
||||
Q_ASSERT(success);
|
||||
app.installTranslator(&translator);
|
||||
// Set the local and language translation before the qml engine has even been started. This will
|
||||
// use the default system locale unless the user has explicitly set it to use a different one.
|
||||
MySettings::globalInstance()->setLanguageAndLocale();
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
// Add a connection here from MySettings::languageAndLocaleChanged signal to a lambda slot where I can call
|
||||
// engine.uiLanguage property
|
||||
QObject::connect(MySettings::globalInstance(), &MySettings::languageAndLocaleChanged, [&engine]() {
|
||||
engine.setUiLanguage(MySettings::globalInstance()->languageAndLocale());
|
||||
});
|
||||
|
||||
QString llmodelSearchPaths = QCoreApplication::applicationDirPath();
|
||||
const QString libDir = QCoreApplication::applicationDirPath() + "/../lib/";
|
||||
if (LLM::directoryExists(libDir))
|
||||
|
Reference in New Issue
Block a user