[Glass] Locale decimalPoint into html rendering
Dale Henrichs via Glass
glass at lists.gemtalksystems.com
Thu Mar 19 06:07:00 PDT 2015
Thanks Dario,
I've submitted a bug[1] for this...
[1] https://github.com/GsDevKit/GsDevKit/issues/59
On 3/19/15 3:48 AM, Dario Trussardi via Glass wrote:
> Ciao,
>
> i have a tODE 3.1.0.6 environment.
>
> On it i set the TimeZone with:
>
> | time |
> time:= TimeZone timeDifferenceHrs: 1 dstHrs: 1 atTimeHrs: 2
> fromDayNum: 95 toDayNum: 304 on: #Sunday beginning: 1967
> stdPrintString: 'Germany Standard Time' dstPrintString: 'Germany
> Legal Time'.
> TimeZone for:#Germany put: time.
> TimeZone default: time
>
>
> Now theLocale decimalPoint is set to $, ( comma )and it's right.
>
>
> The :( ScaledDecimal fromString: '12,34' ) asString report '12,34' and
> it's right with comma.
>
>
> The problem is into relative html web rendering.
>
> In this case the browser report the data,not with comma,but with
> decimal point12.34 and it's wrong.
>
> The relative ScaledDecimal method
>
> asString
>
> "Returns a String of the form '123.56 for a number with scale = 2."
> | str mstr sc sz len isNeg m dpStr nDigits |
> (m := mantissa) ifNil:[ ^ 'ScaledDecimalNaN' ].
> mstr := m asString .
> len := mstr size .
> sz := len .
> sc := scale.
> nDigits := sz .
> (isNeg := (mstr at: 1) == $-) ifTrue:[ nDigits := nDigits - 1 ].
> dpStr := Locale decimalPoint.
> str := String new .
> nDigits <= sc ifTrue:[ | prefix zeros zerosLen zcount idx srcIdx |
> isNeg ifTrue:[ str add: $- ] .
> str add: $0 ; add: dpStr .
> zeros :=
> '00000000000000000000000000000000000000000000000000000000000000000' .
> zerosLen := zeros size .
> zcount := sc - nDigits .
> [ zcount >= zerosLen ] whileTrue:[
> str add: zeros .
> zcount := zcount - zerosLen .
> ].
> zcount > 0 ifTrue:[
> "zeros copyFrom: 1 to: zcount into: str startingAt: str size + 1"
> idx := str size .
> str replaceFrom: idx + 1 to: idx + zcount with: zeros startingAt: 1 .
> ].
> "mstr copyFrom: len - nDigits + 1 to: len into: str startingAt:
> str size + 1"
> idx := str size + 1 .
> srcIdx := len - nDigits + 1 .
> str replaceFrom: idx to: idx + nDigits - 1 with: mstr startingAt:
> srcIdx
> ] ifFalse:[
> str := mstr .
> " add dpStr only if with decimals "
> sc>0 ifTrue:[ str insertAll: dpStr at: (sz + 1 - sc )] .
> ].
> ^ str
>
>
> do reference to theLocale decimalPoint but when work to rendering as
> html data it wrong.
>
> I need to force into the upper method the :dpStr := Locale decimalPoint.
>
> to:dpStr:= $,
>
> With this force the html data is right rendering but it's a force.
>
> Thanks for considerations,
>
> Dario
>
>
>
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20150319/93830fc9/attachment-0001.html>
More information about the Glass
mailing list