# Aap recipe for handling the message translations of Agide. # Names of the programs used. Change when needed. Xgettext = xgettext Msgfmt = msgfmt -v Msgmerge = msgmerge # Fixed names. PotFile = agide.pot MoFile = LC_MESSAGES/agide.mo # Construct names of the .mo files to be produced. PoFiles = `glob("*.po")` LangNames = `sufreplace(".po", "", PoFiles)` MoFiles = $*LangNames/$MoFile # Default target is to update the .mo files. # The "mofiles" target is used from the toplevel. all mofiles {virtual} : $MoFiles # Rule for making a .mo file from a .po file. :rule %/$MoFile : %.po :mkdir {r}{f} `os.path.dirname(target)` :sys $Msgfmt -o $target $source # Use "aap xx.po" to merge new messages into xx.po. # This is only done when the .po file is specified as a target, because the # xx.po file needs to be edited and tested before it can be used. @for n in expand2list(_no.TARGETARG): @if re.search("\\.po$", n): $n : $PotFile # Make a backup and keep the original file. bak = $(target).bak :copy {force} $target $bak orig = $(target).orig :copy {exist} $target $orig # Rename current version. old = $(target).old :move {f} $target $old @try: :sys $Msgmerge $old $PotFile -o $target @except: :move {f} $old $target :error Msgmerg for $target failed! @else: :del $old $PotFile : ../*.py :cd .. :sys $Xgettext --default-domain=agide --add-comments --keyword=_ --keyword=N_ *.py -o lang/$PotFile # vim: set et sw=4 sts=4 :