wichert / lingua

Translation toolkit for Python
Other
45 stars 32 forks source link

Warn about mismatch in mapping of dynamic content. #61

Closed fschulze closed 8 years ago

fschulze commented 8 years ago

If this looks good to you, I'll add tests.

wichert commented 8 years ago

I'm trying to see what error this tries to catch. Looking at the code this will report something simple like <p>I count ${count} items</p> as an error?

fschulze commented 8 years ago

Yes, because it won't work. At least it doesn't for me. It will just write the string ${count} and not replace it with the proper value. At least for translated messages. For the original empty message which uses the template default it works.

For me it only works in all cases when using something like:

<p>I count <span tal:replace="count" i18n:name="count" /> items</p>

Maybe this is a bug in Chameleon?

wichert commented 8 years ago

I use that pattern a lot, and it always works flawlessly for me. If it doesn't work for you this is most likely to do translationstring not working correctly for you. If you can provide a test case, for example a one-page pyramid app, I can look into it.

I'm going close this ticket, since this is not a lingua bug.

fschulze commented 8 years ago

I just noticed it happened with a Python expression: ${context.title} maybe it only works with single names, not Python expressions? I'll try to look into it.

wichert commented 8 years ago

Works just fine on Python expressions. All my forms use things like <label>${field.label}</label>.