forked from len0rd/rockbox
Show nicer language names in voice creation dialog.
Instead of showing the internal language names show some more human friendly string. Currently only applies to the voice creation dialog, the language configuration dialog needs further adjustments to support display strings differing from values. Change-Id: Ic94838f1079c1d09a666d7dbd9682c577f686b3f
This commit is contained in:
parent
9f89ffa71c
commit
733eb9af40
5 changed files with 65 additions and 59 deletions
|
@ -143,16 +143,16 @@ QStringList SystemInfo::platforms(enum SystemInfo::PlatformType type, QString va
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QString> SystemInfo::languages(void)
|
QMap<QString, QStringList> SystemInfo::languages(void)
|
||||||
{
|
{
|
||||||
ensureSystemInfoExists();
|
ensureSystemInfoExists();
|
||||||
|
|
||||||
QMap<QString, QString> result;
|
QMap<QString, QStringList> result;
|
||||||
systemInfos->beginGroup("languages");
|
systemInfos->beginGroup("languages");
|
||||||
QStringList a = systemInfos->childKeys();
|
QStringList a = systemInfos->childKeys();
|
||||||
for(int i = 0; i < a.size(); i++)
|
for(int i = 0; i < a.size(); i++)
|
||||||
{
|
{
|
||||||
result.insert(a.at(i), systemInfos->value(a.at(i), "null").toString());
|
result.insert(a.at(i), systemInfos->value(a.at(i), "null").toStringList());
|
||||||
}
|
}
|
||||||
systemInfos->endGroup();
|
systemInfos->endGroup();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -79,7 +79,7 @@ class SystemInfo : public QObject
|
||||||
static QStringList platforms(enum PlatformType type = PlatformAll,
|
static QStringList platforms(enum PlatformType type = PlatformAll,
|
||||||
QString variant="");
|
QString variant="");
|
||||||
//! returns a map of all languages
|
//! returns a map of all languages
|
||||||
static QMap<QString, QString> languages(void);
|
static QMap<QString, QStringList> languages(void);
|
||||||
//! returns a map of usb-ids and their targets
|
//! returns a map of usb-ids and their targets
|
||||||
static QMap<int, QString> usbIdMap(enum MapType);
|
static QMap<int, QString> usbIdMap(enum MapType);
|
||||||
//! get a value from system settings
|
//! get a value from system settings
|
||||||
|
|
|
@ -38,10 +38,14 @@ TTSBase::Capabilities TTSSapi::capabilities()
|
||||||
void TTSSapi::generateSettings()
|
void TTSSapi::generateSettings()
|
||||||
{
|
{
|
||||||
// language
|
// language
|
||||||
QMap<QString, QString> languages = SystemInfo::languages();
|
QMap<QString, QStringList> languages = SystemInfo::languages();
|
||||||
|
QStringList langs;
|
||||||
|
for(int i = 0; i < languages.values().size(); ++i) {
|
||||||
|
langs.append(languages.values().at(i).at(0));
|
||||||
|
}
|
||||||
EncTtsSetting* setting =new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,
|
EncTtsSetting* setting =new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,
|
||||||
tr("Language:"),RbSettings::subValue("sapi",RbSettings::TtsLanguage),
|
tr("Language:"),RbSettings::subValue("sapi",RbSettings::TtsLanguage),
|
||||||
languages.values());
|
langs);
|
||||||
connect(setting,SIGNAL(dataChanged()),this,SLOT(updateVoiceList()));
|
connect(setting,SIGNAL(dataChanged()),this,SLOT(updateVoiceList()));
|
||||||
insertSetting(eLANGUAGE,setting);
|
insertSetting(eLANGUAGE,setting);
|
||||||
// voice
|
// voice
|
||||||
|
|
|
@ -52,7 +52,7 @@ void CreateVoiceWindow::accept()
|
||||||
|
|
||||||
//configure voicecreator
|
//configure voicecreator
|
||||||
voicecreator->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
|
voicecreator->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
|
||||||
voicecreator->setLang(ui.comboLanguage->currentText());
|
voicecreator->setLang(ui.comboLanguage->itemData(ui.comboLanguage->currentIndex()).toString());
|
||||||
voicecreator->setWavtrimThreshold(ui.wavtrimthreshold->value());
|
voicecreator->setWavtrimThreshold(ui.wavtrimthreshold->value());
|
||||||
|
|
||||||
//start creating
|
//start creating
|
||||||
|
@ -69,25 +69,25 @@ void CreateVoiceWindow::accept()
|
||||||
void CreateVoiceWindow::updateSettings(void)
|
void CreateVoiceWindow::updateSettings(void)
|
||||||
{
|
{
|
||||||
// fill in language combobox
|
// fill in language combobox
|
||||||
QMap<QString, QString> languages = SystemInfo::languages();
|
QMap<QString, QStringList> languages = SystemInfo::languages();
|
||||||
|
|
||||||
for(int i = 0; i < languages.keys().size(); i++) {
|
for(int i = 0; i < languages.keys().size(); i++) {
|
||||||
QString key = languages.keys().at(i);
|
QString key = languages.keys().at(i);
|
||||||
ui.comboLanguage->addItem(languages.value(key), key);
|
ui.comboLanguage->addItem(languages.value(key).at(1), languages.value(key).at(0));
|
||||||
}
|
}
|
||||||
// set saved lang
|
// set saved lang
|
||||||
int sel = ui.comboLanguage->findText(
|
int sel = ui.comboLanguage->findData(
|
||||||
RbSettings::value(RbSettings::VoiceLanguage).toString());
|
RbSettings::value(RbSettings::VoiceLanguage).toString());
|
||||||
// if no saved language is found try to figure the language from the UI lang
|
// if no saved language is found try to figure the language from the UI lang
|
||||||
if(sel == -1) {
|
if(sel == -1) {
|
||||||
QString f = RbSettings::value(RbSettings::Language).toString();
|
QString uilang = RbSettings::value(RbSettings::Language).toString();
|
||||||
// if no language is set default to english. Make sure not to check an empty string.
|
// if no language is set default to english. Make sure not to check an empty string.
|
||||||
if(f.isEmpty()) f = "english";
|
QString f = "english";
|
||||||
|
if(!uilang.isEmpty() && languages.contains(uilang)) {
|
||||||
|
f = languages.value(uilang).at(0);
|
||||||
|
}
|
||||||
sel = ui.comboLanguage->findData(f);
|
sel = ui.comboLanguage->findData(f);
|
||||||
qDebug() << "sel =" << sel;
|
qDebug() << "[CreateVoiceWindow] Selected language index:" << sel;
|
||||||
// still nothing found?
|
|
||||||
if(sel == -1)
|
|
||||||
sel = ui.comboLanguage->findText("english", Qt::MatchStartsWith);
|
|
||||||
}
|
}
|
||||||
ui.comboLanguage->setCurrentIndex(sel);
|
ui.comboLanguage->setCurrentIndex(sel);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ void CreateVoiceWindow::saveSettings(void)
|
||||||
{
|
{
|
||||||
// save selected language
|
// save selected language
|
||||||
RbSettings::setValue(RbSettings::VoiceLanguage,
|
RbSettings::setValue(RbSettings::VoiceLanguage,
|
||||||
ui.comboLanguage->currentText());
|
ui.comboLanguage->itemData(ui.comboLanguage->currentIndex()).toString());
|
||||||
// save wavtrim threshold value
|
// save wavtrim threshold value
|
||||||
RbSettings::setValue(RbSettings::WavtrimThreshold,
|
RbSettings::setValue(RbSettings::WavtrimThreshold,
|
||||||
ui.wavtrimthreshold->value());
|
ui.wavtrimthreshold->value());
|
||||||
|
|
|
@ -849,47 +849,49 @@ name="Sansa Fuze+ (Recovery Mode)"
|
||||||
; The language string is sent to the server when retrieving the list of
|
; The language string is sent to the server when retrieving the list of
|
||||||
; strings. Each entry name is the code for the language and used for storing in
|
; strings. Each entry name is the code for the language and used for storing in
|
||||||
; the configuration.
|
; the configuration.
|
||||||
|
; Format:
|
||||||
|
; <language code>=<language string as sent to server>,<human readable string>
|
||||||
[languages]
|
[languages]
|
||||||
af=afrikaans
|
af=afrikaans,Afrikaans
|
||||||
bg=bulgarian
|
bg=bulgarian,Bulgarian
|
||||||
ca=catala
|
ca=catala,Catala
|
||||||
cs=czech
|
cs=czech,Czech
|
||||||
da=dansk
|
da=dansk,Dansk
|
||||||
de=deutsch
|
de=deutsch,Deutsch
|
||||||
el=greek
|
el=greek,Greek
|
||||||
en=english
|
en=english,English (UK)
|
||||||
en_US=english-us
|
en_US=english-us,English (US)
|
||||||
eo=esperanto
|
eo=esperanto,Esperanto
|
||||||
es=espanol
|
es=espanol,Espanol
|
||||||
et=eesti
|
et=eesti,Eesti
|
||||||
eu=basque
|
eu=basque,Basque
|
||||||
fi=finnish
|
fi=finnish,Finnish
|
||||||
fr=francais
|
fr=francais,Francais
|
||||||
gl=galego
|
gl=galego,Galego
|
||||||
he=hebrew
|
he=hebrew,Hebrew
|
||||||
hi=hindi
|
hi=hindi,Hindi
|
||||||
hu=magyar
|
hu=magyar,Magyar
|
||||||
is=islenska
|
is=islenska,Islenska
|
||||||
it=italiano
|
it=italiano,Italiano
|
||||||
ja=japanese
|
ja=japanese,Japanese
|
||||||
ko=korean
|
ko=korean,Korean
|
||||||
lt=lietuviu
|
lt=lietuviu,Lietuviu
|
||||||
lv=latviesu
|
lv=latviesu,Latviesu
|
||||||
nb=norsk
|
nb=norsk,Norsk
|
||||||
nl=nederlands
|
nl=nederlands,Netherlands
|
||||||
nn=norsk-nynorsk
|
nn=norsk-nynorsk,Norsk (Nyorsk)
|
||||||
pl=polski
|
pl=polski,Polski
|
||||||
pt=portugues
|
pt=portugues,Portugues
|
||||||
pt_BR=portugues-brasileiro
|
pt_BR=portugues-brasileiro,Portugues (Brasileiro)
|
||||||
ro=romaneste
|
ro=romaneste,Romaneste
|
||||||
ru=russian
|
ru=russian,Russian
|
||||||
sk=slovak
|
sk=slovak,Slovak
|
||||||
sl=slovenscina
|
sl=slovenscina,Slovenscina
|
||||||
sv=svenska
|
sv=svenska,Svenska
|
||||||
th=thai
|
th=thai,Thai
|
||||||
tl=tagalog
|
tl=tagalog,Tagalog
|
||||||
tr=turkce
|
tr=turkce,Turkce
|
||||||
wa=wallisertitsch
|
wa=wallisertitsch,Wallisertitsch
|
||||||
zh_CN=chinese-simp
|
zh_CN=chinese-simp,Chinese (simplified)
|
||||||
zh_TW=chinese-trad
|
zh_TW=chinese-trad,Chinese (traditional)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue