fluent-rs
fluent-rs copied to clipboard
Implement the DATETIME() builtin function
Hi,
I really admire the fluent design, it is elegant - thank you!
I was following the documentation here:
https://www.projectfluent.org/fluent/guide/builtins.html
And wanted to try out the DATETIME() function but I got an error:
[ResolverError(Reference("Unknown function: DATETIME()"))]
I thought maybe it was behind a feature flag but a search or the repo and a quick look at the source code didn't yield anything.
Is this function available in the Rust implementation?
Thank you for your kind words!
Unfortunately, not yet. I'm experimenting with it in https://github.com/zbraniecki/unic-datetime and likely it'll end up being developed as part of https://github.com/unicode-org/icu4x
If you need it now, I'd recommend hooking in https://github.com/google/rust_icu which is a wrapper around ICU4C.
Thanks for the swift reply and the links. I took a quick look at rust_icu and it appears it would be non-trivial to integrate going via fluent (I suppose I would need to define the DATETIME function which would call out to the rust_icu_udat crate). It is not urgent for this project but would love to see it land as part of project fluent! Once my current project is stable I might be able to take a look into it some more and will let you know if I make any progress.
In the meantime it might be worth making a note in the documentation about lack of DATETIME in fluent-rs; thanks very much!
Has there been any recent progress on this?
ICU4X is approaching 1.0 release. Once it is released, we'll be able to add this as an optional dependency and enable dates here.
Any update on this? ICU4X is now at v1.1.0
I have published a crate with the necessary glue: https://docs.rs/fluent-datetime https://lib.rs/crates/fluent-datetime