Table of Contents
Lokalize is extensible using scripts in several interpreted languages, including Python and JavaScript.
Scripts are usually integrated into the Lokalize UI as menu actions (to which you may assign a keyboard shortcut).
The location and name of the menu entry for the script is defined in its accompanying .rc file.
On each project open, Lokalize scans PROJECTDIR/lokalize-scripts
folder for .rc files and adds them to a cache file called
PROJECTDIR/lokalize-scripts/scripts.rc
(so you shouldn't generally want to add it project's version control system).
RC files also contain script paths, which may be relative to .rc file folder, or to a system scripts folder - they both are tried (though they should be kept in a relative location if you want to share them with other people in your project).
For example, you can specify ../../scripts/lokalize/opensrc.py
to load a script from the global kf5-l10n scripts folder (i.e. not specific to your language).
Examples of .rc files may be found in Lokalize install folder (usually /usr/share/lokalize/scripts/
)
and in the KDE repository.
Here you can find more script examples, including JavaScript-based check-gui.js
that runs automatically on each file save
(this is achieved via special option in .rc file).
If you're familiar with Python or JavaScript, the code should be self-explanatory.
Below are links to API references. Everything marked as Q_SCRIPTABLE may be used from scripts.
One of the best scripting capabilities application is the use of Pology in Lokalize.
The interaction with Pology can be configured using the page Pology of the configuration window which can be opened by choosing the → main menu item.
For more information, please refer to Pology homepage.