@discord/intl-message-database 0.33.2 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +49 -1
- package/package.json +11 -11
package/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare function parseJson(text: string): Message[]
|
|
|
12
12
|
export declare function parseJsonFile(filePath: string): Message[]
|
|
13
13
|
export declare class IntlMessagesDatabase {
|
|
14
14
|
constructor()
|
|
15
|
+
extractFileContentWithDiagnostics(filePath: string, content: string): IntlExtractionReport
|
|
15
16
|
findAllMessagesFiles(directories: Array<string>, defaultDefinitionLocale: string): Array<IntlMessagesFileDescriptor>
|
|
16
17
|
filterAllMessagesFiles(files: Array<string>, defaultDefinitionLocale: string): Array<IntlMessagesFileDescriptor>
|
|
17
18
|
processAllMessagesFiles(directories: Array<IntlMessagesFileDescriptor>, strategy: IntlDatabaseInsertStrategy): Array<IntlSourceFileInsertionData>
|
|
@@ -42,6 +43,7 @@ export declare class IntlMessagesDatabase {
|
|
|
42
43
|
precompileToBuffer(filePath: string, locale: string, options?: IntlMessageBundlerOptions | undefined | null): Buffer
|
|
43
44
|
validateMessages(): Array<IntlDiagnostic>
|
|
44
45
|
exportTranslations(fileExtension?: string | undefined | null): Array<string>
|
|
46
|
+
dumpAsCsvs(outputDirectory: string): void
|
|
45
47
|
getSourceFileMessageValues(filePath: string): Record<string, IntlMessageValue | undefined>
|
|
46
48
|
}
|
|
47
49
|
|
|
@@ -55,7 +57,8 @@ export declare const enum IntlCompiledMessageFormat {
|
|
|
55
57
|
export declare const enum IntlDatabaseInsertStrategy {
|
|
56
58
|
Create = 0,
|
|
57
59
|
Update = 1,
|
|
58
|
-
Replace = 2
|
|
60
|
+
Replace = 2,
|
|
61
|
+
ReplaceAllowingDuplicates = 3
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
export interface IntlDiagnostic {
|
|
@@ -80,6 +83,36 @@ export interface IntlDiagnosticFix {
|
|
|
80
83
|
replacement: string
|
|
81
84
|
}
|
|
82
85
|
|
|
86
|
+
export interface IntlExtractedFileMeta {
|
|
87
|
+
description: string | null
|
|
88
|
+
secret: boolean
|
|
89
|
+
translate: boolean
|
|
90
|
+
tags: string[] | null
|
|
91
|
+
translationsPath: string
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface IntlExtractedMessage {
|
|
95
|
+
key: string
|
|
96
|
+
text: string
|
|
97
|
+
meta: IntlExtractedMessageMeta | null
|
|
98
|
+
position: IntlSourcePosition
|
|
99
|
+
sourceOffsets: Array<[number, number]>
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface IntlExtractedMessageMeta {
|
|
103
|
+
description: string | null
|
|
104
|
+
secret: boolean
|
|
105
|
+
translate: boolean
|
|
106
|
+
tags: string[] | null
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface IntlExtractionReport {
|
|
110
|
+
meta: IntlExtractedFileMeta | null
|
|
111
|
+
messages: Array<IntlExtractedMessage>
|
|
112
|
+
diagnostics: Array<IntlSourceDiagnostic>
|
|
113
|
+
complete: boolean
|
|
114
|
+
}
|
|
115
|
+
|
|
83
116
|
export interface IntlMessage {
|
|
84
117
|
/** Original, plain text name of the message given in its definition. */
|
|
85
118
|
key: string
|
|
@@ -117,6 +150,15 @@ export interface IntlMessageValue {
|
|
|
117
150
|
filePosition: object
|
|
118
151
|
}
|
|
119
152
|
|
|
153
|
+
export interface IntlSourceDiagnostic {
|
|
154
|
+
code: 'ParseError' | 'InvalidUnicode' | 'IgnoredMetadata' | 'UnsupportedForm'
|
|
155
|
+
file: string
|
|
156
|
+
line: number
|
|
157
|
+
column: number
|
|
158
|
+
span: [number, number]
|
|
159
|
+
message: string
|
|
160
|
+
}
|
|
161
|
+
|
|
120
162
|
export interface IntlSourceFile {
|
|
121
163
|
type: string
|
|
122
164
|
file: string
|
|
@@ -151,6 +193,12 @@ export interface IntlSourceFileMeta {
|
|
|
151
193
|
tags?: Array<string>
|
|
152
194
|
}
|
|
153
195
|
|
|
196
|
+
export interface IntlSourcePosition {
|
|
197
|
+
file: string
|
|
198
|
+
line: number
|
|
199
|
+
col: number
|
|
200
|
+
}
|
|
201
|
+
|
|
154
202
|
export declare function isMessageDefinitionsFile(key: string): boolean
|
|
155
203
|
|
|
156
204
|
export declare function isMessageTranslationsFile(key: string): boolean
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@discord/intl-message-database",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Rust-based Node extension module for parsing, extracting, and managing messages and translations across a project.",
|
|
6
6
|
"author": "Jon Egeland",
|
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
"url": "https://github.com/discord/discord-intl"
|
|
16
16
|
},
|
|
17
17
|
"optionalDependencies": {
|
|
18
|
-
"@discord/intl-message-database-
|
|
19
|
-
"@discord/intl-message-database-
|
|
20
|
-
"@discord/intl-message-database-
|
|
21
|
-
"@discord/intl-message-database-
|
|
22
|
-
"@discord/intl-message-database-linux-x64-gnu": "0.
|
|
23
|
-
"@discord/intl-message-database-linux-x64-musl": "0.
|
|
24
|
-
"@discord/intl-message-database-win32-arm64-msvc": "0.
|
|
25
|
-
"@discord/intl-message-database-win32-
|
|
26
|
-
"@discord/intl-message-database-win32-
|
|
18
|
+
"@discord/intl-message-database-linux-arm64-musl": "0.34.0",
|
|
19
|
+
"@discord/intl-message-database-linux-arm64-gnu": "0.34.0",
|
|
20
|
+
"@discord/intl-message-database-darwin-x64": "0.34.0",
|
|
21
|
+
"@discord/intl-message-database-darwin-arm64": "0.34.0",
|
|
22
|
+
"@discord/intl-message-database-linux-x64-gnu": "0.34.0",
|
|
23
|
+
"@discord/intl-message-database-linux-x64-musl": "0.34.0",
|
|
24
|
+
"@discord/intl-message-database-win32-arm64-msvc": "0.34.0",
|
|
25
|
+
"@discord/intl-message-database-win32-ia32-msvc": "0.34.0",
|
|
26
|
+
"@discord/intl-message-database-win32-x64-msvc": "0.34.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@napi-rs/cli": "^2.18.3",
|
|
30
|
-
"@discord/intl-ast": "0.
|
|
30
|
+
"@discord/intl-ast": "0.34.0"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
33
|
"node": ">= 10"
|