Skip to content

AOT build with angular i18n #30

@sandrasie

Description

@sandrasie

We are currently trying to get our AOT build to work with i18n.
The Angular i18n docs (https://angular.io/guide/i18n) say ngc needs some arguments to make AOT include translation files:
./node_modules/.bin/ngc --i18nFile=./locale/messages.es.xlf --locale=es --i18nFormat=xlf

We found that NgcWebpackPlugin has an option called cliOptions that gets transformed to a instance of NgcCliOptions. So we tried to configure NgcWebpackPlugin in our webpack config as follows:

   new ngcWebpack.NgcWebpackPlugin({
        disabled: !AOT,
        tsConfig: helpers.root('tsconfig.webpack.json'),
        resourceOverride: helpers.root('config/resource-override.js'),
        cliOptions: {
            i18nFormat: 'xtb',
            i18nFile: './i18n/messages.en.xtb',
            locale: 'en',
        }
      })

But nothing happens... no error but also no translations. Are we missing something? Is anything wrong with options object? We couldn't find any examples out there. Or is there anything else we need to do or include to get translations compiled into the AOT build?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions