-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
DATETIME and NUMBER functions #2
Comments
Thank you for sharing your implementation! I'll try to find some time to work on built-in functions soon. I will also think about DOM overlay, but first I want to tag v1 :) |
@tobyzerner I want |
Awesome! Very ambitious - thank you for putting in the work. |
Hi @jrmajor, thanks for your work so far! Can I bother you for a little progress update? |
Sure! I've just released https://github.com/jrmajor/fluent-php/releases/tag/v0.4.0 and https://github.com/jrmajor/laravel-fluent/releases/tag/v0.1.4 with |
Hey @jrmajor - do you have any thoughts about support for partially-formatted variables? |
@tobyzerner They're already supported (added missing test in 482a0c8): $bundle = (new FluentBundle('en-US'))->addFtl('test = { NUMBER($arg, minimumFractionDigits: 1) }');
// This will return '12345.0', respecting both minimumFractionDigits and useGrouping options.
$bundle->message('test', arg: (new FluentNumber(12345))->setOptions(['useGrouping' => false])); |
After a few failed attempts, I decided to give up on the @tobyzerner, I'm sorry. |
No worries @jrmajor! Seems like an extremely difficult thing to build. FYI I have just launched my new project using this lib. Thanks for making it possible to use Fluent in PHP. For dates, mostly I am using github/relative-time-element anyway, otherwise I am using Carbon's |
Hey @tobyzerner, recently @ramsey started working on https://github.com/php-ecma-intl/ext, which would allow me to implement |
Thanks for letting me know! As you say, this probably won't be suitable for my use-case, but it's good to know that this is being worked on. |
Hi! 👋🏻 I'm developing ecma_intl to be a 1:1 port of ECMA-402 to PHP. @jrmajor, the first tagged release will be a @tobyzerner, what's your use-case? |
@ramsey A self-hosted app, meaning that having a hard dependency on a non-default PHP extension probably isn't a good idea, unfortunately 😔 |
Understood. There might be some interest in making it part of the core, so we'll see. 😄 |
Hey @jrmajor, thanks again for your amazing work on this library.
Almost 2 years ago I began my own fluent-php implementation, which was basically a 1:1 port of the JS implementation. It was untested and I never published it or used it in production, so I'm glad you started work on this one which appears to have a much improved architecture and more intent to maintain than I ever had.
However, my implementation did have some additional functionality – specifically, I had implementations of the
NUMBER
andDATETIME
builtin functions. I wanted to share the source code with you now in hope that it can be of use to you.https://github.com/tobyzerner/fluent-php
Note that the function implementations have a number of caveats, documented in the README:
But still, I think they're better than nothing. Fluent isn't nearly as useful without them.
On the side, it also had an implementation of DOM Overlays from
fluent-dom
(also in the form of a 1:1 port), which may also be useful:The text was updated successfully, but these errors were encountered: