wichert / lingua

Translation toolkit for Python
Other
45 stars 32 forks source link

Domain not respected when extracting strings marked with translationstring package. #68

Closed piotr-dobrogost closed 8 years ago

piotr-dobrogost commented 8 years ago

It looks like strings marked with translationstring package:

from translationstring import TranslationStringFactory
_ = TranslationStringFactory('domainX')
a = _(u'b')

are being extracted when extracting with different domain set (pot-create -d domainY (...)).

Is this even possible to take domain into account in such scenario?

This is analogues to issue #66.

wichert commented 8 years ago

Yes, and that is by design: there is no way for lingua to detect what the domain for a message factory such as your _ is. It would have to actually run your Python code to be able to do that, which is out of scope. For that reason I am going to close this ticket.

In situations where I have code which users messages from another domain is to use a different factory name so lingua skips it. For example:

from otherpackage.i18n import _ as O_MSG

a = O_MSG(u'b')
piotr-dobrogost commented 8 years ago

Thank you for clarification and workaround. I bet it's not the first time someone asks about this. In case you know about any discussion on this subject I would be grateful for passing links.