@@ -57,6 +57,8 @@ yarn global vue-i18n-locale-message
57
57
- pull: pull the locale mesagees from localization service
58
58
- diff: diff locale messages between local and localization service
59
59
- status: indicate translation status from localization service
60
+ - import: import locale messages to localization service
61
+ - export: export locale messages from localization service
60
62
61
63
## :rocket : Usages
62
64
@@ -146,6 +148,23 @@ vue-i18n-locale-message status --provider=l10n-service-provider \
146
148
--conf=110n-service-provider-conf.json
147
149
```
148
150
151
+ ### Import
152
+
153
+ ``` bash
154
+ $ vue-i18n-locale-message import --provider=l10n-service-provider \
155
+ --conf ./l10n-service-provider-conf.json \
156
+ --target=./src/locales/ja.json \
157
+ --format=json
158
+ ```
159
+
160
+ ### Export
161
+
162
+ ``` bash
163
+ $ vue-i18n-locale-message export --provider=l10n-service-provider \
164
+ --conf ./l10n-service-provider-conf.json \
165
+ --output=./src/locales
166
+ ```
167
+
149
168
150
169
## :book : API: Specifications
151
170
@@ -189,14 +208,16 @@ Infuse the meta of locale messages to i18n custom block at single-file component
189
208
190
209
You can use the ` push ` or ` pull ` commands to push the locale message to the localization service as a resource for that service, and also to pull resources from the l10n service as the locale message.
191
210
192
- <p align =" center " ><img src =" ./assets/push-pull- command-image.png " alt =" Push and Pull Image" ></p >
211
+ <p align =" center " ><img src =" ./assets/command-image.png " alt =" Command Image" ></p >
193
212
194
213
When you run the following commands,
195
214
196
215
- ` push `
197
216
- ` pull `
198
217
- ` diff `
199
218
- ` status `
219
+ - ` import `
220
+ - ` export `
200
221
201
222
you need the provider that implements the following.
202
223
@@ -205,6 +226,8 @@ you need the provider that implements the following.
205
226
- ` push ` method
206
227
- ` pull ` method
207
228
- ` status ` method
229
+ - ` import ` method
230
+ - ` export ` method
208
231
209
232
The type definition with TypeScript is as follows:
210
233
@@ -222,6 +245,15 @@ export type TranslationStatus = {
222
245
percentage: number // translation percentage
223
246
}
224
247
248
+ /**
249
+ * Raw Locale Message
250
+ */
251
+ export type RawLocaleMessage = {
252
+ locale: Locale // target locale
253
+ format: string // locale message format
254
+ data: Buffer // data of locale message
255
+ }
256
+
225
257
/**
226
258
* Provider interface
227
259
*/
@@ -238,6 +270,14 @@ interface Provider {
238
270
* indicate translation status from localization service
239
271
*/
240
272
status (args : StatusArguments ): Promise <TranslationStatus []>
273
+ /**
274
+ * import the locale messsages to localization service
275
+ */
276
+ import (args : ImportArguments ): Promise <void >
277
+ /**
278
+ * export the locale message buffer from localization service
279
+ */
280
+ export (args : ExportArguments ): Promise <RawLocaleMessage []>
241
281
}
242
282
243
283
type CommonArguments = {
@@ -266,6 +306,21 @@ export type StatusArguments = {
266
306
locales: Locale [] // locales that indicate translation status from localization service, if empty, you must indicate translation status all locales
267
307
}
268
308
309
+ /**
310
+ * Provider Import Arguments
311
+ */
312
+ export type ImportArguments = {
313
+ messages: RawLocaleMessage [] // the raw locale messages that import to localization service
314
+ } & CommonArguments
315
+
316
+ /**
317
+ * Provider Export Arguments
318
+ */
319
+ export type ExportArguments = {
320
+ locales: Locale [] // locales that export from localization service, if empty, you must export all locale messages
321
+ format: string // locale messages format
322
+ } & CommonArguments
323
+
269
324
/**
270
325
* ProviderConfiguration provider fields structure
271
326
* e.g.
0 commit comments