On Sun, 14 Jan 2007, Jakub Suchy wrote:
Done, I hope you can make use of it. Any improvements are welcome :) http://drupal.org/cvs?commit=51243
Thanks. These are very nice and easy to understand. Just creating a profile for -module.po doesn't work for me because you expect: // # Hungarian translation of Drupal (modules/aggregator/aggregator.module)
I suggest we alter the script that it takes filename.po, strips "-module" and then copy translation to modules/filename ? Like: node-module.po -> node.po -> modules/node/po/
My suggestion: $module = str_replace("-module.po", "", $filename); print "debug: $filename should go to modules/$module/po/$module.po\n"; // copy...
I went into the code and started to implement this. But the problem is that it is not only about module files. Module files have included code files, and this is increasingly the situation in core. Like node.module has content_types.inc, which has a corresponding PO file. That file has nothing in its name about where it should go in the folder hierarchy, but it has the information put into the POT file by the extractor.
Now we either do a static list of files and where they should go, or we rely on the information which was put into the POT file by the extractor (so it should be there in PO files too). An example from the current aggregator-module.pot and content_types-inc.pot:
# $Id: aggregator-module.pot,v 1.8.2.3 2007/01/10 21:31:10 goba Exp $ # # LANGUAGE translation of Drupal (modules/aggregator/aggregator.module) # Copyright YEAR NAME EMAIL@ADDRESS # Generated from file: aggregator.module,v 1.324 2006/12/26 10:28:12 dries #
# $Id: content_types-inc.pot,v 1.1.2.2 2007/01/10 21:31:10 goba Exp $ # # LANGUAGE translation of Drupal (modules/node/content_types.inc) # Copyright YEAR NAME EMAIL@ADDRESS # Generated from file: content_types.inc,v 1.24 2007/01/09 07:53:26 drumm #
The packaging script expects this format. (It does allow for the path information to be on the first line too, because addition of the CVS Id was a recent change).
Gabor
The packaging script expects this format. (It does allow for the path information to be on the first line too, because addition of the CVS Id was a recent change).
I created this little script to insert headers to my .po files, because my KBabel didn't keep them from .pot files.
I don't ensure it's correct, but it's working with po-packager.php
#!/bin/bash # Usage: ./script.sh LANGNAME YOURNAME EMAIL # Example: ./script.sh Czech "Jakub Suchy" "jakub@rtfm.cz" # This inserts headers into all XYZ-module.po files and saves updated # files into directory "updated-translation"
temp=`mktemp -d` lang=$1 name=$2 email=$3 year=`date +%Y`
for i in *-module.po; do module=`echo "$i" | cut -d "-" -f 1` echo "# $Id$" > "$temp/$i" echo "# " >> "$temp/$i" echo "# $lang translation of Drupal (modules/$module/$module.module)" >> "$temp/$i" echo "# Copyright $year $name ($email)" >> "$temp/$i" echo "# Generated from file: $i" >> "$temp/$i" cat "$i" >> "$temp/$i" done mkdir updated-translation cp $temp/* updated-translation rm -rf $temp