Giter VIP home page Giter VIP logo

Comments (9)

samdark avatar samdark commented on May 30, 2024

http://docs.php.net/manual/en/book.intl.php is bundled with recent versions of PHP so I'm for using it for formatting.

from yii2.

cebe avatar cebe commented on May 30, 2024

Similar to that in 1.1. With locale-dependent support?

Exactly :)

from yii2.

njasm avatar njasm commented on May 30, 2024

what you guys thinking regarding the FormatterHelper?

I was thinking in converting the 1.1 to yii2 and add currency() and percentage() formatting, using intl classes/functions.

what was missing in 1.1 CFormatter? pros/cons?
what about validation data before formatting? ex. formatEmail, we simple create an email link without validating if it a valid email value. shouldn't we do this kind of validation here? or am I giving too much responsability to the Formatter class?!

from yii2.

cebe avatar cebe commented on May 30, 2024

what about validation data before formatting?

Formatter should consider the given data as valid. When you format for example data that comes from a model, the model is responsible for that.

btw. there is a pull request for locale aware formatter in yii1.1 https://github.com/yiisoft/yii/pull/2054/files Not sure if there is something useful for yii2 in there, just want to mention.

from yii2.

qiangxue avatar qiangxue commented on May 30, 2024

Done with yii\base\Formatter and yii\i18n\Formatter.

from yii2.

cebe avatar cebe commented on May 30, 2024

Why is this numberFormat removed? I'd expect at least decimalSeparator and thousandSeparator to be configurable. decimalSeparator should also be used for asDouble. Agree that setting decimals in numberFormat globally does not make sense.

Btw: doc comments of properties, date time functions $format parameter in \yii\i18n\Formatter are not right yet.

More things to add:

  • asDouble and asNumber are available in i18n\Formatter too so they should respect locale settings there.

@qiangxue I can handle these when you are not working on it.

from yii2.

qiangxue avatar qiangxue commented on May 30, 2024

I have finished working on this. You may take over if you have time.

Yes, we can add decimalSeparator and thousandSeparator properties.

from yii2.

cebe avatar cebe commented on May 30, 2024

added decimalSeparator and thousandSeparator properties in 8b64478.
Will do the i18n things later.

from yii2.

qiangxue avatar qiangxue commented on May 30, 2024

Fixed doc and added i18n support for decimal and grouping separators.

from yii2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.