-
Notifications
You must be signed in to change notification settings - Fork 80
Decouple message attributes from DOM attributes #437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It'd seem simpler to add support for (1) self-attribute-references (so I can express that All that said, I'm confused why we're having this conversation at all, for a few reasons:
|
OT, but I feel it's necessary to clear this up. That will be always a nightmare. If you have one term and 100 messages referencing that term, and change the term from "Preferences" to "Settings", you have two options: Option b) is probably the one I'd go with, although not ideal. And we might have to deal with that, if they ever decide to change the brand name from |
Thanks for sharing your thoughts, @gijsk. I agree that this solution might put too much control in the hands of developers and lead to a single message being reused in too many places. The point that you made about accesskeys and their being context-unique is also a very good one. Another reason to discourage for reusing translations in more than one place. I filed this issue prompted by the discussion in bug 1600528 and I realize that I didn't make it clear enough that I had been thinking about this problem for much longer than just this morning, and also not in the context of translations shared by more than one UI widget, but instead in the context of change happening over time. Unfortunately, I think change over time will always be messy to some extent:
I don't mean to revisit the entire design on Fluent's DOM bindings here, but I do think it valuable to recognize its limitations, try to find remedies to them, or maybe document good practices which somehow alleviate them. And I also think beyond Firefox, where it might be harder to run migrations as we do. |
I think we should investigate making this less of a mess, like (and I spent maybe 2 minutes thinking about this, so it's probably a terrible idea, but you get my drift): having a staging for a migration where someone checks that it produces reasonable results but doesn't commit, and then queueing the migration with some system (I'm not super familiar with our l10n infra, so maybe this should be pontoon but maybe something else) and having that system run all queued migrations automatically at a "quiet" time, automatically turning pontoon sync off and back on. :-) |
@flodolo - I disagree with you. We do have a solution to that - projectfluent/fluent#141 It's an example of a scenario where the old string does work (and should be preferred over fallback locale), but we need to notify the localizers that they may want to update the translations (some will, some will just mark their translation as up to date). |
Uh oh!
There was an error while loading. Please reload this page.
The current design of DOM and React bindings tends to create a tight coupling in the long term between Fluent messages and the UI widgets they localize. The attributes found on compound messages are used to localize DOM attributes and React props with the same names.
The tight coupling contributes to the accruing of technical debt. It discourages from making changes to the source element to avoid breaking its translations or the need to migrate them to the new structure.
To remedy this situation, I wonder if it would be a good idea to change the bindings to expose in the source a way to map DOM attributes to Fluent message attributes (or the other way around).
For example, the following message could then be used to localize a number of different elements, either at the same time, or as a function of time.
Then, using
@fluent/dom
:Or using
@fluent/react
:Compound messages adapted to this usage pattern would likely only use attributes because the message value would not be "mappable"
The text was updated successfully, but these errors were encountered: