Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lingui/format-po-gettext

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lingui/format-po-gettext

Gettext PO format with gettext-style plurals for Lingui Catalogs

  • 4.7.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.3K
increased by13.65%
Maintainers
2
Weekly downloads
 
Created
Source

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.

Keywords

FAQs

Package last updated on 20 Feb 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc