Table of Contents

Class PoCatalog

Namespace
Icy.Localization
Assembly
IcyUI.dll

The translations of one gettext .po file: one language.

public sealed class PoCatalog
Inheritance
PoCatalog
Inherited Members
Extension Methods

Remarks

Read by Parse(TextReader, string?), which supports:

  • msgctxt, msgid, msgstr, and strings continued on following lines;
  • the escapes \n, \t, \r, \" and \\;
  • # comments.

It skips the header entry (msgid ""), entries flagged #, fuzzy and untranslated ones (an empty msgstr), as gettext does. A plural entry contributes its msgstr[0]. An entry with a context is stored as context + '\u0004' + msgid.

Properties

Count

Gets the number of translated entries.

public int Count { get; }

Property Value

int

Methods

Parse(TextReader, string?)

Reads a .po file.

public static PoCatalog Parse(TextReader reader, string? sourceName = null)

Parameters

reader TextReader

The file's text.

sourceName string

The file's name, for error messages.

Returns

PoCatalog

The catalog.

Exceptions

FormatException

The text isn't a valid .po file; the message starts with name(line):.

TryGetString(string, out string?)

Gets the translation of key.

public bool TryGetString(string key, out string? value)

Parameters

key string

The msgid, or context + '\u0004' + msgid.

value string

The translation, when there is one.

Returns

bool

true when the file translates key.