channelwidget: Make volume strings translatable and add missing space

The volume strings (e.g. ‘86% (-3.81dB)’) shown to the right of each
volume slider is now translatable/localisable. (The similar string
‘100% (0dB)’, centred *below* each slider, was already translatable.)
Also, the English strings now include a space between the decibel value
and the unit, e.g. ‘-3.81 dB’ instead of ‘-3.81dB’.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pavucontrol/issues/52
This commit is contained in:
Karl Ove Hufthammer 2019-01-12 14:05:33 +01:00 committed by Tanu Kaskinen
parent 1035910f45
commit ce36a44a1d
1 changed files with 4 additions and 4 deletions

View File

@ -65,12 +65,12 @@ void ChannelWidget::setVolume(pa_volume_t volume) {
if (can_decibel) { if (can_decibel) {
double dB = pa_sw_volume_to_dB(volume); double dB = pa_sw_volume_to_dB(volume);
if (dB > PA_DECIBEL_MININFTY) if (dB > PA_DECIBEL_MININFTY)
snprintf(txt, sizeof(txt), "<small>%0.0f%% (%0.2fdB)</small>", v, dB); snprintf(txt, sizeof(txt), _("<small>%0.0f%% (%0.2f dB)</small>"), v, dB);
else else
snprintf(txt, sizeof(txt), "<small>%0.0f%% (-&#8734;dB)</small>", v); snprintf(txt, sizeof(txt), _("<small>%0.0f%% (-&#8734; dB)</small>"), v);
} }
else else
snprintf(txt, sizeof(txt), "%0.0f%%", v); snprintf(txt, sizeof(txt), _("%0.0f%%"), v);
volumeLabel->set_markup(txt); volumeLabel->set_markup(txt);
volumeScaleEnabled = false; volumeScaleEnabled = false;