4.10.1 • Published 6 days ago

@lingui/format-po-gettext v4.10.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 days ago

License Version Downloads

@lingui/format-po-gettext

Read and write message catalogs in Gettext PO format with gettext-style plurals

Converts ICU Plural expressions into native gettext plurals

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

Warning This formatter is made for compatibility with translation management systems, which do not support ICU expressions in PO files.

It does not support all features of LinguiJS and should be carefully considered over other formats.

Not supported features (native gettext doesn't support this):

  • SelectOrdinal
  • Select
  • Nested ICU Expressions
  • Signed digits and fractions (-5, and 0.15) in plurals

Catalog example

#. js-lingui-id: WGI12K
#. js-lingui:icu=%7BanotherCount%2C+plural%2C+one+%7BSingular+case%7D+other+%7BCase+number+%7BanotherCount%7D%7D%7D&pluralize_on=anotherCount
msgid "Singular case"
msgid_plural "Case number {anotherCount}"
msgstr[0] "Singular case"
msgstr[1] "Case number {anotherCount}"

Installation

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

Usage

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

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

Possible options:

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

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

  /**
   * Disable warning about unsupported `Select` feature encountered in catalogs
   * 
   * @default false
   */
  disableSelectWarning?: boolean
}

License

This package is licensed under MIT license.

4.10.1

6 days ago

4.10.0

27 days ago

4.8.0

1 month ago

4.7.2

1 month ago

4.8.0-next.1

2 months ago

4.8.0-next.0

2 months ago

4.7.1

3 months ago

4.7.0

4 months ago

4.5.0

8 months ago

4.4.1

8 months ago

4.4.0

9 months ago

4.6.0

5 months ago

4.4.2

8 months ago

4.3.0

10 months ago

4.1.0

12 months ago

4.2.1

11 months ago

4.1.2

12 months ago

4.2.0

12 months ago

4.1.1

12 months ago

4.0.0

1 year ago

4.0.0-next.8

1 year ago

4.0.0-next.7

1 year ago

4.0.0-next.6

1 year ago

4.0.0-next.5

1 year ago

4.0.0-next.4

1 year ago

4.0.0-next.3

1 year ago

4.0.0-next.2

1 year ago