New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extractor no longer extracts the parameter/expression of the interpolated string into disp attribute #38711
Comments
Yes this is a different issue
…On Fri, Sep 4, 2020 at 05:22 Sonu Kapoor ***@***.***> wrote:
Hi, @jaska45 <https://github.com/jaska45> Is this different from the
other issue you posted #38711
<#38711>?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#38711 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACM7TWF5K64MEYQNUEDJRXDSEDL2BANCNFSM4QYDAITQ>
.
|
This might be fixed by #38645 I will test later today |
Tested locally and #38645 does appear to fix this issue. Running the commands on the above reproduction results in: <?xml version="1.0" encoding="UTF-8" ?>
<xliff version="2.0" xmlns="urn:oasis:names:tc:xliff:document:2.0" srcLang="en-US">
<file id="ngi18n" original="ng.template">
<unit id="5078016957909331967">
<segment>
<source>My name is <ph id="0" equiv="INTERPOLATION" disp="{{name}}"/></source>
</segment>
</unit>
</file>
</xliff> |
Thank you Pete! |
FYI, the changes from the mentioned PR were merged to master and will be release within 10.1.1 version. Thank you. |
I tested with 10.1.1. It works if the legacy extractor is used. However if I use the ivy option the disp value is not right.
|
@jaska45 - are you talking about the repo you originally posted? In that project I ran:
And I get the desired output. |
Similarly I did:
And again got what I expected. Can you clarify how to reproduce the problem? |
I did the same but got wrong result. |
I just pulled down your updated repo and re-ran the command. This is what I see in <?xml version="1.0" encoding="UTF-8" ?>
<xliff version="2.0" xmlns="urn:oasis:names:tc:xliff:document:2.0" srcLang="en-US">
<file id="ngi18n" original="ng.template">
<unit id="5078016957909331967">
<notes>
<note category="location">src/app/app.component.html:1</note>
</notes>
<segment>
<source>My name is <ph id="0" equiv="INTERPOLATION" disp="{{name}}"/></source>
</segment>
</unit>
</file>
</xliff> This seems correct to me. Can you check that the correct packages are installed by deleting |
You got it right. Did you use Mac? I just tried my repo on Mac and it works. Initially I used Windows 10 where it does not work, even after removing node_modules and reinstalling. I will try on another Windows box. |
I just tried on another Windows and it does not work. I have now tried on two Windows and got the same (wrong) result on both of them. On Mac it works. |
This is the info of my second Windows box.
|
OK, let me test on Windows. It is probably a path thing |
OK, so it is something to do with the CLI integration... on Windows I get the same problem if I use node_modules\.bin\ngc -p tsconfig.app.json
node_modules\.bin\localize-extract -s out-tsc\**\*.js -f xlf2 -o src\locale\messages.xlf This generates the correct output. |
Perhaps @clydin has some ideas? |
OK, I worked out what is going on. The localize stuff relies upon a But CLI is not calling this and so the "current" FileSystem is different to the one being passed in and it is converting backslashes to forward slashes in paths. So the source-maps are not being loaded from the fake file system that the CLI is providing. Arguably the CLI shouldn't have to worry about the "current" FileSystem. I'll look into the best way to fix this... |
These free standing functions rely upon the "current" `FileSystem`, but it is safer to explicitly pass the `FileSystem` into functions or classes that need it. Fixes angular#38711
These free standing functions rely upon the "current" `FileSystem`, but it is safer to explicitly pass the `FileSystem` into functions or classes that need it. Fixes angular#38711
These free standing functions rely upon the "current" `FileSystem`, but it is safer to explicitly pass the `FileSystem` into functions or classes that need it. Fixes angular#38711
Hey guys, I still have a problem with the "equiv-text" attribute. eg.: will be extracted as (with --ivy):
will be extracted as (without --ivy):
Is this an issue in my code or in the cli extraction command? Example Repo https://github.com/Niklas187/ng-xi18n-ivy-bug.git version:
|
@Niklas187 - I just tried you reproduction - it doesn't include the example in you comment so I added that. These are the results I get (on OS/X not Windows): Without ivy: ( <source>
<x id="START_BOLD_TEXT" equiv-text="<b>"/>
<x id="INTERPOLATION" equiv-text="{{value1}}"/>:
<x id="CLOSE_BOLD_TEXT" equiv-text="</b>"/> current
<x id="INTERPOLATION_1" equiv-text="{{value2}}"/> to new
<x id="INTERPOLATION_2" equiv-text="{{value3}}"/>
</source> With ivy: <source>
<x id="START_BOLD_TEXT" equiv-text="<b>{{value1}}"/>
<x id="INTERPOLATION" equiv-text="{{value1}}"/>:
<x id="CLOSE_BOLD_TEXT" equiv-text="</b> "/> current
<x id="INTERPOLATION_1" equiv-text="{value2}} "/> to new
<x id="INTERPOLATION_2" equiv-text="{value3}} "/>
</source> Interestingly this is a bit different from your output but I agree that it is not quite right. It seems that there is some offsetting going on, which is making the start and end points in the Also, this issue is a different problem to what this issue was about, so I'll start a new issue to track this. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 bug report
Is this a regression?
Yes. This used to work in 10.0 and earlier.
Description
Extractor no longer extracts the parameter/expression of the interpolated string into disp attribute
🔬 Minimal Reproduction
Repo is here.
Write an interpolated string that has any parameter. For example
<p i18n>My name is {{name}}</p>
Then run the extractor
ng xi18n --format=xlf2 --output-path src/locale --ivy
The result XLIFF no longer contain disp attribute of it does not contain the parameter/expression used in the interpolated string
This used to be
🌍 Your Environment
Angular Version:
The text was updated successfully, but these errors were encountered: