projectfluent / fluent-rs

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

Is it safe to expose ids? #75

Closed JohnHeitmann closed 5 years ago

JohnHeitmann commented 5 years ago

I got vaguely worried seeing the error fallback of outputting message ids as formatted messages in error cases. I don't think developers will be thinking about their ids being customer visible when they are creating them. I admit I'm hard-pressed to come up with a great example of how this might cause harm, but I wanted to make sure the discussion happened just in case.

Mild worries:

Maybe the Fluent spec itself should call out id-exposing error handling? I'll try to clarify it in the fluent-rs docs.

zbraniecki commented 5 years ago

I don't think developers will be thinking about their ids being customer visible when they are creating them.

This is one of the cornerstones of Fluent design model. Quoting from https://github.com/projectfluent/fluent/wiki/Error-Handling

In the complete breakage scenario where no value can be resolved out of the Message or when no fallback language contains a missing message, Fluent vision is to make bindings return an ID of the message in place of the value, which is a significant improvement for the user over an empty string most translation systems return.

Hope that helps!

JohnHeitmann commented 5 years ago

Yup, that makes sense. It might make sense to also note that behavior briefly in the main reference.