Skip to content

Commit 8829286

Browse files
author
Anton Savoskin
committed
fix(sync): value return from locize service
1 parent 4c64717 commit 8829286

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/providers/locize.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { Provider } from './provider';
22
import { asyncForEach, request, showError, showInfo } from '../utils';
33
import { Message } from '../types';
44

5-
type LocizeKeys = { [key: string]: { value: string; context: { text: string } } };
5+
type LocizeKeys = { [key: string]: string };
6+
type LocizeUploadKeys = { [key: string]: { value: string; context: { text: string } } };
67

78
const BASE_URL = 'https://api.locize.io';
89

@@ -34,7 +35,7 @@ export class Locize implements Provider {
3435
getMessage(locale: string, id: string) {
3536
const key = Object.keys(this.locizeKeys[locale]).find(key => key === id);
3637
if (key) {
37-
return this.locizeKeys[locale][key].value;
38+
return this.locizeKeys[locale][key];
3839
}
3940
if (locale === 'en') {
4041
this.newMessages.push(id);
@@ -49,7 +50,7 @@ export class Locize implements Provider {
4950
acc[id] = { value: message || defaultMessage, context: { text: description || '' } };
5051
return acc;
5152
},
52-
{} as LocizeKeys,
53+
{} as LocizeUploadKeys,
5354
);
5455
try {
5556
const response = await request<string>({

test/commands/sync.test.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,7 @@ describe('sync locize', () => {
7979
});
8080
test
8181
.env({ PROJECT_ID: projectId, TOKEN: token })
82-
.nock('https://api.locize.io', api =>
83-
api
84-
.get(`/${projectId}/latest/en/test`)
85-
.reply(200, { welcome: { context: { text: 'Welcome message' }, value: 'Hello!' } }),
86-
)
82+
.nock('https://api.locize.io', api => api.get(`/${projectId}/latest/en/test`).reply(200, { welcome: 'Hello!' }))
8783
.stderr()
8884
.command(['sync', '--messagesDir', messagesDir, '--provider', 'locize'])
8985
.it('update local message from locize', ctx => {

0 commit comments

Comments
 (0)