-
-
Notifications
You must be signed in to change notification settings - Fork 912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Add a locale/language setting/option to Sonic Pi and organise some GUI code #2017
Conversation
…some of the GUI code
ee967cf
to
7a1dbba
Compare
I hope this is a good start on the language option :) |
* Prefs window: Make a Locale/Language group box, which currently is in the Editor tab (that's if it works!) * Add 'system_locale' to availableLocales, and add a map to convert from locale code to array/combo-box index (see app/server/ruby/bin/qt-docs.rb) * Remove some helper functions related to the locale option & locale_combo combo-box, which now shouldn't be needed (due to the map) * Change the locale setting name from 'locale' to 'prefs/locale' to fit in with the naming scheme
…replace some tabs with spaces; other tweaks
…a double forward-slash (oops!); remove a few spaces from the start of a line
dc66679
to
4a20bf0
Compare
In order to build it on my Debian 9 laptop, I had to change SonicPi.pro slightly so it could find qscintilla2:
I changed the locale setting manually in the sonic-pi settings file, and it seems like Sonic Pi loads the correct locale from the settings when starting, which is good! The locale prefs combo box also lists the different available languages (by their English names at the moment; in the final version it'll show their native names), and an option to use the system locale. :) But I was unable to test if it saved the locale setting correctly, as Sonic Pi keeps crashing with a segmentation fault when I try to close it; I don't know if that's to do with the code I've added, other code in SPi, or something else. |
main.cpp: * Add some log messages to help debug stuff * Add a missing semi-colon mainwindow.cpp: * Fixed syntactically incorrect definition of locale_combo * Updated add_locale_combo_box_entries to add the names of the languages to the combo box (currently adds the English names - this is to be changed to the native names soon) * Other tweaks qt-docs.rb & mainwindow.h: * Made the map functions: availableLocales() and localeIndex(), which are used instead of the map variables (due to issues in defining them) ruby_help.tmpl: * Added '#pragma once' to help prevent the generated ruby_help.h being included multiple times
de51136
to
0618987
Compare
MainWindow class: * Change 'availableLocales' and 'localeIndex' into map variables, instead of functions returning maps. * Add a new map called 'localeNames' which maps the locale/language codes to the languages' native names. * Add a new function called 'defineLocaleLists()', to define the availableLocales, localeIndex and localeNames maps. This function is defined in ruby_help.h (which is generated by app/server/ruby/bin/qt-doc.rb). * Make add_locale_combo_box_entries() use the new localeNames map instead of putting locale/language names together at runtime. Note: the native locale/language names are currently hardcoded in app/server/ruby/bin/qt-doc.rb.
…at don't have a region specified in them
… the default locale setting to the system locale; specify a default style again (Light) MainWindow class: * Remove the local declaration of locale_combo inside initPrefsWindow(), and instead define the class-wide locale_combo (which is defined in mainwindow.h) - this seems like it fixes the segmentation fault crash when closing Sonic Pi. * Change the return type of add_locale_combo_box_entries() to void. * Set "system_locale" as the default setting for the 'prefs/locale' setting. * Specify a default style again (Light mode), as not setting any style seems to cause the icons to be really small!
Apologies, we've now moved our default branch from master to main. Please consider creating a new pull request merging with main with these changes. I am closing this not out of any lack of interest, but in order to ensure new code moves to our new default branch. Thanks! |
I've tried to start work on making a language setting, so the user can change the locale of Sonic Pi individually from the system locale.
Also, while adding the option, I've organised some parts of the code to hopefully make it easier to read, and to add to in the future. (So this also acts as an updated version of PR #1875) I just hope that I haven't accidentally missed/removed anything! If you don't like how I've organised parts of the code, I can revert the organisation changes if needed.