Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to disable intl in yii\i18n\Formatter (eg for dates) #5

Open
ptz-nerf opened this issue Feb 28, 2016 · 9 comments

Comments

@ptz-nerf
Copy link

commented Feb 28, 2016

It would be nice if it will be possible to force disable the intl in Formatter.
There is a problem when ICU is intalled on server, but timezones data is outdated. So, all operations with dates via Formatter are incorrect.
Yes, I can extend Formatter, but I cann't override private formatDateTimeValue. Overriding all date functions seems strange.
Related #9540

@cebe

This comment has been minimized.

Copy link
Member

commented Feb 28, 2016

how about fixing your intl installation?

@ptz-nerf

This comment has been minimized.

Copy link
Author

commented Feb 28, 2016

If I can't (terrible hosting for example)?
You have a fallback that works fine with dates in most situations (except names of the months in russian for example). I want to use it. This is a proposal to add a configuration parameter(s), not a bug.

@samdark

This comment has been minimized.

Copy link
Member

commented Feb 28, 2016

I think introducing boolean options to turn off intl usage is OK. Would result in easier testing as well.

@SDKiller

This comment has been minimized.

Copy link

commented Mar 2, 2016

+1

Currently you have to override \yii\helpers\BaseInflector because of this:

    /**
     * @return boolean if intl extension is loaded
     */
    protected static function hasIntl()
    {
        return extension_loaded('intl');
    }
@SamMousa

This comment has been minimized.

Copy link

commented May 8, 2018

Instead of having a flag doesn't it make sense to split the implementations into 2 classes?

@samdark

This comment has been minimized.

Copy link
Member

commented May 12, 2018

Not sure about that. When introducing intl you don't want to replace all these calls to non-intl class.

@SamMousa

This comment has been minimized.

Copy link

commented May 12, 2018

Isn't that what service locator pattern is ideal for? As long as 2 components offer the same service (i18n) it should be fine.

@samdark

This comment has been minimized.

Copy link
Member

commented May 12, 2018

Same interface you mean? Yes, then it should be fine.

@SamMousa

This comment has been minimized.

Copy link

commented May 12, 2018

Same interface you mean? Yes, then it should be fine.

Well, ideally yes, but it mostly needs to be close enough. It is fine if setup is not the same, but consumption / usage should ideally be 100% the same.

@samdark samdark transferred this issue from yiisoft/yii2 Apr 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
5 participants
You can’t perform that action at this time.