OT: Thanks!

Thomas Olsen tanghus at gmail.com
Sat Oct 17 12:15:54 CEST 2009


On 17/10-2009 11:18 John Layt <johnlayt at googlemail.com> wrote:
> Nice.  That reminds me I have a draft proposal to add full ISO Currency
>  Code support into KLocale, that could save you (and several others) a lot
>  of work around codes, localisation, translations, formats and rounding
>  rules.  Must get that done before feature freeze :-)  If you have any
>  input on what features you'd find useful, please let me know.

Oh yes l10n for currencies. Whats currently in KLocale is very rudimentary and 
I use it it a crude way that will probably break on some locales:

        self.amount_validator = KDoubleValidator(self.amount.nativeWidget())
        if KGlobal.locale().decimalSymbol() == ",":
            self.amount_validator.setAcceptLocalizedNumbers(True)

and:

          if KGlobal.locale().decimalSymbol() == ",":
              # remove any "."s and replace "," with "."
              # there ought to bet a prettier way to do this
              if amount.contains(","):
                  amount = amount.replace(".", "").replace(",", ".")

I'm not very proud of this code...

-- 
Best Regards / Med venlig hilsen

  Thomas Olsen



More information about the Plasma-devel mailing list