daniel-sc / ng-extract-i18n-merge

Extract and merge i18n xliff translation files for angular projects.
MIT License
179 stars 19 forks source link

Allow to provide options to builderI18n #85

Open phipla opened 1 year ago

phipla commented 1 year ago

Is your feature request related to a problem? Please describe.

We use ngx-build-plus to provide extra webpack config options to our Angular build. The relevant configuration below.

         "extract-i18n": {
             "executor": "ngx-build-plus:extract-i18n",
             "options": {
                 "browserTarget": "myapp:build",
                 "extraWebpackConfig": "tools/webpack-version.partial.js",
                 "outputPath": "src/locale"
             }
         },

We used to have a second phase using xliffmerge from https://github.com/martinroob/ngx-i18nsupport/tree/master/projects/xliffmerge . However, this project does not seem maintained anymore, and we would like to switch to ng-extract-i18n-merge.

The modified configuration is below. However, this configuration lacks the ability to pass the extraWebpackConfig option to the executor, and the build fails

        "extract-i18n": {
            "executor": "ng-extract-i18n-merge:ng-extract-i18n-merge",
            "options": {
                "browserTarget": "myapp:build",
                "builderI18n": "ngx-build-plus:extract-i18n",
                "format": "xlf",
                "outputPath": "src/locale",
                "targetFiles": [
                    "../../apps/myapp/src/locale/messages.en.xlf",
                    "../../apps/myapp/src/locale/messages.es.xlf",
                    "../../apps/myapp/src/locale/messages.de.xlf",
                    "../../apps/myapp/src/locale/messages.it.xlf"
                ],
                "sourceFile": "../../apps/myapp/src/locale/messages.xlf"
            }
        }

Describe the solution you'd like

Adding builderI18nOptions, if possible, would solve our problem:

        "extract-i18n": {
            "executor": "ng-extract-i18n-merge:ng-extract-i18n-merge",
            "options": {
                "browserTarget": "myapp:build",
                "builderI18n": "ngx-build-plus:extract-i18n",
                "builderI18nOptions": {
                    "extraWebpackConfig": "tools/webpack-version.partial.js"
                },
                // ...
            }
        }

Describe alternatives you've considered

Manually calling https://github.com/daniel-sc/xliff-simple-merge#readme for now

Additional context

daniel-sc commented 1 year ago

@phipla thanks for this detailed request! I think this would be a meaningful addition. Would you like to make a PR for this?

phipla commented 1 year ago

Sure, I will try! It might take me a few weeks to find time to do so, though.