Code Monkey home page Code Monkey logo

Comments (4)

rlanvin avatar rlanvin commented on August 28, 2024

Hi,

Sure, a PR is always appreciated, so if you feel like it feel free. Here are my comments:

  • Locale is part of the intl extension. I had intended this extension to be optional, so it definitely should not fail if intl is not loaded... I suggest you get the locale from the old fashioned setlocale() method when intl is not loaded.
  • I didn't know that en_US_POSIX was a valid locale, so yes, the regexp in line 2022 should probably be updated. I think it some cases the old setlocale() can also return strange locales like C I think, so keep that in mind.
  • Having a fallback locale if the locale is not set for some reason a good idea, though I think Locale or setlocale will always return something.
  • Having a fallback locale if the locale doesn't exist is also a good idea, but I'm wondering if hardcoding en is a good idea. Maybe this could be an option of humanReadable (with en as default, so I can select another fallback language if necessary, and null or false meaning "no fallback, throw an exception if you can't find the locale")

Also, please remember to add (or update) a test that demonstrate the bugs in the PR. You should also update the CHANGELOG file.

from php-rrule.

gustavs-gutmanis avatar gustavs-gutmanis commented on August 28, 2024

Ok, thanks for the input - very good points.
I'll update the tests, but I wonder how could I test Locale class not existing.

from php-rrule.

gustavs-gutmanis avatar gustavs-gutmanis commented on August 28, 2024

I have a question - what should happen if there is no translation file for a given locale?
Right now it throws an exception saying that it couldn't load translations for said locale.
Maybe it should try to use the $fallbackLocale, if any were to be given?

from php-rrule.

rlanvin avatar rlanvin commented on August 28, 2024

Fixed by PR #11

from php-rrule.

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.