Currently, I'm delving into the realm of internationalization in my Angular2 app by following the official guide provided here.
The structure of my app is as follows:
my-angular2-app | +-- app | | | +-- myComponent | | | | | +-- myComponent.ts | | +-- myComponent.html
Here's what myComponent.ts looks like:
import {Component} from '@angular/core';
@Component({
templateUrl: 'app/myComponent/myComponent.html',
selector: 'my-component'
})
export class MyComponent {}
And this is how myComponent.html appears:
<h3 i18n="User welcome|An introduction header for this sample">Hello i18n!</h3>
However, I've hit a stumbling block while attempting to generate the translation source file using
npm run i18n
During the i18n process which scans for tags, an issue arises where it mistakenly updates a filePath variable. When encountering a component with an i18n tag, it appends the templateUrl specified in the component to the end of the filePath.
In my scenario, the current filePath becomes:
C:/my-angular2-app/app/myComponent
Subsequently, upon finding an i18n tag in myComponent.html, it appends the templateUrl in myComponent.ts resulting in the erroneous filePath:
C:/my-angular2-app/app/myComponent/app/myComponent/myComponent.html
This leads to an error due to the non-existent path:
Error: Compilation failed. Resource file not found: C:/my-angular2-app/app/myComponent/app/myComponent/myComponent.html
I'm unsure if I'm overlooking something or if there might be a bug within Angular2's internationalization feature. Any assistance on this matter would be greatly appreciated!
Much thanks!