-
Notifications
You must be signed in to change notification settings - Fork 758
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
SuperCollider-specific translation files are not loaded on Mac #4619
Comments
I realise that this is not a real-world problem right now, as all the translation files are empty, but I want to change how the IDE is built, and make sure that I do not make this any worse than it already is, so spent some time tracking down what was going on. And to capture the things I tried, and learned. |
I added some debug output to main.cpp, to investigate the behaviour of the translation code - and this is what I got:
Things that are really weird in this:
If I hard-code |
I think the answer is to change SuperCollider so that it does not identify the translation filename to use, and instead defers to Qt to use the QLocale to search for a range of valid file names. This overload looks to be what is needed: https://doc.qt.io/qt-5/qtranslator.html#load-1 bool QTranslator::load(const QLocale &locale, const QString &filename,
const QString &prefix = QString(), const QString &directory = QString(),
const QString &suffix = QString()) |
This looks to be useful example code: https://github.com/KDAB/GammaRay/blob/master/common/translator.cpp#L53 |
Re this overload: bool QTranslator::load(const QString &filename, const QString &directory = QString(),
const QString &search_delimiters = QString(), const QString &suffix = QString()) https://doc.qt.io/qt-5/qtranslator.html#load It also does some mangling of file names to try and find alternative files... So I wonder whether the only problem is the language coming back as |
I am having a look at this... I don't seem to have permission to assign it to myself. |
I added us both so I can help if anything comes up. |
…#4619) The fix is to use the QTranslator::load() overload that takes a QLocale, instead of searching for the filename ourselves. That way, Qt's documented logic takes care of finding scide_fr.qm when the locale contains fr_FR.
I've pushed a fix for this in claremacrae@3668bf9. In order to set up a test of the change, I did the following:
Then to actually test it, on a Mac:
# Copy in to editors/sc-ide/translations/hack_translation.sh
# This edits each .ts file so that it is obvious which language file was loaded
for file in *.ts ; do
cat <<EOF > sedscr
s|<translation type="unfinished"></translation>|<translation>$file</translation>|
EOF
sed -i.bak -f sedscr $file
rm ${file}.bak
done
rm sedscr |
I've picked this up again... Right now, when I create an install on my Mac, there is no translations folder in
This needs debugging before I can reinstate my code to make sure that the translations are found.... |
…r#4619). The code now uses an overload of QTranslator::load() that does a more thorough job of processing the locale to find the appropriate translation file. For more details, see comments in supercollider#4619.
scide: Fix the finding of locale-specific translations (#4619)
…r#4619). The code now uses an overload of QTranslator::load() that does a more thorough job of processing the locale to find the appropriate translation file. For more details, see comments in supercollider#4619.
…r#4619). The code now uses an overload of QTranslator::load() that does a more thorough job of processing the locale to find the appropriate translation file. For more details, see comments in supercollider#4619.
…r#4619). The code now uses an overload of QTranslator::load() that does a more thorough job of processing the locale to find the appropriate translation file. For more details, see comments in supercollider#4619.
Environment
Steps to reproduce
editors/sc-ide/translations/scide_fr.ts
and change all<translation type="unfinished"></translation>
to<translation>sfafdafa</translation>
cmake --build . --target install --config RelWithDebInfo
RebootInstall/SuperCollider/SuperCollider.app
Expected vs. actual behavior
Expect behaviour: Most of the UI elements get renamed to
sfafdafa
Actual behaviour: No change
The text was updated successfully, but these errors were encountered: