TPOFile class
Class used to represent a .po file with translation entries for a single target language.
Declaration
TPOFile = classDescription
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:
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
CharSet | public | Character set used for the contents of the .po file. |
Tag | public | Arbitrary value used to identify the .po file and its associated translation entries. |
Modified | public | Indicates whether values in the class instance have been modified since they were loaded from a .po file or stream. |
Items | public | Provides access to the TFPList instance where translation entries are stored. |
PoName | public | Name for the .po file loaded into the class instance. |
PoRename | public | Name for the .po file loaded into the class instance. |
Statistics | public | Provides access to statistics for the translation entries in the .po file. |
PoItems | public | Provides indexed access to the translation entries in the class instance. |
Count | public | Number of translation entries in the POItems for the class instance. |
Header | public | Contains values for the header section in a .po file. |
Methods
Remove | protected | Gets the translation entry at the specified ordinal position in POItems and removes it from the list. |
GetCount | protected | Gets the value for the Count property. |
SetCharSet | protected | Updates the value in the CharSet property. |
GetPoItem | protected | Gets the value for the indexed POItems property. |
ReadPOText | protected | Reads the content for the .po file from the specified source. |
Create | public | Constructor for the class instance. |
Destroy | public | Destructor for the class instance. |
Translate | public | Retrieves the translation entry for the specified identifier and returns the translated value. |
Report | public | Generates output with the values in the Header and the translation entries in the .po file. |
CreateHeader | public | Ensures that a TPOFileItem instance is allocated for the Header property (when not already assigned). |
UpdateStrings | public | Adds or updates translation entries in POItems using the values specified in InputLines. |
SaveToStrings | public | Stores values from Header and the sorted POItems to the specified string list. |
SaveToFile | public | Stores values from Header and the sorted POItems to the specified file name. |
UpdateItem | public | Adds or updates a translation entry which has the specified Identifier. |
FillItem | public | Stores argument values to the specified translation entry. |
UpdateTranslation | public | Updates or removes translation entries in the .po file class based on the content in the specified .po file. |
UntagAll | public | Resets the value in the Tag property for all of the translation entries in Items. |
RemoveTaggedItems | public | Removes translation entries in POItems with the specified value in their Tag property. |
RemoveIdentifier | public | Removes a translation entry in Items with the specified value in its identifier (msgid). |
RemoveOriginal | public | Removes a translation entry in POItems with has the specified value as its Original untranslated value. |
RemoveIdentifiers | public | Removes translation entries from Items which have the identifiers (msgids) in the specified string list. |
RemoveOriginals | public | Removes translation entries from Items which have the original untranslated values in the specified string list. |
InvalidateStatistics | public | Resets the internal flag which indicates that translation statistics has been calculated for the entries in POItems. |
FindPoItem | public | Gets the translation entry with the specified identifier value. |
OriginalToItem | public | Gets the translation entry which has the specified original (untranslated) value. |
Fields
FItems | protected | Member with the list of TPOFileItem instances in POItems. |
FIdentifierLowToItem | protected | Member with the lowercase identifier to TPOFileItem mapping. |
FOriginalToItem | protected | Member with the original value to TPOFileItem mapping. |
FCharSet | protected | Member with the value for the CharSet property. |
FHeader | protected | Member with the value for the Header property. |
FAllEntries | protected | Member with the scope for the translations applied from the .po file. |
FTag | protected | Member with the value for the Tag property. |
FModified | protected | Member with the value for the Modified property. |
FHelperList | protected | Member with the string list used to convert the .po file in the SaveToStrings method. |
FPoName | protected | Member with the value for the POName and PORename properties. |
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
