Intro
mad.pl is a simple perl script intended to transform an Opera's *.po file in several ways. Opera's translation is maintained in a main *.po file. The browser itself uses a *.lng file. mad.pl is able to convert *.po to *.lng, optionally applying some additional conversion.
Apart from mad.pl tool, there is a off.pl toolf for Opera translators. off.pl is described on a separate page.
Availability
The mad.pl script is available for free. You can change and use it in whatever way you like to.
WARNING
I am not a proffessional programmer. This script is probably written in very bad style. I wrote it only because I needed it. And it helps me very much when I translate Opera 7 into Bulgarian.
Use this script only on you own risc. I cannot be responsible about things you do with things you find anywhere on the net.
If you translate Opera officially, Opera Software would give you access to better processing tools for Linux and Windows.
mad.pl had a bug which is now fixed (10x to a note by Nikolay Filipov). If you used *.lng produced by mad.pl, your browser's UA would not reflect the language you test.This is now corrected.
*.lng files produced by mad.pl can be used only for internal tests. *.lng for public test should be produced by Opera Software. (If you are desparate you may consult our off.pl page)
I have been using this script only with (the usual) one-byte encodings (eg. Cyrillic Windows-1251) and not with UTF-8. I don't have a clue if and how it is supposed to work with unicode. I usually edit and work on a one-byte encoded file (eg.Windows-1251) and then transform it to UTF-8 if needed (using the standard iconv tool, see below).
How to use mad.pl
mad.pl accepts data from standard input, and prints the result into the standard output. Standard input data are expected to be in *.po format. Options are specified as commad arguments:
po2lng- Converts
*.pointo*.lng. If this option is not present, mad.pl produces*.po. noamp- Removes any ampersands (
&) from the tranlated messages, if no ampersand exist in the messages being tranlated. In newer versions of*.poit may happen that the only difference of an original message, comparing with the older version, is a removed ampersand. So the translation is still valid, just the ampersand needs to be removed from it too. This options is trying to do this annoying job at once, instead of you. You still have to check if the old translation still reflects the sense of the newer English string. spell- Removes any characters that are getting in the way of the spellcheck. The
*.pofile usually contains ampersands and many other stuff that make it hard to spellcheck the translated messages. This removes the bad things. Doing a spellcheck on the output, you can see what needs to be corrected in the input. noblank- In case
po2lngoption is given,noblankcomments out any untranslated messages with a semicolon (;). This way, Opera would use only the translated strings, and will show the original English stings instead of empty strings in case a translation is missing. If this option is missed out,*.lngmay contain empty message declaration and Opera won't show any strings for those messages.
Examples of using mad.pl
Note: I use it under Linux. I have never run perl on Windows.
Usual transformation of source.po into dest.lng:
mad.pl po2lng noblank <source.po >dest.lng
Removing unwanted (not present in the English strings) ampersands from the translated strings:
mad.pl noamp <source.po >cleaned.po
Preparing a file for easy spellcheck:
mad.pl po2lng spell <source.po >spellme.txt
Example of using iconv
Converting a Windows-1251 encoded file named dest.lng into an UTF-8 encoded file named dest_in_utf_8.lng:
iconv -f windows-1251 -t utf-8 -o dest_in_utf_8.lng dest.lng
Mnemonic: -f means from encoding
; -t means to encoding
; -o means output to (file...)
I highly recommend using UTF-8 encoded *.lng, since it offers maximum reliability and nonproblematic localization of Opera.
