Ticket #2584 (closed defect: fixed)
<% _t() %> gets wrong filename namespace in includes
| Reported by: | ischommer | Owned by: | ischommer |
|---|---|---|---|
| Priority: | medium | Milestone: | 2.3.1 |
| Component: | i18n | Version: | 2.2.2 |
| Severity: | medium effort / impact | Keywords: | |
| Cc: | sminnee, mpeel | Hours: |
Description
<% _t() %> gets wrong filename namespace in includes, which essentially means you can't use translation in template includes. Example:
Outer.ss
<% _t('A') %>
<% include Inner %>
Inner.ss
<% _t('B') %>
Parsed in SSViewer into:
<% _t('A') %>
<% _t('B') %>
Which means the "B" entity is looked up under $langde_DE?Outer.ss?B? in the lang table, rather than the correct $langde_DE?Inner.ss?B?. i18n::textcollector() parses includes separately, so the master entity table has the right namespace ($langen_US?Inner.ss?B?).
As includes can be used in many templates, we can't adjust textcollector - even if we could pull it off, we'd get duplicate entities all over the place. The only solution i see is adjusting SSViewer to store compiled includes separately and use PHP include() statements in the outer templates- sam, what do you think?
