Skip to content

Exclude directories from "ng xi18n" #18885

@schwitin

Description

@schwitin

🚀 Feature request

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Description

The tool parses imported third party modules in node_modules folder too and there is no way to exclude directories from parsing. For example:

create an new app
ng new repro-app

install a third party module
npm @ng-bootstrap/ng-bootstrap

import this module in the app.module.ts

import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
...
imports: [
    ...
      NgbModule
  ]
...

run xi18n
ng xi18n --output-path src/locale --i18n-locale=de

look in the generated messages.xlf

<trans-unit id="ngb.alert.close" datatype="html">
	<source>Close</source>
	<context-group purpose="location">
		<context context-type="sourcefile">node_modules/@ng-bootstrap/ng-bootstrap/alert/alert.d.ts</context>
		<context context-type="linenumber">3</context>
	</context-group>
</trans-unit>

As you cas see the file contains translation units from a third party module although we don,t use it in our templates.

Describe the solution you'd like

A command line parameter --exclude=path/one,path/two will solve my problem. Alternatively (or at once) the parameter --include=path/one, path/two will be helpful.

Describe alternatives you've considered

I could postprocess the messages.xlf with a custom tool to remove unwanted translation units.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions