[Xfce-i18n] po/POTFILES.in

Daichi Kawahata daichi at xfce.org
Tue Nov 22 14:30:17 CET 2005


On Thu, 17 Nov 2005 17:32:03 +0900
Daichi Kawahata wrote:

> Therefore, in this time, I'd like to unify
> the style for POTFILES.in files:
> 
>   d) Listing only files which contain translatable strings actually
>      with initial comments, in which desktop files get separated.

Updated with the attached script except Benedict, Jasper's package.
For developers, you don't have to follow my way of course, but if
possible, try to list minimum number of files, update if you'll add
the file contains translatable strings.

Regards,
-- 
Daichi

Language Codes: http://www.w3.org/WAI/ER/IG/ert/iso639.htm
Country Codes: http://www.ics.uci.edu/pub/ietf/http/related/iso3166.txt
-------------- next part --------------
#!/bin/sh

#  potfiles-in.sh - Create POTFILE.in file.
#
#  Usage: potfiles-in.sh (in the "po" directory)
#
#  Copyright (C) 2005 Daichi Kawahata <daichi at xfce.org>
#
#  This script is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License as
#  published by the Free Software Foundation; either version 2 of the
#  License, or (at your option) any later version.
#
#  This script is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#  As a special exception to the GNU General Public License, if you
#  distribute this file as part of a program that contains a
#  configuration script generated by Autoconf, you may include it under
#  the same distribution terms that you use for the rest of that program.

# Changes
#
# 0.3 (2005-11-21):
#
#   * Changed to the lower case letters on output strings.
#   * Removed extra comment string (if desktop file doesn't exist).
#
# 0.2 (2005-11-19):
#
#   * Improved matching regex by Danny Milosavljevic <dannym at xfce.org>.
#
# 0.1 (2005-11-17):
#
#   * Initial version.
#

topdir=..

regex="\<[NQ]*_("

# Grabs package name and version number.
if [ -f $topdir/config.h ]; then
  package=`grep PACKAGE_STRING $topdir/config.h | sed 's/#define PACKAGE_STRING \"//' | sed 's/\"//'`
else
  echo
  echo "This script assumes a program is using GNU Autotools (Autoheader)"
  echo "and 'config.h' is already generated. Please run './configure' in"
  echo "the top directory at first."
  echo
  exit 0
fi

echo
echo "Creating latest 'POTFILES.in' file for the $package."
echo

# Inserts header comments.
#echo "# POTFILE.in file for $package." >  pot_head.tmp
#echo "#" >> pot_head.tmp
echo "# List of source files containing translatable strings." > pot_head.tmp
#echo "# Please keep this file sorted alphabetically." >> pot_head.tmp

echo >> pot.tmp

echo -n "checking for c source files... "
find $topdir -name "*.[chily]" -exec grep -l "$regex" {} \; >> pot.tmp
#perl -i -p -e "s/.*getopt\.c//g" pot.tmp
perl -i -p -e "s/.*intl\.h//g" pot.tmp
echo "done."

echo -n "checking for c++ source files... "
find $topdir -name "*.cc" -exec grep -l "$regex" {} \; >> pot.tmp
find $topdir -name "*.cpp" -exec grep -l "$regex" {} \; >> pot.tmp
echo "done."

echo -n "checking for glade files... "
find $topdir -name "*.glade[ 2]" -exec grep -l "translatable\=\"yes\"" {} \; >> pot.tmp
echo "done."

echo -n "checking for theme files... "
find $topdir -name "*.theme.in" >> pot.tmp
echo "done."

#echo -n "checking for xml files... "
#find $topdir -name "*.xml" -exec grep -l '<_' {} \; >> pot.tmp
#find $topdir -name "*.xml.in" -exec grep -l "name=\"" {} \; >> pot.tmp
#echo "done."

echo -n "checking for python files... "
find $topdir -name "*.py" -exec grep -l "$regex" {} \; >> pot.tmp
echo "done."

echo -n "checking for schema/gconf files... "
find $topdir -name "*.schemas.in" >> pot.tmp
echo "done."

echo -n "checking for server files... "
find $topdir -name "*.server.in" >> pot.tmp
find $topdir -name "*.server.in.in" >> pot.tmp
echo "done."

echo -n "checking for key files... "
find $topdir -name "*.keys_template.in" >> pot.tmp
find $topdir -name "*.keys.in" >> pot.tmp
echo "done."

echo -n "checking for miscellaneous files... "
# For xfce4-mixer
find $topdir -name "*.gob" -exec grep -l "$regex" {} \; >> pot.tmp
echo "done."

echo
echo -n "merging and sorting listed files... "
cat pot_head.tmp > POTFILES.in
cat pot.tmp | sort | uniq | sed -e "s/\.\.\///g" >> POTFILES.in
echo "done."

echo
echo -n "checking for desktop files... "
echo >> desktop.tmp
echo "# files added by intltool-prepare." >>  desktop.tmp
find $topdir -name "*.desktop.in" >> desktop.tmp
find $topdir -name "*.desktop.in.in" >> desktop.tmp
echo "done."

if grep "\.desktop" desktop.tmp > /dev/null; then

  echo
  echo -n "merging and sorting listed files... "
  cat desktop.tmp | sort | uniq | sed -e "s/\.\.\///g" >> POTFILES.in
  echo "done."

fi

# Clean temporary files.
rm pot_head.tmp pot.tmp desktop.tmp

echo
echo "Now run 'make update-po' in this directory."
echo

exit 0


More information about the Xfce4-dev mailing list