4.13.0 • Published 5 months ago

@lingui/format-json v4.13.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

License Version Downloads

@lingui/format-json

Read and write message catalogs in JSON

@lingui/format-json is part of LinguiJS. See the documentation for all information, tutorials and examples.

Installation

npm install --save-dev @lingui/format-json
# yarn add --dev @lingui/format-json

Usage

// lingui.config.{js,ts}
import {formatter} from "@lingui/format-json"

export default {
  [...]
  format: formatter({style: "lingui"}),
}

Possible options:

export type JsonFormatterOptions = {
  /**
   * Print places where message is used
   *
   * @default true
   */
  origins?: boolean

  /**
   * Print line numbers in origins
   *
   * @default true
   */
  lineNumbers?: boolean

  /**
   * Different styles of how information could be printed
   *
   * @default "lingui"
   */
  style?: "lingui" | "minimal"

  /**
  * Indentation of output JSON
  *
  * @default 2
  */
  indentation?: number
}

Style: minimal

Simple JSON with message ID -> translation mapping. All metadata (default message, comments for translators, message origin, etc) are stripped:

{
"MessageID": "Translated Message"
}

Style: lingui

Raw catalog data serialized to JSON:

{
"MessageID": {
  "translation": "Translated Message",
  "message": "Default string (from source code)",
  "origin": [
    ["path/to/src.js", 42]
  ]
}
}

License

This package is licensed under MIT license.

5.0.0-next.3

5 months ago

5.0.0-next.2

5 months ago

4.13.0

5 months ago

4.12.0

5 months ago

5.0.0-next.1

6 months ago

4.11.4

6 months ago

5.0.0-next.0

8 months ago

4.11.1

10 months ago

4.11.2

9 months ago

4.11.3

7 months ago

4.11.0

10 months ago

4.10.1

11 months ago

4.10.0

11 months ago

4.8.0

12 months ago

4.7.2

12 months ago

4.8.0-next.1

1 year ago

4.8.0-next.0

1 year ago

4.7.1

1 year ago

4.7.0

1 year ago

4.5.0

2 years ago

4.4.1

2 years ago

4.4.0

2 years ago

4.6.0

1 year ago

4.4.2

2 years ago

4.3.0

2 years ago

4.1.0

2 years ago

4.2.1

2 years ago

4.1.2

2 years ago

4.2.0

2 years ago

4.1.1

2 years ago

4.0.0

2 years ago

4.0.0-next.8

2 years ago

4.0.0-next.7

2 years ago

4.0.0-next.6

2 years ago

4.0.0-next.5

2 years ago

4.0.0-next.4

2 years ago

4.0.0-next.3

2 years ago

4.0.0-next.2

2 years ago