Skip to content

Commit ee16d55

Browse files
committed
update docs
1 parent ec58a0c commit ee16d55

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

README.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ yarn global vue-i18n-locale-message
5757
- pull: pull the locale mesagees from localization service
5858
- diff: diff locale messages between local and localization service
5959
- status: indicate translation status from localization service
60+
- import: import locale messages to localization service
61+
- export: export locale messages from localization service
6062

6163
## :rocket: Usages
6264

@@ -146,6 +148,23 @@ vue-i18n-locale-message status --provider=l10n-service-provider \
146148
--conf=110n-service-provider-conf.json
147149
```
148150

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+
149168

150169
## :book: API: Specifications
151170

@@ -189,14 +208,16 @@ Infuse the meta of locale messages to i18n custom block at single-file component
189208

190209
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.
191210

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>
193212

194213
When you run the following commands,
195214

196215
- `push`
197216
- `pull`
198217
- `diff`
199218
- `status`
219+
- `import`
220+
- `export`
200221

201222
you need the provider that implements the following.
202223

@@ -205,6 +226,8 @@ you need the provider that implements the following.
205226
- `push` method
206227
- `pull` method
207228
- `status` method
229+
- `import` method
230+
- `export` method
208231

209232
The type definition with TypeScript is as follows:
210233

@@ -222,6 +245,15 @@ export type TranslationStatus = {
222245
percentage: number // translation percentage
223246
}
224247

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+
225257
/**
226258
* Provider interface
227259
*/
@@ -238,6 +270,14 @@ interface Provider {
238270
* indicate translation status from localization service
239271
*/
240272
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[]>
241281
}
242282

243283
type CommonArguments = {
@@ -266,6 +306,21 @@ export type StatusArguments = {
266306
locales: Locale[] // locales that indicate translation status from localization service, if empty, you must indicate translation status all locales
267307
}
268308

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+
269324
/**
270325
* ProviderConfiguration provider fields structure
271326
* e.g.

assets/command-image.png

132 KB
Loading

assets/push-pull-command-image.png

-50.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)