Localize display of glue lengths in dialogs

This commit is contained in:
Juergen Spitzmueller 2022-08-09 09:44:12 +02:00
parent 60b539e544
commit 079bc8ca40
2 changed files with 13 additions and 2 deletions

View File

@ -161,7 +161,7 @@ void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
} else if (!isValidLength(len) && !isStrDbl(len)) {
// use input field only for gluelengths
combo->setCurrentItem(defaultUnit);
input->setText(toqstr(len));
input->setText(locLengthString(toqstr(len)));
} else {
lengthToWidgets(input, combo, Length(len), defaultUnit);
}
@ -214,6 +214,14 @@ QString formatLocFPNumber(double d)
}
QString locLengthString(QString const & str)
{
QLocale loc;
QString res = str;
return res.replace(QString("."), loc.decimalPoint());
}
QString unlocLengthString(QString const & str)
{
QLocale loc;

View File

@ -72,7 +72,10 @@ void doubleToWidget(QLineEdit * input, std::string const & value,
*/
QString formatLocFPNumber(double d);
// Method to replace localized decimal separator by dot
/// Method to replace dot with localized decimal separator
QString locLengthString(QString const & str);
/// Method to replace localized decimal separator by dot
QString unlocLengthString(QString const & str);
/// Method to sort QStrings locale-aware (e.g. in combo widgets)