Skip to content

<![CDATA[]]>in system.xml translate phrase not work  #7767

Closed
@PiscesThankIT

Description

@PiscesThankIT

Preconditions

php 5.6.19
Magento 2.1.2

Steps to reproduce

create a module which has system.xml
In the system.xml, I have a field:

<field id="test" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Test phrases</label>
                    <attribute type="shared">1</attribute>
                    <comment>
                    <![CDATA[This is for wq test!
                    <a href="https://developer.paypal.com/docs/classic/express-checkout/in-context/" target="_blank">here</a>.]]>
                    </comment>
</field>

I use the command to collect the phrases

i18n:collect-phrases -o "zh_Hans_CN.csv"  mymodule/dir

I get the csv file. In this file, I see:


                    This is for wq test!
                    <a href=""https://developer.paypal.com/docs/classic/express-checkout/in-context/"" target=""_blank"">here</a>.
                    ","
                    This is for wq test!
                    <a href=""https://developer.paypal.com/docs/classic/express-checkout/in-context/"" target=""_blank"">here</a>.
                    "

There is a line feed and some spaces before the phrase.
I change the second column to add some Chinese words.


                    This is for wq test!
                    <a href=""https://developer.paypal.com/docs/classic/express-checkout/in-context/"" target=""_blank"">here</a>.
                    ","
                    This is for wq test!应该看到我
                    <a href=""https://developer.paypal.com/docs/classic/express-checkout/in-context/"" target=""_blank"">here</a>.
                    "

I put this file in correct place and change the local language. Other simple phrases can be translated correctly, but the phrase in CDATA doesn't change.

Then I delete the line feed and spaces:

"This is for wq test!<a href=""https://developer.paypal.com/docs/classic/express-checkout/in-context/"" target=""_blank"">here</a>.","This is for wq test!按道理应该看到我<a href=""https://developer.paypal.com/docs/classic/express-checkout/in-context/"" target=""_blank"">here</a>."

I ran setup:upgrade to make Magento use new translation. But It still doesn't work!

Another test about translate

echo __('This is for wq 
            test!');

Just for test line feed in csv file.

Collect phrases:

"This is for wq 
            test!","This is for wq 
            test!"

change this to

"This is for wq 
            test!","This is for wq 
            test!按照道理我会出来"

It works!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasebug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions