projectfluent/fluent

Feature request: Fluent implementation for Java and other JVM languages

ExE-Boss opened this issue · 4 comments

Given that the Android frontend is implemented in Java, this will probably be necessary in order to use Fluent on Android.

See also #93 (comment):

It would also be useful to have this implemented in Java as well.

We talked a bit about this recently, and our initial take was to consider Kotlin rather than Java. Do you have an opinion on Kotlin as a target?

Well, Kotlin runs on the JVM, so it should be rather compatible with Java, although it might possibly need a few helper classes, similar to when dealing with Java ⇔ Scala calls. Granted, the need for those has significantly lessened since Java 8 and Scala 2.12.

stasm commented

We already have a WIP implementation of Fluent in https://github.com/projectfluent/fluent-rs. Do you mean that we could use FFI to use it from Android's Java code?

I would personally prefer if it was a full implementation entirely in Java, but official JNI bindings for fluent‑rs would work too (albeit a bit more limited, as the Rust binaries would have to be compiled for all target platforms, whereas a Java only implementation would work on any platform that has a JVM without needing recompilation).

stasm commented

That's good to know, thanks. JVM is not among our top-tier targets and we don't have enough people on the team to commit to a Java- or Kotlin-based implementation right now. If you're interested in working on one, I'll be more than happy to try to promote it among friends of Fluent.

OTOH, fluent-rs is becoming more and more important for us. It might even become the main implementation of Fluent used in Gecko in the not-so-distant future. If the limitations of the JNI are acceptable for your use-case, fluent-rs might be a good solution. @zbraniecki and @unclenachoduh will know more :)

I'm going to close this issue for now. I added the Other Implementations section to the README to increase the visibility of this issue and to signal that we're interested in seeing a community-driven implementation in Java or Kotlin.

Thanks!

In case this is still relevant for any of the participants, here are WIP JNI bindings to fluent-rs. I will probably start publishing snapshots/alpha versions in the near future. I don't know anything about Android, but making this Android compatible should be fairly straight-forward. So if anyone wants to assist there, feel free to do so.