Skip to content

Commit ce41c4d

Browse files
committed
fix(suite, suite-data): adjust backport-en script to changes in messages.ts
1 parent c52fb8d commit ce41c4d

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

packages/suite-data/src/translations/backport-en.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ fs.writeFileSync(
3838
`
3939
import { defineMessages } from 'react-intl';
4040
41-
export default defineMessages(${JSON.stringify(messages, null, 2).replace(/"([^"]+)":/g, '$1:')})
41+
import { defineMessagesWithTypeCheck } from './utils';
42+
43+
const messages = defineMessagesWithTypeCheck(${JSON.stringify(messages, null, 2).replace(/"([^"]+)":/g, '$1:')})
4244
4345
`,
4446
);

packages/suite/src/support/messages.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
import { defineMessages } from 'react-intl';
22

3-
type MessageDescriptor<K extends string> = {
4-
// Must correspond to the property name.
5-
id: K;
6-
// Default text in English. This value is only used directly if the corresponding key is missing from the JSON translation files.
7-
defaultMessage: string;
8-
// Not integrated into Crowdin so not really used.
9-
description?: string;
10-
// Must be set to true for programmatically constructed keys. Otherwise, the keys will be deleted by the list-duplicates script.
11-
dynamic?: boolean;
12-
};
13-
14-
/**
15-
Checks whether id corresponds to the property name. Otherwise, text is not translated. Returns the same value that was passed in.
16-
*/
17-
const defineMessagesWithTypeCheck = <Key extends string>(messages: {
18-
[K in Key]: MessageDescriptor<K>;
19-
}) => messages;
3+
import { defineMessagesWithTypeCheck } from './utils';
204

215
const messages = defineMessagesWithTypeCheck({
226
TR_404_DESCRIPTION: {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
type MessageDescriptor<K extends string> = {
2+
// Must correspond to the property name.
3+
id: K;
4+
// Default text in English. This value is only used directly if the corresponding key is missing from the JSON translation files.
5+
defaultMessage: string;
6+
// Not integrated into Crowdin so not really used.
7+
description?: string;
8+
// Must be set to true for programmatically constructed keys. Otherwise, the keys will be deleted by the list-duplicates script.
9+
dynamic?: boolean;
10+
};
11+
12+
/**
13+
Checks whether id corresponds to the property name. Otherwise, text is not translated. Returns the same value that was passed in.
14+
*/
15+
export const defineMessagesWithTypeCheck = <Key extends string>(messages: {
16+
[K in Key]: MessageDescriptor<K>;
17+
}) => messages;

0 commit comments

Comments
 (0)