[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Translations' (#lazutils)

TPOFile.ReadPOText

Reads the content for the .po file from the specified source.

Declaration

Source position: translations.pas line 134

protected procedure TPOFile.ReadPOText(

  AStream: TStream

);

procedure TPOFile.ReadPOText(

  const Txt: string

);

Arguments

AStream

  

TStream instance with the translation entries for the .po file.

Arguments

Txt

  

String with the translation entries for the .po file.

Description

ReadPOText is an overloaded method used to load translation entries from the specified source into the class instance. The overloaded variants allow the .po content to be loaded from a TStream instance or a String.

The TStream-based variant stores the content starting at the current stream position to a String value. The String-based variant is called examine and process the values. The stream position is not reset before or after reading values from the stream.

The String-based variant reads lines of text from the Txt argument and performs actions to create and populate the POItems in the class instance. It accounts for both the header in the .po file and the comment lines which occur prior to a translation entry. Values for message Identifiers (msgid), translations (msgstr), and Contexts (msgctxt) are handled in the method. If the file header indicates that a content encoding other than UTF-8 is used in the .po file, its content is transcoded by calling ConvertEncoding.

Use SavetoStrings or SaveToFile to store updated values in the class instance.


Version 4.0 Generated 2025-05-03 Home