Extractor no longer extracts the parameter/expression of the interpolated string into disp attribute
See original GitHub issue🐞 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
<segment>
<source>My name is <ph id="0" equiv="INTERPOLATION" disp=""\uFFFD0\uFFFD""/></source>
</segment>
This used to be
<segment>
<source>My name is <ph id="0" equiv="INTERPOLATION" disp="{{name}};"/></source>
</segment>
🌍 Your Environment
Angular Version:
Angular CLI: 10.1.0
Node: 12.9.1
OS: win32 x64
Angular: 10.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.1001.0
@angular-devkit/build-angular 0.1001.0
@angular-devkit/build-optimizer 0.1001.0
@angular-devkit/build-webpack 0.1001.0
@angular-devkit/core 10.1.0
@angular-devkit/schematics 10.1.0
@ngtools/webpack 10.1.0
@schematics/angular 10.1.0
@schematics/update 0.1001.0
rxjs 6.6.2
typescript 4.0.2
webpack 4.44.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:21 (12 by maintainers)
Top Results From Across the Web
string interpolation - format string output - Microsoft Learn
String interpolation provides a more readable, convenient syntax to format strings. It's easier to read than string composite formatting.
Read more >Extracting the value from a Member Expression that contains a ...
Typically this is done with attributes on the properties, or by basing the query on the other existing C# metadata about the type...
Read more >this expression is not callable. angular - You.com
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...
Read more >LiveLink for MATLAB User's Guide - COMSOL Documentation
Running an M-file in Batch Mode Without Display . . . . . . . . . 185 ... To be able to...
Read more >HSPICE User Guide: Simulation and Analysis - UCSD CSE
String Parameters in Passive and Active Component Keywords . . . . . . . 288 ... HSPICE and AvanWaves extract the design...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey guys, I still have a problem with the “equiv-text” attribute. I am using the latest tag
10.1.6
from the CLI but some translation messages still have incorrect values.eg.:
<ng-container i18n="Update @@update"> <b>{{value1}}:</b> current {{value2}} to new {{value3}} </ng-container>
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:
OK, I worked out what is going on. The localize stuff relies upon a
FileSystem
, which the CLI is mocking up to get everything to work. But… internally the extraction is callingabsoluteFrom()
, which looks for a “current”FileSystem
by callinggetFileSystem()
. This is a kind of global that should be set viasetFileSystem()
before running the localize code.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…