Translation issues in KUnitConversion::Currency

Petri Damstén petri.damsten at gmail.com
Tue Dec 1 08:16:06 GMT 2009


On Monday 30 November 2009 21:58:16 John Layt wrote:
> Hi,
> 
> It's been raised on the i18n mailing list that there are some problems with
> the translatable strings in the KUnitConversion::Currency class.  I've been
> asked to help fix these, which has led me to a couple of other things I
>  think need fixing.
> 
> 1)  A number of currency units have incorrect plural forms, e.g. latss,
> litass, yuans, etc.  I will be fixing these to the most common en_US usage.
> 
> 2) None of the country names are correctly capitalised, e.g. french francs,
> australian dollars, etc.  I will be fixing these.
> 
> 3) At least one of the country names is not in English, e.g. brasilia.  I
>  will be fixing these.
> 
> 4) The "unit description in list" is somewhat inconsistent, with some
> descriptions including the country name and some not.
> 
> The new KCurrencyCode class in kdecore provides a standard name that will
>  be consistent throughout KDE and will save on translations.
> 
> Will it be OK to replace the lines like:
> 
>   i18nc("unit description in lists", "new zealand dollars")
> 
> with
> 
>   KCurrencyCode::currencyCodeToName("NZD")
> 
> which will return a standard format and translated name like:
> 
>   "New Zealand Dollar"

Looks good to me.

> 5)  Is it necessary to translate the "currency unit symbols" themselves,
>  e.g. "USD"?
> 
> These are ISO international standard codes and I have never seen them used
> translated, and the ISO website specifically mentions about their not being
> good for localisation as a problem (hence the numeric form of the code). 
>  In KSpread and KMyMoney they are translatable but no KDE language has ever
>  translated them.
> 
> In particular, I don't think the conversion rate lookup from the ECB
>  download will work if the codes are translated?

True

> Is it OK to remove the translation on these?

Yes, and I think that SI units like i18nc("mass unit symbol", "kg") should not 
be translated either?

> 6) The unit synonyms for matching are repeated in various upper, mixed and
> lower case forms, e.g. "NZD;nzd;New Zealand;new zealand".
> 
> Wouldn't it be better to have just a single lowercase version of each
>  synonym, and when attempting to match in UnitCategory just .toLower() the
>  users input? It will save the translators some work, and be more
>  efficient.
> 
> Of course , that might cause problems for other unit types, e.g. Mb vs MB?

I think they should still be case sensitive. Mg and mg are different units. 
But it's true that there's no need for multiple versions. Lower casing can be 
handled in runner. Runner now first tries to find perfect match and then 
startsWith match that can result multiple hits. If startsWith is 
CaseInsensitive it should work.

> We'd need to OK this point with the translators first, it may have to wait
>  for 4.5 as it's not a real error and would need changing in all the other
>  conversion unit classes as well, and I only have the OK to change the
>  Currency ones.

What other classes need changing (if not talking about SI units)?

> I can also replace having the country name directly in the synonym list
>  with the existing translations from KLocale, i.e. replace:
> 
>   i18nc("unit synonyms for matching user input", "rand;zar;south africa")
> 
> with something like
> 
>   i18nc("unit synonyms for matching user input", "rand;zar;%1",
>           KGlobal::locale()->countryCodeToName("za"))
> 
> and if the Currency Codes are untranslated then
> 
>   i18nc("unit synonyms for matching user input", "rand;%1;%2", "zar",
>         KGlobal::locale()->countryCodeToName("za"))

So this could be:
    i18nc("unit synonyms for matching user input", 
          "rand;rands;%1;%2;%3",
          "ZAR",
          KGlobal::locale()->countryCodeToName("za"),
          KCurrencyCode::currencyCodeToName("ZAR"))

This leaves "South Africa Rands" unmatched though.

> I think that's all for now :-)
> 
> Cheers!
> 
> John.
> 
> P.S. In 4.5 I hope to add currency unit names (dollar, dollars, etc) and
>  fancy money formatting to KCurrencyCode, so long term that's even fewer
>  translations needed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20091201/c3a0bf95/attachment.sig>


More information about the kde-core-devel mailing list