Fix Bug 1001886: Added method to localize number. Used globals, felt dirty but it should be fast.

Rebase and fix pr comments

Fixed typo.