This is Python 3.2 script which tries to detect
conflicts in keyboard shortcuts on dialogs, panels, menus etc. Although they
don't need to be unique it's better if they are. Note that this tool can check
only those parts of dialogs which are defined in XRC files, it cannot check
conflicts with parts generated at runtime by the application. I only tested it
with FileZilla, but theoretically it should work with any application which is
based on XRC and gettext.
Requirements
- Python 3.2.
- MO file with your translation. It makes sense to test only fully
completed translation.
- XRC files. These files contain dialogs definitions. They are distributed as
a part of FileZilla sources. They should correspond to filezilla.pot you've used
to update yours PO file. If you are using POT from the FileZilla's Translation
page then download newest Source snapshot from the Nightly Builds page. Unpack
the sources somewhere. The locales\filezilla.pot file should be the same as the
POT file from the Translations page you've used. (If not use it for updating PO
file.) XRC files should be in the src\interface\resources directory.
Installation
- Download Ampersands
Checker and unpack it somewhere.
- (Windows) If you are not going to run Ampersands Checker from command prompt
window and you've not installed Python into C:\Python32 update the
amps_checker.bat accordingly.
- Edit the config.txt, see comments in that file to configure it properly.
Running
- Run amps_checker.bat (or amps_checker.py if you are in the command line or
shell). If no error happened then you should find the results in the output file
specified in config.txt.
- Results should look like this:
Processing dialog dialogs.xrc wxDialog ID_COLUMN_SETUP Column setup
Processing dialog dialogs.xrc wxDialog ID_MANUALTRANSFER Manual transfer
String "Sou&bor:" and "ZpĹŻso&b pĹ™ihlašovánĂ:" contains same shortcut!
String "S&erver" and "Úč&et:" contains same shortcut!
Used characters on this dialog: b d e h l m o p r s u v y z
This means
that no conflicts were found in the dialog "Column setup" and two conflicts were
found in the "Manual transfer" dialog. It also tells you which characters are
already in use so you know which are free to use.
resh2xrc_line_no
This simple Python 3.2 script replaces lines like
#: resources.h:775
in the PO file with lines like
#line 525 "./settings.xrc"
sou you can look inside the XRC file for
the context of translated message. This script takes two arguments: resource.h
and the PO file. It writes results to the file with same name as the PO file +
".out". How to get resource.h? Download FileZilla sources (must be the exactly
same version as was used for generating POT file which was last time used for
updating PO file or the line numbers won't match). Unpack them and in the
directory with XRC files (see above) run:
wxrc /g /o resource.h *.xrc
wxrc is part of the
wxWidgets. Precompiled Windows binary is
part of the
resh2xrc_line_no
package.
Patch for poEdit
This is my experimental
patch against poEdit
git which adds option for ignoring ampersands in the messages when sorting. (So
&b is placed between a and c.) Sorry, no binaries.