Recently, while developing the VSCode Extension, I discovered an issue where the plugin and WebView sections sometimes share a portion of the code, which happens to contain content that needs to be translated, resulting in the inability to use the l10n provided by VSCode itself
Because some of the WebView pages were developed using Angular, it would be best if a translation could be used for implementation. Therefore, I came up with the localize in Angular to separate modules and make them a universal dependency
With the experience of separating dependency injection , is actually quite simple because it is an independent module, so just find the introduction and extraction parts
The import section is exported intact, while the extraction section uses some self implemented code. However, the related ID generation algorithm remains the same, which means that the translation in Angular can be directly moved here for use
Synchronize updates
Due to the limited number of localize changes, only a small portion has been modified
Using Sync Script And use github actions for update testing
Use i18n ./src Extract all $localize label template contents under src and generate extract.json metadata
> Generate ID consistent with @angular/localize
Copy extract.json custom language translation and write the translation content into the target field
Use i18n convert ./i18n-merge ./i18n Convert translation metadata to key-value format for reference
Custom reference format import translation, such as
Top comments (1)
why use this over ngx-translate or transloco?