TTMSFNCLocalizationCollector.ImportResourceStrings Method
Imports the resourcestrings listed in a .drc file. Returns how many were read; 0 when there is nothing to read.
API unit family: TMS.TMSFNCLocalizationCollector
Declaring type: TTMSFNCLocalizationCollector
Overloads
Overload 1
Imports the resourcestrings listed in a .drc file. Returns how many were read; 0 when there is nothing to read.
function ImportResourceStrings(const AFileName: string = ''; ARetireMissing: Boolean = False): Integer; overload;
int __fastcall ImportResourceStrings(const System::UnicodeString AFileName = System::UnicodeString(), bool ARetireMissing = false)/* overload */;
Remarks
The run-time counterpart of what the Localization Editor does when it opens. It exists because a collection pass finds components, and a resourcestring is not a component property: without this, collecting from a running application gathers every caption on every form and no resourcestrings at all. Which units count as the application's own is taken from the model - the units already under ResourceStrings, and the units the collected forms, frames and data modules came from. That is what keeps the RTL's and the frameworks' own resourcestrings, of which there are thousands, out of the translation project. A model that knows no units yet has nothing to filter by, and the file is then imported as it stands, the RTL's and frameworks' resourcestrings included; collect the forms first, or use the overload that takes the unit names.
Does nothing when LocalizeResourceStrings is False.
Parameters
| Name | Description |
|---|---|
AFileName |
The .drc to read. Empty uses ResourceStringsFile, and failing that a .drc beside the executable. |
ARetireMissing |
Whether resourcestrings the file does not mention may be marked obsolete. False by default, and that default is the safe one: retiring asserts the file is a complete list of what the binary contains, and outside the IDE there is no project to check it against. Pass True only where the .drc is known to come from the build being collected - a build step, typically. |
Returns
The number of resourcestring entries read from the file. 0 when LocalizeResourceStrings is False or the file does not exist.
Overload 2
Imports the resourcestrings listed in a .drc file, taking only the units named in AUnitNames.
function ImportResourceStrings(const AFileName: string; const AUnitNames: TArray<string>; ARetireMissing: Boolean = False): Integer; overload;
int __fastcall ImportResourceStrings(const System::UnicodeString AFileName, const System::DynamicArray<System::UnicodeString> AUnitNames, bool ARetireMissing = false)/* overload */;
Parameters
| Name | Description |
|---|---|
AUnitNames |
The application's own units, as the .drc spells them. Everything else in the file is skipped. An empty array means take the file as it stands - which for a real application's .drc means importing the RTL and the frameworks too, and is rarely wanted. |
AFileName |
The .drc to read. Empty uses ResourceStringsFile, and failing that a .drc beside the executable. |
ARetireMissing |
Whether resourcestrings the file does not mention may be marked obsolete. Pass True only where the .drc is known to come from the build being collected. |
Returns
The number of resourcestring entries read from the file. 0 when LocalizeResourceStrings is False or the file does not exist.