4.13.0 • Published 9 months ago

@lingui/format-po v4.13.0

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

License Version Downloads

@lingui/format-po

Read and write message catalogs in Gettext PO format with ICU plurals

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

Catalog example

#, Comment for translators
#: src/App.js:4, src/Component.js:2
msgid "MessageID"
msgstr "Translated Message"

Installation

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

Usage

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

export default {
  [...]
  format: formatter({lineNumbers: false}),
}

Possible options:

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

  /**
   * Print line numbers in origins
   *
   * @default true
   */
  lineNumbers?: boolean
  
  /**
   * Print `js-lingui-id: Xs4as` statement in extracted comments section
   *
   * @default false
   */
  printLinguiId?: boolean
  
  /**
   * By default, the po-formatter treats the pair `msgid` + `msgctx` as the source
   * for generating an ID by hashing its value.
   *
   * For messages with explicit IDs, the formatter adds a special comment `js-lingui-explicit-id` as a flag.
   * When this flag is present, the formatter will use the `msgid` as-is without any additional processing.
   *
   * Set this option to true if you exclusively use explicit-ids in your project.
   *
   * https://lingui.dev/tutorials/explicit-vs-generated-ids#using-custom-id
   *
   * @default false
   */
  explicitIdAsDefault?: boolean
  
  /**
   * Custom attributes to append to the PO file header
   *
   * @default {}
   */
  customHeaderAttributes?: { [key: string]: string }
}

License

This package is licensed under MIT license.

5.0.0-next.3

9 months ago

5.0.0-next.2

9 months ago

4.13.0

9 months ago

4.12.0

9 months ago

5.0.0-next.1

10 months ago

4.11.4

10 months ago

5.0.0-next.0

1 year ago

4.11.1

1 year ago

4.11.2

1 year ago

4.11.3

11 months ago

4.11.0

1 year ago

4.10.1

1 year ago

4.10.0

1 year ago

4.8.0

1 year ago

4.7.2

1 year 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

2 years ago

4.5.0

2 years ago

4.4.1

2 years ago

4.4.0

2 years ago

4.6.0

2 years 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