fourcube / omnixlf

Simple XLF translation editor powered by electron.
http://www.omnixlf.com
8 stars 3 forks source link

Missing Interpolated Text #6

Open karan-kang opened 6 years ago

karan-kang commented 6 years ago

Issue: OmniXlf omits the Angular Interpolation strings from the source and translation fields.

Xliff Trans Unit:

<trans-unit id="labelWaiveFailed" datatype="html">
    <source>Waive <x id="INTERPOLATION" equiv-text="{{data.number}}"/> Failed.</source>
    <target state="translated">放弃  失败。<x id="INTERPOLATION"/>
    </target>
    <context-group purpose="location">
        <context context-type="sourcefile">app/schedule/message/scheduleMessage.component.ts</context>
        <context context-type="linenumber">10</context>
    </context-group>
</trans-unit>

OmniXlf shows this trans unit as following:

ID: labelWaiveFailed
Source: Waive Failed.
Translation: 放弃  失败。

In comparison, a tool like Virtaal shows the source and translation as following:

ID: labelWaiveFailed
Source: Waive [INTERPOLATION] Failed.
Translation: 放弃  失败 [INTERPOLATION]。
fourcube commented 6 years ago

Thank you for reporting this. This is related to #1 since OmniXLF omits all nested tags inside a translation unit. The way I am working around this, is by splitting translation units that contain interpolated content into multiple elements.

<div i18n="@@test">This {{item.value}} should be translated.</div>

becomes

<div>
<ng-container i18n="@@test_p01">This </ng-container>
{{item.value}}
<ng-container i18n="@@test_p02"> should be translated</ng-container>
</div>

I know this is really inconvenient, but I have not gotten around to implementing a proper solution just yet.