Skip to content

Commit f59f58f

Browse files
committed
GUI - use QLocale's first of uiLanguages to get primary locale
This appears to work better with Big Sur. Also improve locale logging.
1 parent f26f425 commit f59f58f

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

app/gui/qt/main.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ int main(int argc, char *argv[])
4949

5050
qRegisterMetaType<SonicPiLog::MultiMessage>("SonicPiLog::MultiMessage");
5151

52-
QString systemLocale = QLocale::system().name();
53-
52+
QString systemLocale = QLocale::system().uiLanguages()[0];
5453

5554
QTranslator qtTranslator;
5655
qtTranslator.load("qt_" + systemLocale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));

app/gui/qt/mainwindow.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,20 @@ MainWindow::MainWindow(QApplication &app, bool i18n, QSplashScreen* splash)
148148

149149
// Throw all stdout into ~/.sonic-pi/log/gui.log
150150
setupLogPathAndRedirectStdOut();
151-
151+
std::cout << "[GUI] - " << std::endl;
152+
std::cout << "[GUI] - " << std::endl;
153+
std::cout << "[GUI] - " << std::endl;
152154
std::cout << "[GUI] - Welcome to the Sonic Pi GUI" << std::endl;
153155
std::cout << "[GUI] - ===========================" << std::endl;
154156
std::cout << "[GUI] - " << std::endl;
155157
std::cout << "[GUI] - " << guiID.toStdString() << std::endl;
158+
std::cout << "[GUI] - locale: " << QLocale::system().uiLanguages()[0].toStdString() << std::endl;
159+
160+
if(i18n) {
161+
std::cout << "[GUI] - translations available " << std::endl;
162+
} else {
163+
std::cout << "[GUI] - translations unavailable (using EN)" << std::endl;
164+
}
156165

157166
// dynamically discover port numbers and then check them this will
158167
// show an error dialogue to the user and then kill the app if any of

app/server/ruby/bin/qt-doc.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
map { |p| File.basename(p).gsub(/sonic-pi-tutorial-(.*?).po/, '\1') }.
217217
sort_by {|n| -n.length}
218218

219-
docs << "\n QString systemLocale = QLocale::system().name();\n\n" unless languages.empty?
219+
docs << "\n QString systemLocale = QLocale::system().uiLanguages()[0];\n\n" unless languages.empty?
220220

221221
# first, try to match all non-default languages (those that aren't "en")
222222
languages.each do |lang|

0 commit comments

Comments
 (0)