# perldoc > Locale::Maketext::Extract::Plugin::YAML

---
type: CommandReference
command: Locale::Maketext::Extract::Plugin::YAML
mode: perldoc
section: ""
source: perldoc
---

## Quick Reference

- `$plugin = Locale::Maketext::Extract::Plugin::YAML->new($lexicon, @file_types)` — create plugin instance
- `$plugin->extract($filename, $filecontents)` — extract translatable strings from a YAML file
- Mark strings for extraction using `_` prefix: `key: _"string"`, `key: _'string'`, `key: _'string with embedded \'quotes\''`, folded block with `|-` and `_` align

## Name

YAML format parser for Locale::Maketext::Extract.

## Synopsis

perl
$plugin = Locale::Maketext::Extract::Plugin::YAML->new(
    $lexicon            # A Locale::Maketext::Extract object
    @file_types         # Optionally specify a list of recognised file types
);

$plugin->extract($filename, $filecontents);
## Options

Constructor parameters:

- `$lexicon` — a `Locale::Maketext::Extract` object (required)
- `@file_types` — optionally specify a list of recognised file types (default: `.yaml`, `.yml`, `.conf`)

## Valid Formats

Strings to be localised are marked with `_` before the quotation mark. Valid formats:

yaml
key: _"string"
key: _'string'
key: _'string with embedded \'quotes\''
key: |-
     _'my folded
     string
     to translate'
key: |-
     _'my block
     string
     to translate
     '
Note: For folded strings, the left side of the content must line up with the `_`. Use trailing `-` to prevent YAML from adding a carriage return after the final quote.

## Known File Types

`.yaml`, `.yml`, `.conf`

## Notes

The YAML module (pure Perl) is described as alpha code and may hang on some files. If `xgettext.pl` hangs, run with `--verbose --verbose` to isolate the fault. Consider using `YAML::Syck` for more robust parsing, or exclude problematic files via `file_types`.

## Requires

YAML

## See Also

- [xgettext.pl](https://www.chedong.com/phpMan.php/perldoc/xgettext.pl/markdown) — for extracting translatable strings from common template systems and Perl source files
- [YAML](https://www.chedong.com/phpMan.php/perldoc/YAML/markdown)
- [Locale::Maketext::Lexicon](https://www.chedong.com/phpMan.php/perldoc/Locale%3A%3AMaketext%3A%3ALexicon/markdown)
- [Locale::Maketext::Extract::Plugin::Base](https://www.chedong.com/phpMan.php/perldoc/Locale%3A%3AMaketext%3A%3AExtract%3A%3APlugin%3A%3ABase/markdown)
- [Locale::Maketext::Extract::Plugin::FormFu](https://www.chedong.com/phpMan.php/perldoc/Locale%3A%3AMaketext%3A%3AExtract%3A%3APlugin%3A%3AFormFu/markdown)
- [Locale::Maketext::Extract::Plugin::Perl](https://www.chedong.com/phpMan.php/perldoc/Locale%3A%3AMaketext%3A%3AExtract%3A%3APlugin%3A%3APerl/markdown)
- [Locale::Maketext::Extract::Plugin::TT2](https://www.chedong.com/phpMan.php/perldoc/Locale%3A%3AMaketext%3A%3AExtract%3A%3APlugin%3A%3ATT2/markdown)
- [Locale::Maketext::Extract::Plugin::Mason](https://www.chedong.com/phpMan.php/perldoc/Locale%3A%3AMaketext%3A%3AExtract%3A%3APlugin%3A%3AMason/markdown)
- [Locale::Maketext::Extract::Plugin::TextTemplate](https://www.chedong.com/phpMan.php/perldoc/Locale%3A%3AMaketext%3A%3AExtract%3A%3APlugin%3A%3ATextTemplate/markdown)
- [Locale::Maketext::Extract::Plugin::Generic](https://www.chedong.com/phpMan.php/perldoc/Locale%3A%3AMaketext%3A%3AExtract%3A%3APlugin%3A%3AGeneric/markdown)