chat: fix crash at startup due to missing en_US translation (#2816)

Signed-off-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
Jared Van Bortel 2024-08-08 18:44:15 -04:00 committed by GitHub
parent a910d65755
commit 6957706af7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View File

@ -229,6 +229,7 @@ qt_add_qml_module(chat
)
if (GPT4ALL_TRANSLATIONS)
target_compile_definitions(chat PRIVATE GPT4ALL_USE_TRANSLATIONS)
qt_add_translations(chat
TS_FILES
${CMAKE_SOURCE_DIR}/translations/gpt4all_en_US.ts

View File

@ -632,6 +632,7 @@ void MySettings::setLanguageAndLocale(const QString &bcp47Name)
else
locale = QLocale(l);
#ifdef GPT4ALL_USE_TRANSLATIONS
// If we previously installed a translator, then remove it
if (m_translator) {
if (!qGuiApp->removeTranslator(m_translator.get())) {
@ -661,6 +662,7 @@ void MySettings::setLanguageAndLocale(const QString &bcp47Name)
m_translator.reset();
}
}
#endif
// Finally, set the locale whether we have a translation or not
QLocale::setDefault(locale);