Comments (9)
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.
Similar to that in 1.1. With locale-dependent support?
Exactly :)
from yii2.
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.
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.
Done with yii\base\Formatter
and yii\i18n\Formatter
.
from yii2.
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.
I have finished working on this. You may take over if you have time.
Yes, we can add decimalSeparator
and thousandSeparator
properties.
from yii2.
added decimalSeparator
and thousandSeparator
properties in 8b64478.
Will do the i18n things later.
from yii2.
Fixed doc and added i18n support for decimal and grouping separators.
from yii2.
Related Issues (20)
- BaseActiveRecord save method behaviour HOT 1
- Setting YII_DEBUG=false in humhub 1.15.2 leads to internal server error HOT 2
- Memory usage leak when long operation HOT 6
- createControllerByID function add cache? HOT 14
- Relational queries populating invalid models when foreign key / linking value is 0 HOT 1
- request` failed for
- asDuration() produce wrong plural form when using russian locale HOT 2
- hasOne or hasMany return null when $link with two bigint element
- YII2 whether support reset-transaction? HOT 1
- PHP Deprecated: Calling session_set_save_handler() in `PHP 8.4`. HOT 4
- If the iframe is nested in another domain name, there is an exception in the Yii2 site at https://, where there is a jump from http:// HOT 3
- Invalid fatal error handling in php 8.3 HOT 11
- Does yii2 support connection pooling using redis? HOT 1
- Wrong `columnQuoteCharacter` default in Schema for sqlite3 HOT 2
- wulan HOT 1
- Logic failed in RegularExpressionValidator
- Validator error handling in php 8.3 HOT 2
- How should I use Yii2 version 2.0.42.1 in my project HOT 3
- RequiredValidator with typed properties HOT 7
- Unable to resolve the request "--" with chroot HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2.