In computer programming the term profiling is used to indicate when a program is analysed to see where it spends most of its time. The theory being that that is where you should put in effort to optimise the code and thus improve speed and responsiveness.
A similar concept can be applied to translation. If you translate only the messages that people actually see then you can optimise the effort that you expend on translation.
It also helps focus the translation effort onto programs that are actually being used, not those that you guess might be being used.
The gettext libraries are called by a program with a request for the translation of a given string. Gettext looks up the string and returns the translation to the program.
When profiling this call to gettext is intercepted and the message requested is output to a file. This file is then later processed and contains all strings that should be translated.
export LC_ALL=C
The Gettextlog tool is available here:
http://sourceforge.net/projects/gettextlog/
An RPM is also available:
http://prdownloads.sourceforge.net/gettextlog/gettextlog-0.6-1.i386.rpm?download
Once installed...
export LD_PRELOAD=/file/to/gettextlog.so
You can place this in your .bash_profile
to log continuously or in /etc/profile.d/
add a gettextlog.sh
script to initialise LD_PRELOAD
You can run it against individual programs with the run-with-gettextlog
program
Your profiles will be output to:
$HOME/gettextlog/$PROGRAM.po