-
-
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
Allow overriding Fluent functions #14
Allow overriding Fluent functions #14
Conversation
fa723a4
to
3e2d30c
Compare
So, what are you thinking about this request? In the original implementation, there were no limits (https://github.com/projectfluent/fluent.js/blob/main/fluent-bundle/src/bundle.ts#LL75C20-L75C20), and we successfully overwrote built-in functions to support square/cubic units and some messy formats like usd-per-square-meter to support $1000/m². |
Hello, do you plan accept this? Or do you have any questions? |
Hi, I believe that as Would defining a separate function, e.g. |
Fluent is great for its extensibility. And the original library does not impose any restrictions on extending and redefining functions. I don't see anything wrong with overriding/extending built-in functions. Especially given that basic support for Intl.NumberFormat is only planned in the future tc39/ecma402#767 So in FronEnd we just replace built-in function and its work like a charm. |
So all this is necessary for uniform behavior. To make the backend implementation behave the same as the frontend implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, we can allow it for the sake of compatibility with fluent.js
.
Please adjust your changes to the comments I've left and I will merge it.
Done |
78adf22
to
6d216b7
Compare
@hakastein Thank you, and sorry for the delay. I will try to release a new version soon :) |
Original fluent does not limit function overriding
This is especially significant due to the lack of a built-in DATETIME function.