Skip to content

Commit

Permalink
fix(localize): ensure that formatOptions is optional (#38787)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
petebacondarwin authored and AndrewKushnir committed Sep 10, 2020
1 parent 9078187 commit a47383d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/localize/src/tools/src/extract/main.ts
Expand Up @@ -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':
Expand Down
Expand Up @@ -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);
}

Expand Down
Expand Up @@ -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);
}

Expand Down

0 comments on commit a47383d

Please sign in to comment.