Skip to content

Commit

Permalink
fix(sync): bug with undefined message
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Savoskin committed Jun 17, 2019
1 parent b402fbc commit 89bae28
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/commands/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,9 @@ export default class Extract extends Base {
}

const locales = langs.split(',');
this.messages = locales.reduce(
(acc, locale) => {
acc[locale] = {};
return acc;
},
{} as { [locale: string]: { [id: string]: Message } },
);
locales.forEach(locale => {
this.messages[locale] = {};
});

await this.provider.getKeys(locales);
await Promise.all(locales.map(locale => this.mergeToFile(locale)));
Expand All @@ -108,7 +104,7 @@ export default class Extract extends Base {
showInfo(`New translation keys: ${newMessages.length}`);
if (provider === 'locize') {
await asyncForEach(locales, locale =>
this.provider!.uploadMessages(newMessages.map(id => this.messages[locale][id]), locale),
this.provider!.uploadMessages(newMessages.map(id => this.messages[locale][id]).filter(Boolean), locale),
);
} else {
await this.provider.uploadMessages(newMessages.map(id => this.messages[locales[0]][id]), 'en');
Expand Down

0 comments on commit 89bae28

Please sign in to comment.