fluent-rs icon indicating copy to clipboard operation
fluent-rs copied to clipboard

Implement the DATETIME() builtin function

Open tmpfs opened this issue 5 years ago • 12 comments

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?

tmpfs avatar Jun 16 '20 01:06 tmpfs

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.

zbraniecki avatar Jun 16 '20 01:06 zbraniecki

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!

tmpfs avatar Jun 16 '20 04:06 tmpfs

Has there been any recent progress on this?

TheRawMeatball avatar Jul 29 '22 11:07 TheRawMeatball

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.

zbraniecki avatar Aug 01 '22 10:08 zbraniecki

Any update on this? ICU4X is now at v1.1.0

stevepryde avatar Apr 03 '23 04:04 stevepryde

I have published a crate with the necessary glue: https://docs.rs/fluent-datetime https://lib.rs/crates/fluent-datetime

g2p avatar Oct 29 '23 21:10 g2p