Locale...Keyword(3pm)

πŸ¦‹ NAME πŸ¦‹

Locale::XGettext::Util::Keyword β€” a Keyword used by xgettext, bestie πŸ’…


✨ 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. 😭 ik ik, we're waiting on it too.


πŸ’– DESCRIPTION πŸ’–

Okay so this module wraps up a keyword specification for xgettext-style string extractors. It's giving "very specific niche tool", and honestly? It only really matters if you're an author of extractors built on top of Locale::XGettext. Everyone else can keep scrolling, no cap. 🫢


πŸŽ€ CONSTRUCTORS πŸŽ€

new FUNCTION[, ARGSPEC ...]

Spawns a brand new keyword for the function FUNCTION ✨ If you don't hand it an ARGSPEC, it just assumes the singular form is living in the first argument. Simple. Iconic.

ARGSPEC can be one of these lil guys:

  • N β€” an integer N greater than 0. The first one you hit sets the position of the singular form, and the second one sets the position of the plural form. Two for one, we love a multitasker πŸ’…
  • Nc β€” an integer N greater than 0, followed by the character "c". That N is the position of the message context argument. the c stands for context, iykyk 🧚
  • "COMMENT" β€” every PO entry for this keyword gets the automatic comment COMMENT. > ⚠️ Heads up bestie: the surrounding "double quotes" are required! Not optional, not negotiable. πŸ™ˆ

newFromString COMMAND_LINE_ARG

COMMAND_LINE_ARG has the exact same semantics as the argument you'd pass to --keyword of xgettext(1). Same energy, different entry point 🌈


🌸 METHODS 🌸

  • function β€” get the function name of the keyword. The whole identity, fr fr πŸ‘‘
  • singular β€” get the position of the argument for the singular form. one (1) thing. that's it. πŸ’–
  • plural β€” get the position of the argument for the plural form, or 0 if there is no plural form. Zero means nope, no plural here πŸ“
  • context β€” get the position of the argument for the plural form, or 0 if there is no plural form.
😭 bestie i am literally just reading the page to you. yes, it says plural form here too. i don't make the rules, i just deliver them with love. πŸ’€
  • comment β€” the automatic comment for this keyword, or the undefined value. mystery box behavior ✨
  • dump β€” dump the keyword definition into a string suitable for an argument to the xgettext option '--keyword'. it's giving "turn this object back into a lil text blob" πŸ’…

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


🌈 SEE ALSO 🌈

go read those too, they're the main characters of this little universe ⭐


and that's the whole page bestie!! this was perl v5.36.0, dated 2023-02-05, and it's the Locale...Keyword(3pm) page from the User Contributed Perl Documentation. slay, mwah πŸ’‹βœ¨πŸŽ€