JoostK 2484ba4f05 refactor(compiler-cli): prepare linker options for compilation of components (#39707)
This commit adds the `i18nUseExternalIds` option to the linker options,
as the compliance tests exercise compilation results with and without
this flag enabled. We therefore need to configure the linker to take
this option into account, as otherwise the compliance test output would
not be identical.

Additionally, this commit switches away from spread syntax to set
the default options. This introduced a problem when the user-provided
options object did specify the keys, but with an undefined value. This
would have prevented the default options from being applied.

PR Close #39707
2020-11-24 13:05:44 -08:00

40 lines
1.0 KiB
TypeScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Options to configure the linking behavior.
*/
export interface LinkerOptions {
/**
* Whether to generate legacy i18n message ids.
* The default is `true`.
*/
enableI18nLegacyMessageIdFormat: boolean;
/**
* Whether to convert all line-endings in ICU expressions to `\n` characters.
* The default is `false`.
*/
i18nNormalizeLineEndingsInICUs: boolean;
/**
* Whether translation variable name should contain external message id
* (used by Closure Compiler's output of `goog.getMsg` for transition period)
* The default is `false`.
*/
i18nUseExternalIds: boolean;
}
/**
* The default linker options to use if properties are not provided.
*/
export const DEFAULT_LINKER_OPTIONS: LinkerOptions = {
enableI18nLegacyMessageIdFormat: true,
i18nNormalizeLineEndingsInICUs: false,
i18nUseExternalIds: false,
};