There are two forms of the QObject::tr()
function I have been using for translating strings which contain numbers:
tr("There are %n foo(s)", 0, foo.size());
tr("%1: %2").arg(QLocale().toString(bar.size())).arg(bar.name());
These account for most instances where you want a number in a string except when you want to do localisation and pluralisation in the same string. Of course you could break the translation up, but you have to make a guess about whether that string will break in the same places in all languages (a decision I'm not qualified to make most of the time).
The QLocale documentation states that...
QString::arg() uses the default locale to format a number when its position specifier in the format string contains an 'L', e.g. "%L1"
... so the second form could be rewritten as ...
tr("%L1: %2").arg(bar.size()).arg(bar.name());
... and this suggests you could rewrite the first form as...
tr("There are %Ln foo(s)", 0, foo.size());
This will compile and it shows up in Linguist as a pluralisation, but does anyone know if this will also localise the number? I can't find anything which says either way in any documentation.