fix(localize): ensure that `formatOptions` is optional (#38787)
Some lower level APIs are used by CLI, and requiring the `formatOpions` argument at that level is a breaking change. This commit makes it optional at every level to avoid the breaking change. PR Close #38787
This commit is contained in:
parent
d1415162cb
commit
ce1efc1af2
|
@ -208,7 +208,7 @@ export function extractTranslations({
|
|||
|
||||
export function getSerializer(
|
||||
format: string, sourceLocale: string, rootPath: AbsoluteFsPath, useLegacyIds: boolean,
|
||||
formatOptions: FormatOptions): TranslationSerializer {
|
||||
formatOptions: FormatOptions = {}): TranslationSerializer {
|
||||
switch (format) {
|
||||
case 'xlf':
|
||||
case 'xlif':
|
||||
|
|
|
@ -27,7 +27,7 @@ const LEGACY_XLIFF_MESSAGE_LENGTH = 40;
|
|||
export class Xliff1TranslationSerializer implements TranslationSerializer {
|
||||
constructor(
|
||||
private sourceLocale: string, private basePath: AbsoluteFsPath, private useLegacyIds: boolean,
|
||||
private formatOptions: FormatOptions) {
|
||||
private formatOptions: FormatOptions = {}) {
|
||||
validateOptions('Xliff1TranslationSerializer', [['xml:space', ['preserve']]], formatOptions);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ export class Xliff2TranslationSerializer implements TranslationSerializer {
|
|||
private currentPlaceholderId = 0;
|
||||
constructor(
|
||||
private sourceLocale: string, private basePath: AbsoluteFsPath, private useLegacyIds: boolean,
|
||||
private formatOptions: FormatOptions) {
|
||||
private formatOptions: FormatOptions = {}) {
|
||||
validateOptions('Xliff1TranslationSerializer', [['xml:space', ['preserve']]], formatOptions);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue