Yii Framework Forum: DecimalI18NBehavior - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

DecimalI18NBehavior Convert decimals between DB and display format Rate Topic: -----

#1 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,013
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 24 May 2011 - 02:34 AM

Inspired by Ricardo Grana's i18n-datetime-behavior, i created a similar extension that converts Decimals from DB format into locale specific format.

You can find the extension and docs here:
http://www.yiiframew...ali18nbehavior/

Please note though, that this extension has some drawbacks. One being, that you have to supply validation rules in locale specific format (which makes it hard to e.g. validate ranges). But on the other hand you'd have to do this anyway...

Note: I have some ideas for an alternative approach, but that would require something like this ;)
0

#2 User is offline   Kapnt 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 19-June 11

Posted 22 November 2011 - 05:22 PM

The file seems to be corrupted. Could you upload it again please, it looks like a very useful extension.
0

#3 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,013
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 23 November 2011 - 02:47 AM

Really? I just verified: I could download and extract the file just fine. Can you try again please?
0

#4 User is offline   Kapnt 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 19-June 11

Posted 04 December 2011 - 03:27 PM

Sorry, but i get an error in linux:
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors

And on Windows rar just says it is corrupted.
0

#5 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,013
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 05 December 2011 - 02:56 AM

What command did you use to untar? Are you sure you supplied the "z" option?


tar xvzf decimali18nbehavior-1.0.0.tgz


0

#6 User is offline   Kapnt 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 19-June 11

Posted 05 December 2011 - 05:53 AM

Yes, I tried it but it doesn't work, I don't know why. Sorry for spamming your thread.
0

#7 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,013
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 05 December 2011 - 06:01 AM

Strange. I've uploaded a ZIP version now. I hope this works now for you.
0

#8 User is offline   Kapnt 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 19-June 11

Posted 05 December 2011 - 11:29 AM

Yes, this works like a charm. Thank you!
0

#9 User is offline   Juan David Rodriguez 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 31-May 12

Posted 03 July 2012 - 02:23 PM

problems .. and do not work for me is taking me forever ParseExpression as the separator "," (comma) and I need a "." (point) .. help me!!
0

#10 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,013
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 09 July 2012 - 01:13 AM

View PostJuan David Rodriguez, on 03 July 2012 - 02:23 PM, said:

problems .. and do not work for me is taking me forever ParseExpression as the separator "," (comma) and I need a "." (point) .. help me!!


Can you post your configuration? What is your parseExpression?
0

#11 User is offline   Dmitry Pupinin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 04-April 14

Posted 06 April 2014 - 09:58 PM

I use this extention with Yii 1.1.13 and it works perfect! Thanks!
But I think that we should override beforeValidate instead beforeSave because standart number validation interupt saving.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users