fluent.js icon indicating copy to clipboard operation
fluent.js copied to clipboard

Disabling unicode isolation on per-placeable basis

Open Loskir opened this issue 3 years ago • 2 comments

Is there a way to disable unicode isolation for certain placeables? For example, where I am sure that I'm using <bdi> correctly. But without disabling it everywhere else

Loskir avatar Oct 01 '22 10:10 Loskir

I don't think there is, but I can see a value of such addition. We currently allow to disable it per formatter - so you could create Localization for FluentBundle, disable it for this one, and use it only for this one message.

But if you have ideas for PRs to improve that, I believe @eemeli would consider it!

zbraniecki avatar Oct 01 '22 17:10 zbraniecki

I'm not sure that an option or some other toggle for this would necessarily make sense; we should instead endeavour to make this work automagically.

At the moment, we add the marks unconditionally if useIsolating is set: https://github.com/projectfluent/fluent.js/blob/8c2eae431ef89f22d6d07f860e5043fe4eac3fc3/fluent-bundle/src/resolver.ts#L344-L352

Would it make sense or be sufficient to detect if the stringified value already starts & ends with FSI/PDI before adding those, or would the appropriate conditional here be more complicated?

eemeli avatar Oct 02 '22 17:10 eemeli