Lingobit Extractor · Delphi

Extract hard-coded strings from Delphi code into resourcestring.

A message written as 'Order saved' in Pascal code stays in English in every language. Lingobit Extractor moves it into the resourcestring section of a unit and puts its name in place of the text, so the compiler stores it in the EXE's resources and it can be translated.

View pricing

DelphiOrderForm.pasExtractprocedure TOrderForm.Save;begin SaveOrder; StatusBar.SimpleText := 'Order saved';AppStrings.OrderSavedStr;end;PASAppStrings.pasresourcestring OrderSavedStr = 'Order saved';'Order saved'OrderSavedStr DelphiOrderForm.pasExtractprocedure TOrderForm.Save;begin SaveOrder; StatusBar.SimpleText := 'Order saved';AppStrings.OrderSavedStr;end;PASAppStrings.pasresourcestring OrderSavedStr = 'Order saved';'Order saved'OrderSavedStr
Files
.pas, .dpr, .p
Resources
A resourcestring unit
In the code
The unit and the string name
Trial
30 days, a separate download

What Extractor changes in your Delphi code.

One string, before and after. The name is made from the words of the text: each word begins with a capital letter, without a separator, and ends in Str.

Before: OrderForm.pas

procedure TOrderForm.SaveClick(Sender: TObject);
begin
  SaveOrder;
  StatusBar.SimpleText := 'Order saved';
end;

After: OrderForm.pas

procedure TOrderForm.SaveClick(Sender: TObject);
begin
  SaveOrder;
  StatusBar.SimpleText := AppStrings.OrderSavedStr;
end;

New in the resources: AppStrings.pas

unit AppStrings;

interface

resourcestring
  OrderSavedStr = 'Order saved';

implementation

end.

From hard-coded text to resources in five steps.

Not every string is text: a class name, an SQL query, or a registry key stays in the code. You decide what moves, and Extractor remembers it.

Lingobit ExtractorScanScanStringSourceState"Order saved"OrderDlg.cpp:42NewExtract"%d"OrderDlg.cpp:57Newfiltered out: no letters"OrderWindow"OrderDlg.cpp:12NewSkip"SELECT * FROM Orders"OrderDb.cpp:30NewSkip"Print the order"OrderDlg.cpp:88NewExtract"Software\\MyApp"Settings.cpp:9NewSkip"Gift wrap"OrderDlg.cpp:95NewAt the next Scan, skipped strings stay skipped and extracted ones stay in the resources:only the new string is New. Lingobit ExtractorScanScanStringState"Order saved"NewExtract"%d"Newfiltered out: no letters"OrderWindow"NewSkip"SELECT * FROM Ord…"NewSkip"Print the order"NewExtract"Software\\MyApp"NewSkip"Gift wrap"NewAt the next Scan only the new stringis New; skipped ones stay skipped.
  1. Create a projectAdd your .pas and .dpr files or the whole folder.

  2. Add a resource unitExtractor creates the unit with the resourcestring section, or uses one it created before.

  3. Scan, then Skip or ExtractSkip the technical strings, such as SQL and registry keys; extract the text.

  4. Use the unitAdd the resource unit to the project and to the uses clause of the changed units.

  5. BuildBuild as usual. The strings are now in the resources of your EXE.

The code that loads the string.

Each extracted string gets a replace template. Pick one per resource file or per string.

  • $(RESNAME).$(ID)
    The unit name and the string name, such as AppStrings.OrderSavedStr.

The resourcestring keyword tells the Delphi compiler to store the strings in the resources of the EXE, next to the forms.

Then translate the build.

Lingobit Localizer reads the resource strings from your EXE, together with the forms, and writes a resource module such as MyApp.DEU for each language, or a localized EXE.

Before translation, check the result with Pseudo Translate in Lingobit Localizer: if a text still stays in English, it is still in the code. Pseudo Translate: Professional and higher.

Pseudo TranslateRun Localized ApplicationNew OrderNew ÖrderNeCustomer:Cüßtömer:CüQuantity:Qüäntity:QüShip todayShip tödäyShiPrint receiptPrint receiptPriCreateCreäteCCancelCäncelCOrder savedÖrder ßävedÖrdFrom the resourcesWorks as the original Pseudo TranslateRun Localized ApplicationNew OrderNew ÖrderNeCustomer:Cüßtömer:CüQuantity:Qüäntity:QüShip todayShip tödäyShiPrint receiptPrint receiptPriCreateCreäteCCancelCäncelCOrder savedÖrder ßävedÖrdFrom the resourcesWorks

Delphi string extraction FAQ

Why resourcestring and not constants?

A const string is compiled into the code. A resourcestring goes into the resources of the EXE, where the Delphi runtime loads it from the resource module of the user's language.

Does Extractor touch my forms?

No. Text on forms is already in the DFM resources, and Lingobit Localizer translates it there. Extractor works with the strings in your Pascal code.

Does it work with C++Builder?

Yes. C++Builder code is C++: Extractor moves its strings into an .rc2 string table, as on the C and C++ page.

What happens to strings I skip?

They stay in the code and keep the Skip state. At the next Scan only new strings show up.

Try Extractor on your own Delphi code.

The trial runs for 30 days with every function. In each resource file the first 50 extracted strings are written as they are; after that, some may end in _TRIAL.

  • Lingobit ExtractorAll languages, how to work with Extractor, and the check after extraction.
  • C and C++Hard-coded strings in C and C++ code into an .rc string table.
  • C#Hard-coded strings in C# code into .resx resources.
  • Visual Basic .NETHard-coded strings in Visual Basic .NET code into .resx resources.
  • JavaHard-coded strings in Java code into .properties files.