Open Flohack74 opened 6 years ago
The way available languages are determined is by listing all directories in /usr/share/locale-langpack
and passing each through icu::Locale::getDisplayName()
if the display name is empty (or "C") then the locale isn't included in the displayed list.
So i can only assume this is why some of the installed locales don't show up. There is also a workaround for pt_PT to get that to work, do we need to do the same kind of hackery for any other missing locales?
No but I was trying to add Sardinian by mocking it from the Italian package and renaming everything, and it still did not show up in this list... :) - lets talk about this later. But we got an active Sardinian group already, and they just want to select their language at phone setup, so that they can benefit from partial translation. Even if it is not an official Ubuntu language, it would be great if we can hack it like this.
Seems QLocale can't handle sardinian
#include <QCoreApplication>
#include <QDebug>
#include <QLocale>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
qDebug() << QLocale("sc").name();
qDebug() << QLocale("srd").name();
qDebug() << QLocale(QLocale::Language::Sardinian).name();
qDebug() << QLocale(QLocale::Language::Sardinian).nativeLanguageName();
qDebug() << QLocale::languageToString(QLocale::Language::Sardinian);
return a.exec();
}
Output:
"C"
"C"
"en_GB"
"British English"
"Sardinian"
The fact QLocale("sc").name()
returns "C" means it will never show up in the list with the current logic. It's also questionable whether Qt can support sardinian at all looking at this comment https://bugreports.qt.io/browse/QTBUG-57802?focusedCommentId=383762&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-383762
Oh my, what a pity. So far a strange thing with Qt, see pt_BR ;)
QLocale cannot deal with a language which is not associated with a particular country.
WTF.
Yeah it's annoying. I was thinking that because we use gettext for most apps and not QTranslator we could probably miss that step of passing it through QLocale in system-settings/language-plugin but it's still going to raise bugs in calendar etc. What a PITA... I'm not sure what to do
I am thinking of moving this to OTA-5. A clean langpack solution including suggestions from the community will take longer...
See https://papad.org/p/LanguageCompareUBports for an experiment to tally what is in the language selector and what is installed.
This is a list of language packs installed on the phone:
It is not clear how they correspond to the available languages on the device. Not all languages are selectable on the phone UI. I did not crosscheck if all selectable languages have a language file here.