[Xfce-i18n] po/POTFILES.in

Daichi Kawahata daichi at xfce.org
Sat Nov 19 14:32:05 CET 2005


On Thu, 17 Nov 2005 01:32:52 -0800
Brian J. Tarricone wrote:

> I'm ok with whatever you want to do to make it easiest on
> yourself.

Okay.

FYI, Benedikt, Jasper, other developers, I'm using this
attached script for updating POTFILES.in, if you have
another way to create this file, please let me know.

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.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 requires config.h is already generated."
  echo "Please run ./configure in 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_head.tmp

# If source code has UTF-8 encoded strings, this should be auto-detected.
#echo "[encoding: UTF-8]" >> pot_head.tmp

echo -n "Gathering C source files... "
find $topdir -name "*.[chily]" -exec grep -l "$regex" {} \; >> pot.tmp
echo "done."

echo -n "Gathering 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 "Gathering Glade files... "
find $topdir -name "*.glade[ 2]" -exec grep -l "translatable\=\"yes\"" {} \; >> pot.tmp
echo "done."

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

echo -n "Gathering 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 "Gathering Python files... "
find $topdir -name "*.py" -exec grep -l "$regex" {} \; >> pot.tmp
echo "done."

echo -n "Gathering Schema/GConf files... "
find $topdir -name "*.schemas.in" >> pot.tmp
echo "done."

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

echo -n "Gathering Key files... "
find $topdir -name "*.keys_template.in" >> pot.tmp
find $topdir -name "*.keys.in" >> pot.tmp
echo "done."

echo -n "Gathering 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 "Adding 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."

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

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

echo
echo "Please run \"make update-po\" in this directory."
echo

exit 0


More information about the Xfce4-dev mailing list