Skip to content

Commit 5e127e0

Browse files
author
Anton Savoskin
committed
feat(sync): add messages in console about sync process
1 parent a337a39 commit 5e127e0

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/commands/sync.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ export default class Extract extends Base {
5959
}
6060

6161
async run() {
62-
const {
63-
flags: { langs, provider, projectId, token, version, namespace, uploadTranslations },
64-
} = this.parse(Extract);
62+
showInfo('Start sync messages');
63+
const { flags } = this.parse(Extract);
64+
const { langs, provider, projectId, token, version, namespace, uploadTranslations } = flags;
6565
const locales = langs.split(',');
6666
const defaultLocale = head(locales);
6767

@@ -95,5 +95,6 @@ export default class Extract extends Base {
9595
);
9696
}
9797
}
98+
showInfo('Finish sync messages');
9899
}
99100
}

src/providers/locize.ts

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export class Locize implements Provider {
1919
) {}
2020

2121
async getKeys(locales: string[]) {
22+
showInfo('Start fetching messages from Locize');
2223
const headers = { 'content-type': 'application/json' };
2324
return asyncForEach(locales, async (locale: string) => {
2425
try {
@@ -27,6 +28,7 @@ export class Locize implements Provider {
2728
url: `${BASE_URL}/${this.projectId}/${this.version}/${locale}/${this.namespace}`,
2829
method: 'GET',
2930
});
31+
showInfo('Finish fetching messages from Locize');
3032
} catch (e) {
3133
showError(`Error while fetching strings from locize\n${e}`);
3234
}

src/providers/lokalise.ts

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export class Lokalise implements Provider {
5959
constructor(private defaultLocale?: string, private projectId?: string, private token?: string) {}
6060

6161
async getKeys() {
62+
showInfo('Start fetching messages from Lokalise');
6263
const headers = { 'x-api-token': this.token, 'content-type': 'application/json' };
6364
try {
6465
const response = await request<LocalizeResponse>({
@@ -68,6 +69,7 @@ export class Lokalise implements Provider {
6869
qs: { include_translations: '1', limit: 5000 },
6970
});
7071
this.lokaliseKeys = response.keys;
72+
showInfo('Finish fetching messages from Lokalise');
7173
} catch (e) {
7274
showError(`Error while fetching strings from lokalise\n${e}`);
7375
}

0 commit comments

Comments
 (0)