projectfluent / fluent-rs

Rust implementation of Project Fluent
https://projectfluent.org
Apache License 2.0
1.04k stars 95 forks source link

Conversion between .ftl and .po file #237

Closed simrankedia closed 1 year ago

simrankedia commented 2 years ago

Hi,

I am planning to use fluent-bundle for a localisation project in Rust. The features supported fits perfectly with my requirement. However, there is one major caveat - the translated files I will receive is supposed to be in .po format. Are there tools available to convert .ftl format to .po format?

alerque commented 2 years ago

Which direction do you need to convert? poftl might be possible, but ftlpo is highly unlikely to get vary far. Fluent is simply a much more expressive format and if any of that expressiveness at all is used it simply can't be squashed back into po.

simrankedia commented 2 years ago

I need either way - basically generate ftl -> po-> translators -> po -> ftl. Can you direct me to any tools available for po -> ftl? Also any starting point for the reverse conversion?

gregtatum commented 1 year ago

Yeah I don't think there is one, and I don't know think one would live in fluent-rs. This seems like something that could be maintained as a separate tool.

alerque commented 1 year ago

For anybody researching this, keep in mind that it would be impossible for any such tool to be lossless and support all Fluent features. I think it would be possible to support all PO functionality using a subset of Fluent, but not the other way around.

gregtatum commented 1 year ago

Also for other prior art see https://github.com/mozilla/properties-to-ftl

This is Mozilla's tool for helping with migrating from .properties files to .ftl.