You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Joachim Van der Auwera <jo...@progs.be> on 2009/11/12 14:12:45 UTC

javascript locale for numbers

I have component which does some javascript manipulation on a form field 
value which contains a double.
Depending on the locale, this may use either a dot or a comma as decimal 
separator.
Is there a way in which I can know client side (in the javascript code) 
what the current decimal separator is?

Thanks for the help,
Joachim

-- 
Joachim Van der Auwera
PROGS bvba, progs.be


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: javascript locale for numbers

Posted by "Joost Schouten (ml)" <jo...@jsportal.com>.
I went down the javascript number and date formatting track for a while 
and droped it in the end. I now use Tapestries AJAX to do it server side 
for me. Maybe a tiny bit slower, but saves me lots of troubles.

Cheers,
Joost



Israel Rodrigues wrote:
> A component to display formatted numbers and dates according to locale,
> using literals (integer, decimal, currency, date(MASK) or date).
>
> http://code.google.com/p/myt5lib/
>
>
>
> 2009/11/12 Joachim Van der Auwera <jo...@progs.be>
>
>   
>> I have component which does some javascript manipulation on a form field
>> value which contains a double.
>> Depending on the locale, this may use either a dot or a comma as decimal
>> separator.
>> Is there a way in which I can know client side (in the javascript code)
>> what the current decimal separator is?
>>
>> Thanks for the help,
>> Joachim
>>
>> --
>> Joachim Van der Auwera
>> PROGS bvba, progs.be
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: javascript locale for numbers

Posted by Israel Rodrigues <is...@gmail.com>.
A component to display formatted numbers and dates according to locale,
using literals (integer, decimal, currency, date(MASK) or date).

http://code.google.com/p/myt5lib/



2009/11/12 Joachim Van der Auwera <jo...@progs.be>

> I have component which does some javascript manipulation on a form field
> value which contains a double.
> Depending on the locale, this may use either a dot or a comma as decimal
> separator.
> Is there a way in which I can know client side (in the javascript code)
> what the current decimal separator is?
>
> Thanks for the help,
> Joachim
>
> --
> Joachim Van der Auwera
> PROGS bvba, progs.be
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: javascript locale for numbers

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Thu, 12 Nov 2009 11:12:45 -0200, Joachim Van der Auwera  
<jo...@progs.be> escreveu:

> I have component which does some javascript manipulation on a form field  
> value which contains a double.
> Depending on the locale, this may use either a dot or a comma as decimal  
> separator.
> Is there a way in which I can know client side (in the javascript code)  
> what the current decimal separator is?

As far as I know, there isn't, as you can't access request headers from  
JavaScript. You could get the locale server-side and generate a JavaScript  
line that sets a variable with the information you need. You can do that  
by injecting RenderSupport and invoking its addScript() method.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: javascript locale for numbers

Posted by Joachim Van der Auwera <jo...@progs.be>.
Answering my own question, it seems "Tapestry.decimalFormatSymbols" 
should be usable for this, and I see this being used in tapestry.js
However, I don't know where this comes from, as it does not seem to be 
included in my page (I cannot find the declaration).

Joachim

Joachim Van der Auwera wrote:
> I have component which does some javascript manipulation on a form 
> field value which contains a double.
> Depending on the locale, this may use either a dot or a comma as 
> decimal separator.
> Is there a way in which I can know client side (in the javascript 
> code) what the current decimal separator is?
>
> Thanks for the help,
> Joachim
>


-- 
Joachim Van der Auwera
PROGS bvba, progs.be


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: javascript locale for numbers

Posted by Angelo Chen <an...@yahoo.com.hk>.
I use this approach to get the time zone locale, probably that can be
extended to numbers too?

http://old.nabble.com/T5%3A-OutputLocaleNumber-td22068067.html#a22092360



Joachim Van der Auwera (PROGS bvba) wrote:
> 
> I have component which does some javascript manipulation on a form field 
> value which contains a double.
> Depending on the locale, this may use either a dot or a comma as decimal 
> separator.
> Is there a way in which I can know client side (in the javascript code) 
> what the current decimal separator is?
> 
> Thanks for the help,
> Joachim
> 
> -- 
> Joachim Van der Auwera
> PROGS bvba, progs.be
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/javascript-locale-for-numbers-tp26318414p26328722.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org