Sign in Join
FPDoc Onlineexperiment

TPOFile class

In unit Translations

Class used to represent a .po file with translation entries for a single target language.

Declaration

pascal
TPOFile = class

Description

TPOFile is a class which provides access to a file with translation entries used to localize a source file to the language or locale defined in a .po (Portable Object) file. .po files are part of the GNU gettext tool set used to produce and update translation files. Information about the .po file format can be found at:

The Format of PO Files

TPOFile provides properties and methods used to load and save translation entries using a file, stream, or resource. The Header property contains the header information for the .po file, and may contain information about: the MIME version and content transfer encoding, target language, plural forms, and generation tools. Use the POItems property to access the translation entries defined in the .po file.

TPOFile also provides Statistics about the translations applied to a source file when the Translate method is called.

See also

Properties

CharSetpublicCharacter set used for the contents of the .po file.
TagpublicArbitrary value used to identify the .po file and its associated translation entries.
ModifiedpublicIndicates whether values in the class instance have been modified since they were loaded from a .po file or stream.
ItemspublicProvides access to the TFPList instance where translation entries are stored.
PoNamepublicName for the .po file loaded into the class instance.
PoRenamepublicName for the .po file loaded into the class instance.
StatisticspublicProvides access to statistics for the translation entries in the .po file.
PoItemspublicProvides indexed access to the translation entries in the class instance.
CountpublicNumber of translation entries in the POItems for the class instance.
HeaderpublicContains values for the header section in a .po file.

Methods

RemoveprotectedGets the translation entry at the specified ordinal position in POItems and removes it from the list.
GetCountprotectedGets the value for the Count property.
SetCharSetprotectedUpdates the value in the CharSet property.
GetPoItemprotectedGets the value for the indexed POItems property.
ReadPOTextprotectedReads the content for the .po file from the specified source.
CreatepublicConstructor for the class instance.
DestroypublicDestructor for the class instance.
TranslatepublicRetrieves the translation entry for the specified identifier and returns the translated value.
ReportpublicGenerates output with the values in the Header and the translation entries in the .po file.
CreateHeaderpublicEnsures that a TPOFileItem instance is allocated for the Header property (when not already assigned).
UpdateStringspublicAdds or updates translation entries in POItems using the values specified in InputLines.
SaveToStringspublicStores values from Header and the sorted POItems to the specified string list.
SaveToFilepublicStores values from Header and the sorted POItems to the specified file name.
UpdateItempublicAdds or updates a translation entry which has the specified Identifier.
FillItempublicStores argument values to the specified translation entry.
UpdateTranslationpublicUpdates or removes translation entries in the .po file class based on the content in the specified .po file.
UntagAllpublicResets the value in the Tag property for all of the translation entries in Items.
RemoveTaggedItemspublicRemoves translation entries in POItems with the specified value in their Tag property.
RemoveIdentifierpublicRemoves a translation entry in Items with the specified value in its identifier (msgid).
RemoveOriginalpublicRemoves a translation entry in POItems with has the specified value as its Original untranslated value.
RemoveIdentifierspublicRemoves translation entries from Items which have the identifiers (msgids) in the specified string list.
RemoveOriginalspublicRemoves translation entries from Items which have the original untranslated values in the specified string list.
InvalidateStatisticspublicResets the internal flag which indicates that translation statistics has been calculated for the entries in POItems.
FindPoItempublicGets the translation entry with the specified identifier value.
OriginalToItempublicGets the translation entry which has the specified original (untranslated) value.

Fields

FItemsprotectedMember with the list of TPOFileItem instances in POItems.
FIdentifierLowToItemprotectedMember with the lowercase identifier to TPOFileItem mapping.
FOriginalToItemprotectedMember with the original value to TPOFileItem mapping.
FCharSetprotectedMember with the value for the CharSet property.
FHeaderprotectedMember with the value for the Header property.
FAllEntriesprotectedMember with the scope for the translations applied from the .po file.
FTagprotectedMember with the value for the Tag property.
FModifiedprotectedMember with the value for the Modified property.
FHelperListprotectedMember with the string list used to convert the .po file in the SaveToStrings method.
FPoNameprotectedMember with the value for the POName and PORename properties.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.