Skip to content


Subversion checkout URL

You can clone with
Download ZIP


GUI: change language selection format to "language - country (locale name)" #1519

merged 1 commit into from

2 participants


new language selection

The language and country names are displayed always in english, which seems to be a Qt limitation.

Fixes: #1509



I see one mistake in the screenshot though: en (or generally, xx without xx_YY) should be simply English, not English - UnitedStates :)


@laanwj I'm not sure how to fix your observation, as I pass "en" into QLocale and query .language() and .country(). Perhaps UnitedStates is default here? As Germany is for de?


Yes, I know that's the behavior. But it's not correct. English is "general" English, without locale. You can see this problem with Persian - Iran, which is now duplicate in the list. I wonder if there is another way to take apart the xx_YY which doesn't have this problem (without reinventing the wheel...).


We could check if there is a "_" in the source string and if not only use .language()? Do you know the function to check for a certain char in a QString?


QString::contains(str) -> bool

@Diapolo Diapolo GUI: change language selection format
- display as "language - country (locale name)", when locale name consists of 2 parts
- display as "language (locale name)", when locale name consists of 1 part

@laanwj Thanks, it now does, what we want it to do.



@laanwj laanwj merged commit bcf0f41 into bitcoin:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 26, 2012
  1. @Diapolo

    GUI: change language selection format

    Diapolo authored
    - display as "language - country (locale name)", when locale name consists of 2 parts
    - display as "language (locale name)", when locale name consists of 1 part
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/qt/optionsdialog.cpp
15 src/qt/optionsdialog.cpp
@@ -14,6 +14,7 @@
#include <QIntValidator>
#include <QLabel>
#include <QLineEdit>
+#include <QLocale>
#include <QMessageBox>
#include <QPushButton>
#include <QRegExp>
@@ -62,7 +63,19 @@ OptionsDialog::OptionsDialog(QWidget *parent) :
ui->lang->addItem(QString("(") + tr("default") + QString(")"), QVariant(""));
foreach(const QString &langStr, translations.entryList())
- ui->lang->addItem(langStr, QVariant(langStr));
+ QLocale locale(langStr);
+ /** check if the locale name consists of 2 parts (language_country) */
+ if(langStr.contains("_"))
+ {
+ /** display language strings as "language - country (locale name)", e.g. "German - Germany (de)" */
+ ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" - ") + QLocale::countryToString( + QString(" (") + langStr + QString(")"), QVariant(langStr));
+ }
+ else
+ {
+ /** display language strings as "language (locale name)", e.g. "German (de)" */
+ ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" (") + langStr + QString(")"), QVariant(langStr));
+ }
ui->unit->setModel(new BitcoinUnits(this));
Something went wrong with that request. Please try again.