Checking PO files with PO filter
Quickstart
1) pofilter -l (select a filter)
2) pofilter -i existing_files/ -o errors/ [-t specific tests] [--excludefilter don't perform specific tests]
3) vim errors/*.po (delete items you don't want changed, set fuzzy if needed,
delete if not needed)
4) pomerge -i errors/ -o existing_files/ -t existing_files/ (will overwrite
existing files)
5) cvs diff -u existing_files/ > x.diif
6) vim x.diff (check to see that the updates are what you want)
7) cvs ci existing_files/
Filtering
Select a number of tests to run, pofilter will list available tests:
pofilter -l
Run the tests against existing po files
pofilter -i existing_files/ -o errors/ [-t specific tests] [--excludefilter don't perform specific tests]
You can also specify whether checks should be for --gnome --openoffice --kde or --mozilla
You can also specify whether you want fuzzy entries included and checked --fuzzy,
by default this is off because fuzzy strings are usually known to be broken and
will be reviewed by translators anyway.
Similarly you can include items marked for review --review or --ingnorereview
by default review items are included. This is not part of the standard Gettext
format we have allowed entries like this when we want to communicate to someone
what error we have picked up.
#, review - wrong word for gallery chosen
This is marked like a fuzzy entry
You can run pofilter without the -t option. This runs all checks which can be
confusing. One strategy is to run each test individually. This allows you to
focus on one problem at a time across a number of files. It is much easier to
correct end punctuation on its own then to correct many different types of
errors. For a small file it is probably best to run all of the test together.
Edit the files
You can edit the files in KBabel, vi, etc. You need to edit the files in the errors/ directory. Only entries
that failed the test are listed. All entries are marked as fuzzy so that you can see your progress in GUI
translation tools.
For vi run this command:
vim `find errors/ -name "*.po"`
The checker places a comment like this
#_whitespace: whitespace at the beginning or end of the string did not match
#_test: test description
Use that to help you determine what is wrong. Remember that all your changes will
be ported back into the po files. So if you leave a string fuzzy in the error
files it will become fuzzy in the main files when you merge the corrected file back into the main file.
The computer can get it wrong, so an error that pofilter finds may in fact not be an error. We'd like
to hear about these false positives so that we can improve the checks. Also if you have some checks that
you have added or ideas for better check then let us know.
Merging your corrections back into the originals
pomerge -i errors/ -o existing_files/ -t existing_files/
If -t and -o are the same directory then the files will be overwritten
Checking the corections
We have done this against CVS but you could run a normal diff between a good
copy and your modiciations.
cvs diff -u existing_files/ > x.diff
This creates a unified diff (one with + and - lines so you can see what was
added and what was removed) in the file x.diff
vim x.diff
Check the diff file in any editor, here we use vim. You should check to see
that the changes you requested are going in and that somethign major did not go
wrong. Also look to see if you haven't left any "#_test: test description"
lines which should have been deleted from the error checking PO files.
cvs ci existing_files/
If you are happy then check the files into CVS and start again with another
check.