Socket
Socket
Sign inDemoInstall

@lingui/format-json

Package Overview
Dependencies
48
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @lingui/format-json

JSON format for Lingui Catalogs


Version published
Weekly downloads
7.1K
decreased by-8.05%
Maintainers
2
Created
Weekly downloads
 

Changelog

Source

4.10.0 (2024-04-12)

Features

  • react: native support react RSC (#1914) (0e94f2a)

Readme

Source

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.

Keywords

FAQs

Last updated on 12 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc