<p dir="auto">We should generate something like:</p>
<div class="highlight highlight-text-xml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;msg id=&quot;...&quot; meaning=&quot;...&quot;&gt;&lt;source&gt;path/to/file.ts:123&lt;/source&gt;This is a message&lt;/msg&gt;"><pre class="notranslate">&lt;<span class="pl-ent">msg</span> <span class="pl-e">id</span>=<span class="pl-s"><span class="pl-pds">"</span>...<span class="pl-pds">"</span></span> <span class="pl-e">meaning</span>=<span class="pl-s"><span class="pl-pds">"</span>...<span class="pl-pds">"</span></span>&gt;&lt;<span class="pl-ent">source</span>&gt;path/to/file.ts:123&lt;/<span class="pl-ent">source</span>&gt;This is a message&lt;/<span class="pl-ent">msg</span>&gt;</pre></div>
<p dir="auto"><code class="notranslate">extractor.ts</code> should take a callback to generated the exact file path from e.g. a <code class="notranslate">ts.SourceFile</code> object or similar, so users can adjust the path to their particular repository format.</p>
<p dir="auto"><strong>I'm submitting a ...</strong>  (check one with "x")</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[ ] bug report =&gt; search github for a similar issue or PR before submitting
[x] feature request
[ ] support request =&gt; Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question"><pre class="notranslate"><code class="notranslate">[ ] bug report =&gt; search github for a similar issue or PR before submitting
[x] feature request
[ ] support request =&gt; Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
</code></pre></div>
<p dir="auto"><strong>Current behavior</strong><br>
At the moment the extract tool generates the id values. The id value depends on the extracted string value. This means that if you change the value (e.g. fix a typo) the id gets changed. This is why our localization tool when scanning XTB or XLF does not use id attribute but the meaning attribute. We use meaning to give a unique and fixed id for each elements. Something like this</p>
<p dir="auto"><code class="notranslate">&lt;p i18n="HeaderText|"&gt;Sample&lt;/p&gt; </code><br>
Now the extract tool gives us following</p>
<p dir="auto"><code class="notranslate">&lt;msg id="8884523860497558714" meaning="HeaderText"&gt;Sample&lt;/msg&gt;</code></p>
<p dir="auto">The meaning value does not change unless the developer explicitly changes it. In addition the above meaning value “HeaderText” is much more informative as “8884523860497558714”.<br>
Unfortunately it is hard to get meaning values unique among all templates.</p>
<p dir="auto"><strong>Expected behavior</strong><br>
It would help a lot if the extracting tool would write the relative path name of the template file (.html or .ts) where the string comes from. Something like this</p>
<p dir="auto"><code class="notranslate">&lt;msg id="8884523860497558714" meaning="header" source="src/app/admin/main.html"&gt;Sample&lt;/msg&gt;</code></p>
<p dir="auto">Where the source attributes contains the file name where the string comes from. Now our tool could get a unique if by combining source and meaning values. Because the meaning values would need to be unique only within the single template it would be a lot easier for the developer to maintain them.</p>
<p dir="auto"><strong>What is the motivation / use case for changing the behavior?</strong><br>
To make Angular 2 localization easier and increase the translation quality</p>
<p dir="auto"><strong>Please tell us about your environment:</strong></p>
<ul dir="auto">
<li>
<p dir="auto"><strong>Angular version:</strong> 2.0.X<br>
All</p>
</li>
<li>
<p dir="auto"><strong>Browser:</strong> [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]<br>
All</p>
</li>
<li>
<p dir="auto"><strong>Language:</strong> [all | TypeScript X.X | ES6/7 | ES5]<br>
All</p>
</li>
<li>
<p dir="auto"><strong>Node (for AoT issues):</strong> <code class="notranslate">node --version</code> =<br>
All</p>
</li>
</ul>