I use Embarcadero C++ Builder to create application with different UI languages. Currently when original project is changing I need to manually select next options from IDE main menu:
Project → Languages → Update Localized Projects
Is it possible to make such action, i.e. update localized projects via console (without any GUI actions)?
Another way to update localized projects is to use External Translation Manager tool (included with RAD Studio). But this way also use GUI.
Additional information can be found on Embarcadero web page.
Related
I am trying to localize a VCL application, but I can't seem to find LoadNewResourceModule and ReinitializeForms. What unit(s) do I need to add to the uses clause for Delphi 10.3.4? Or is there another way to switch language dynamically?
Reference: http://docwiki.embarcadero.com/RADStudio/Sydney/en/Dynamic_Switching_of_Resource_DLLs
LoadNewResourceModule and ReinitializeForms are only for an example purposes. They are not very practical because it recreates the form.
Here is a complete Delphi localization document. It also shows how to make the runtime language switch in the right way.
You can localize your application in many way
One exe for each language. The application always start in the language of the EXE. Deploy the EXE matching the user's language.
Original EXE plus one resource DLL for each language. You can have runtime language switch or just select a language at the time when the application starts. Deploy the EXE and any number of resource DLLs.
One multilingual EXE. Windows will select the language. You have no control for it. Deploy only the multilingual EXE.
Is it possible to automate setting the Option Set file reference programmatically when creating a new Delphi project using the IOTAProjectOptions respectively IOTAProjectOptionsConfigurations interface1?
Or can I do that using any of the other OTAPI IDE services2?
I'm currently using the RAD Studio Delphi 10 Seattle IDE. Though, if newer OTAPI versions would support that feature, I'd still like to know about that.
I couldn't find any appropriate property or function, that seems to do that action in my current ToolsAPI.pas.
I want to achieve the same as choosing Apply Option Set -> Reference at the root project configurations root node in the IDE's project manager view:
Hypothetically I'm looking for some functionality like
procedure IOTAProjectOptionsConfigurations.BaseConfiguration.ApplyOptionSetReference
(const optSetFilePath : string);
A bit more background:
I'm currently developing legacy project wizards for our company wide Delphi project settings. I already have a working IOTAProjectCreator implementation that also manipulates the .dproj MSBuild XML file after it was generated and saved by the IDE. I'm just adding some conditional Import elements there.
Now we also want to use a Options Set file that is stored at a central repository. I know and studied the differences done in the .dproj XML, after that action was applied using the GUI, but there's a non negligible amount of logic going on (regarding dependencies and such), and I'm refraining to (re-)implement that logic via plain XML file manipulations. Not to mention that the necessary logic is prone to be changed with future versions of the IDE.
1)I'm trying to use that in the context of a IOTAProjectCreator implementation, with the definition of the procedure SetInitialProjectOptions(NewProject : IOTAProject); function.
2)It's a shame that these features are documented so poorly.
When you start using a package in a project you always have to change the same settings in the project options - search path, used run-time packages, unit aliasses, probably more. I'm currently trying to "outsource" all these settings for a certain library into an option set (*.optset). For search path and unit aliasses I could easily configure that using the XE6 IDE. But I didn't find an entry for run-time packages. So I manually added the relevant line
<DCC_UsePackage>MyPackage;$(DCC_UsePackage)</DCC_UsePackage>
to the optset file in a text editor and it seems to work. But I'm worried because the IDE doesn't support this. Is there a hidden gotcha?
I have downloaded a component that has many packages in it, then I have install all the design time packages and generated all the other dcu files.I have to assign its path in Delphi search path every time I create a new application. Is there a way to assign its path to Delphi compiler search path once and all application will get access to these unit, so that I need not to manually set every time the path for a new application.
If you want to have some component automatically available for every new projects you need to change the default Delphi IDE options - specifically path locations - so that Delphi IDE knows where to find needed files.
You do this by going into menu Tools -> Options. Then in the TreeView which is used for splitting the options into multiple categories you select Enviroment Options -> Delphi options -> Library.
On the right side of the window you will now have different options regarding the path locations for libraries and source files.
In order to allow Delphi to find needed precompiled units of your component you need to add the folder in which they are located to Library path.
In order to allow Delphi to find source files of your component you need to add the folder in which they are located to Browsing path.
You can read more information about these settings in the Delphi documentation which is also available online here:
http://docwiki.embarcadero.com/RADStudio/XE6/en/Library
Note if you don't own Delphi XE6 but one of the previous XE versions simply change the webpage URL by replacing "XE6" with the one you own.
EDIT: I have edited my answer to provide more specific information. Old post below:
If you got to Tools -> Options (or is it Enviroment Options in latest versions) you can set Default options for the Delphi IDE. These options also include the Default path settings which will be automatically used in all new projects.
The way I do this is to have a folder "Lib2" which I use as the unit output directory whenever I compile/install components - I let the components (I mean their source files, etc) be installed whereever they want).
(I call it "Lib2" because traditionally Delphi has placed its own DCUs in a folder called "Lib", and putting all the third-party ones in a folder separate from that one avoided having to re-install Delphi if my set-up got into a mess.)
If you do that, all you need do for new projects is to include the path to that folder in the project search path and set that as the default search path.
The way to do that varies with Delphi version - the D7 era it was just a question of ticking the "Default" checkbox on the Directories/Conditionals tab of Project | Options. The only minor problem is that sometimes the component needs a resource file; if the compiler complains about that, just copy it to there manually.
In XE4, there are several ways of getting Delphi to find compiled DCUs that you've send to Lib2 or whatever you care to call it:
The simplest seems to to do what the other answer suggests, namely add the Lib2 path to the list of Library paths under Tools | Options. The compiler will then use the DCUs it finds there without needing to be able to finds their sources, which is generally a good thing (see "btw" section below).
A second way is to create a project "Option Set" (see the OLH for details of what they are and how to create one, and then edit it (again, see OLH) to include Lib2 in the list of search paths. After that, you can apply that Option Set to any project which it suits. There may be a way to automatically apply your Option Set to new projects, but I haven't managed to find it yet. In any case ...
A third way is to add a project which has Lib2 amongst its search paths to the Delphi repository and then create new projects that you want to use Lib2's contents from this entry in the repository.
Btw, there is an important practical point to having 3rd party libraries and any of your own standard ones output their DCUs to your Lib2 or equivalent. Because the compiler can find the compiled DCUs there, it does not have to be able to find the source code of those libraries in order to be able to compile your project. Isolating the compiled DCUs in this way helps avoid the dreaded "unit x was compiled with a different version of y" error message (y usually being a bpl) which has been the cause of so many cries for help in Delphi newsgroups over the years.
How do I change the default refactoring keyboard mappings in Delphi 2006?
As you probably know, in D2006 you can find the settings under:
Tools > Options > Editor Options > Key Mappings
Also, there is the "Editor speedsetting" under:
Tools > Options > Editor Options
However, these don't give you direct control over the keymappings, they just let you choose a keymapping from among the installed Enhancement Modules. Per D2006 Help:
Enhancement modules
Enhancement modules are special packages that are installed and
registered and use the keyboard
binding features that can be developed
using the Open Tools API. You can
create enhancement modules that
contain new keystrokes or apply new
operations to existing keystrokes.
Once installed, the enhancement modules are displayed in the
Enhancement modules list box. Clicking
the check box next to the enhancement
module enables it and unchecking it
disables it. Key mapping defined in an
installed and enabled enhancement
module overrides any existing key
mapping defined for that key in the
key mapping module which is currently
in effect.
Clearly, this is not a quick do-it-yourself setting.
GExperts has a feature supporting IDE Menu Shortcuts that support hotkey configuration of any IDE menu command, including refactoring commands.