haskell-gettext-0.1.1.0: GetText runtime library implementation in pure Haskell

Safe HaskellSafe
LanguageHaskell98

Data.Gettext.Parsers

Contents

Description

This module contains parsers for:

  • Catalog headers (Name: Value lines, that are specified as translation for empty string in po file);
  • Plural form selection expressions (specified in Plural-Forms header).

These parsers are already used by main module; but they can be useful for other libraries working with gettext's files.

Synopsis

Types

type Header = (Text, Text) Source #

Catalog header, i.e. one Name: Value line in po file

type Headers = [Header] Source #

List of catalog headers

Parsing functions

parseHeaders :: Text -> Either String Headers Source #

Parse catalog headers. NB: for now this function does not use Parsec.

parsePlural :: Headers -> Either String (Int, Expr) Source #

Parse plural form selection definition. Return value is (number of possible plural forms; selection expression).

Parsec parsers

pHeaders :: Parser Headers Source #

Parsec parser for catalog headers

pExpr :: Parser Expr Source #

Parse plural form selection expression. Note: this parses only part which goes after plural=.

pPlural :: Parser (Int, Expr) Source #

Parse plural form selection definition. This parses the whole value of Plural-Forms header, starting from nplurals=.