Search code examples
delphilocalepascalfpc

How to inform Free Pascal Compiler to set Locale ID for the compiled application


In Delphi there is an option VersionInfo->Language->Locale ID when viewing project properties.
I was wandering how to set such property for a program being compiled under Free Pascal.
Any solution is welcome: command line argument or preprocessor directive such as {$key value}; equivalent to Delphi.


Solution

  • If you can build your projects using *.lpi files then I would try to add the following into your project's Project.lpi file. In the following snippet is shown how to set the project's locale ID (for Windows platform) to 0405 (Czech).

    <?xml version="1.0"?>
    <CONFIG>
      <ProjectOptions>
        ...
        <VersionInfo>
          <UseVersionInfo Value="True"/>
          <Language Value="0405"/>
          <StringTable ProductVersion=""/>
        </VersionInfo>
        ...
      </ProjectOptions>
      ...
    </CONFIG>
    

    Or if you are using Lazarus IDE then you might use to Delphi very similar settings tab which you can open from Project / Project Options ... and as in Delphi go to Version Info where is the Language selection combo box available if you include the version info into the project.