Fix plural handling for translations (#1424)
* .arg() doesn't handle plurals, replace %1 with %n and pass number to tr(), but only if there is an accompanying word for that we want singular/plural translations and only for whole numbers.
* Qt's translation methods only accept integers and we don't know what grammatical number form would be correct for floating-point numbers in different languages anyway.
* Add optional 2nd argument to SliderBase::SetFormat() to activate deferred plural handling:
SetFormat(QT_TRANSLATE_N_NOOP("olive::SliderBase", "%n unit(s)"), true)
* Generate en_US.ts with lupdate's -pluralonly option. Only source strings that require plural handling need to be translated (as long as the source language is American English).
This commit is contained in:
@@ -103,7 +103,7 @@ PreferencesGeneralTab::PreferencesGeneralTab()
|
||||
|
||||
default_still_length_ = new FloatSlider();
|
||||
default_still_length_->SetMinimum(0.1);
|
||||
default_still_length_->SetFormat(tr("%1 second(s)"));
|
||||
default_still_length_->SetFormat(tr("%1 seconds"));
|
||||
default_still_length_->SetValue(Config::Current()["DefaultStillLength"].value<rational>().toDouble());
|
||||
timeline_layout->addWidget(default_still_length_);
|
||||
|
||||
@@ -136,7 +136,7 @@ PreferencesGeneralTab::PreferencesGeneralTab()
|
||||
autorecovery_interval_ = new IntegerSlider();
|
||||
autorecovery_interval_->SetMinimum(1);
|
||||
autorecovery_interval_->SetMaximum(60);
|
||||
autorecovery_interval_->SetFormat(tr("%1 minute(s)"));
|
||||
autorecovery_interval_->SetFormat(QT_TRANSLATE_N_NOOP("olive::SliderBase", "%n minute(s)"), true);
|
||||
autorecovery_interval_->SetValue(Config::Current()[QStringLiteral("AutorecoveryInterval")].toLongLong());
|
||||
autorecovery_layout->addWidget(autorecovery_interval_, row, 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user