---
name: "Locale::XGettext::Util::Keyword"
section: "3pm"
platform: "linux"
package: "liblocale-xgettext-perl"
version: "0.7-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Locale::XGettext::Util::Keyword"
---

# Locale::XGettext::Util::Keyword(3pm)

A Keyword Used By xgettext

## NAME

Locale::XGettext::Util::Keyword - A Keyword Used By xgettext

## SYNOPSIS

```
    use Locale::XGettext::Util::Keyword;
    $keyword = Locale::XGettext::Keyword->new('npcgettext',
                                              '1c', 2, 3,
                                              '"Plural form"');
    $keyword = Locale::XGettext::Keyword->newFromString('npcgettext:1c,2,3,"Plural form"');
```

Flags are not yet supported.

## DESCRIPTION

The module encapsulates a keyword specification for xgettext like string extractors.  It is only interesting for authors of extractors based on Locale::XGettext.

## CONSTRUCTORS

- **new FUNCTION\[, ARGSPEC ...\]**

  Creates a new keyword for FUNCTION **FUNCTION**.  Without **ARGSPEC** it is assumed that the singular form is the first argument.

  **ARGSPEC** can be one of the following:

  - **N**

    An integer **N** greater than 0.  The first one encountered specifies the  position of the singular form, the second one the position of the plural  form.

  - **Nc**

    An integer **N** greater than 0 followed by the character "c".  **N** specifies the position of the message context argument.

  - **"COMMENT"**

    Every PO entry for this keyword should get the automatic comment  **COMMENT**.  Note that the surroudning "double quotes" are required!

- **newFromString COMMAND\_LINE\_ARG**

  **COMMAND\_LINE\_ARG** has the same semantcis as the argument to "--keyword" of [**xgettext**(1)](/xgettext/1.md).

## METHODS

- **function**

  Get the function name of the keyword.

- **singular**

  Get the position of the argument for the singular form.

- **plural**

  Get the position of the argument for the plural form or 0 if there is no plural form.

- **context**

  Get the position of the argument for the plural form or 0 if there is no plural form.

- **comment**

  The automatic comment for this keyword or the undefined value.

- **dump**

  Dump the keyword definition into a string suitable for an argument to the xgettext option '--keyword'.

## COPYRIGHT

Copyright (C) 2016-2017 Guido Flohr \<guido.flohr@cantanea.com\>, all rights reserved.

## SEE ALSO

Locale::XGettext, [**xgettext**(1)](/xgettext/1.md), [**perl**(1)](/perl/1.md)
