Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Have sections work more like a PO context #11

Closed
GlenDC opened this issue Dec 2, 2016 · 4 comments
Closed

Have sections work more like a PO context #11

GlenDC opened this issue Dec 2, 2016 · 4 comments

Comments

@GlenDC
Copy link
Contributor

GlenDC commented Dec 2, 2016

Currently sections seem to be only used by toolchains. I think there is however a missed opportunity in this. In PO files they have the concept of a "context", which allows multiple entries with the same id (identifier in L20n, msgid in PO), as long as they have a different context (I'm assuming that an entry is in a default context when none is specified).

I guess you could also go the CSS route where such ambiguity is resolved by having the namespace as part of the name. However, as we already provide a section element, I don't see why we wouldn't also have such entries linked to a section for actual usage in libraries such as L20n.js, and whatever other languages are available.

Reference: https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html (see: msgctxt)

@GlenDC
Copy link
Contributor Author

GlenDC commented Jan 21, 2017

@stasm I've been trying to follow the mailing list of L20n. However I don't really receive my digests often, so I might have missed some discussion about this issue. Has it ever been considered to give context also a meaning in terms of (optional) scoping, when used to reference entities within FTL files. This would help with name conflicts and would avoid people having to name their entities namespace_entity, as people seem to do with CSS.

In case this is an item that is interesting and worthy a discussion, should I re-open this issue in https://github.com/projectfluent/syntax?

@stasm
Copy link
Contributor

stasm commented Jan 23, 2017

Are naming conflicts a common problem? I'd like to think that an easy way of solving them is using short unambiguous prefixes in the identifier: foo-, bar- etc. In gettext, msgctxt is required because there are no identifiers and the translation value serves that purpose.

In projectfluent/fluent#10 we're discussing making sections even simpler than they are right now. That would go against your proposal here, and I'd like to hear your thoughts.

In general, we found that sections-as-namespaces were confusing. In particular, it wasn't clear how a message called foo placed inside of a sec section should be requested from the outside code. We decided that requiring to repeat the section name in every call (e.g. sec/foo, sec/bar etc) would have been too verbose.

@GlenDC
Copy link
Contributor Author

GlenDC commented Jan 23, 2017

I guess that does make sense. I suppose that means that for application libraries (anything that is not tooling), those headers could be ignored? Thanks for clarifying, and I'm all in favor of that proposal. And I do think you're right, it would indeed become a bit verbose. Closing this in favor of your proposal.

@GlenDC GlenDC closed this as completed Jan 23, 2017
@stasm
Copy link
Contributor

stasm commented Jan 23, 2017

I suppose that means that for application libraries (anything that is not tooling), those headers could be ignored?

That's the intent, yes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants