Leave feedback
  • Question

    How to override locale settings

Enter a new topic
  • Dennis Staiger Dennis Staiger
    0 likes 3692 views

    In my number formatting (for currency related numbers), I want to use the Swiss locale with one modification: use a space instead of '. Is there a way to override the locale de_CH?

    Number formatting like num(de_CH){sz,zz9.99} currently results in 1'450.00 but I want it to be 1 450.00 (with a space). Is this possible? How would I go about it?

     

    Thanks!

    Tuesday 23 October, 2012
  • Best Answer
    Andreas Hjelle Andreas Hjelle
    0 likes

    Nformat()$myVar = nformat("BBB BBB BBB BB#.##", $myNumberToFormat);

    Wednesday 24 October, 2012
  • Tsen-Tiam Chu Tsen-Tiam Chu StreamServe Employee
    0 likes

    i would say you use modifications on the format property.

    so instead of using the number{zzzz}. you add a variable in the modification area. And you create a script that changes the modification variable to wanted format and the modification will change it to that.

    Hope this gives you an idea of how to solve it.

    thanks,

    Tuesday 23 October, 2012
  • Dennis Staiger Dennis Staiger
    0 likes

    Dear Tsen-Tiam,

    when I put a modification on the number format field, I can tweak the format string, but I would still need to know how I can override the delimiter for a given locale. This is what I tried:

    Modification variable: $format_string

    Before script: $format_string = "num(de_CH){sz,zz9.99}"; // how can I change the String to end up with a number such as: 1 450.00

    // meaning: a non-breaking space between the 1 and the 4 instead of a ' (which is the default for locale de_CH)?

    Wednesday 24 October, 2012
  • Andreas Hjelle Andreas Hjelle
    0 likes

    Hi,

    Di you see this post: http://streamshare.streamserve.com/Forum/Topic/?topicID=1422

    It might help.

     

    Wednesday 24 October, 2012
  • Dennis Staiger Dennis Staiger
    0 likes

    Hello Andreas,

    I did come across this post, but I do not see how it applies to my problem. Am I missing something?

    Wednesday 24 October, 2012
  • Andreas Hjelle Andreas Hjelle
    0 likes

    I think that the locale is defined in the server as David explains in the post. So any modifications you need will have to be custom formatting. As long as the formatting for de-CH is according to ISO spec, this would not be changed.

    You could for instance use decimal or currency formatting for another locale (that suits your need) whenever the locale is de-CH.

    Wednesday 24 October, 2012
  • Dennis Staiger Dennis Staiger
    0 likes

    Is there a way to do custom formatting in a way so that I can define a space as a separator between groups of thousands? num{sz zz9.99} does not seem to do the trick.

    My workaround would be to completely ignore the formatting mask and to parse the number directly myself. Not very elegant - which is why I was trying to leverage the built-in formatting option.

    Wednesday 24 October, 2012
  • Andreas Hjelle Andreas Hjelle
    0 likes

    Nformat()$myVar = nformat("BBB BBB BBB BB#.##", $myNumberToFormat);

    Wednesday 24 October, 2012
  • Dennis Staiger Dennis Staiger
    0 likes

    I went wit using nformat on a modifcation for the field value and no formatting rule. Works like a charm, thank you all!

    Thursday 25 October, 2012