tractorcow-farm / silverstripe-fluent

Multi-language translate module for Silverstripe, without having to manage separate site trees.
BSD 3-Clause "New" or "Revised" License
93 stars 111 forks source link

Make datetime usage configurable #255

Closed phptek closed 7 years ago

phptek commented 7 years ago

Zend Framework as we know is ancient within SS Framework ~3.x. There are several languages I wish to use, but cannot, due to missing Zend locale files located in framework/thirdparty/Zend/Locale/Data/. So while Fluent allows me to add them to fluent.yml, once I select them in the CMS, Zend will complain bitterly.

Fluent is primarily about language translation management within the CMS, but in places, it takes into account locale-specifics, such as in the current scenario, which I believe it should not, or at least it should be configurable.

Language and Locale are (usually) mutually inclusive, but for this module's purpose, perhaps they should be separate? Regardless, the issue reported here is that for my current purposes I only want to deal with Language, ergo I should be able to control whether or not Locale is taken into account.

The following patch to Fluent::install_locale() fixes it for me:

        // Get date/time formats from Zend
        if (self::config()->get('use_datetime')) {
            require_once 'Zend/Date.php';

            i18n::config()->date_format = Zend_Locale_Format::getDateFormat($locale);
            i18n::config()->time_format = Zend_Locale_Format::getTimeFormat($locale);
        }
phptek commented 7 years ago

Stupid fix. I forgot I had hacked core while testing. False positive!