r8191 - in people/jorda: . desktop-i18n
Jordà Polo
jorda-guest at alioth.debian.org
Wed Sep 24 11:22:39 UTC 2008
Author: jorda-guest
Date: 2008-09-24 11:22:39 +0000 (Wed, 24 Sep 2008)
New Revision: 8191
Added:
people/jorda/desktop-i18n/
people/jorda/desktop-i18n/Makefile
people/jorda/desktop-i18n/desktop-i18n.sh
people/jorda/desktop-i18n/desktop-translate
people/jorda/desktop-i18n/desktop-xgettext
Removed:
people/jorda/xgettextdesktop
Log:
Move to subdirectory and import remaining scripts.
Added: people/jorda/desktop-i18n/Makefile
===================================================================
--- people/jorda/desktop-i18n/Makefile (rev 0)
+++ people/jorda/desktop-i18n/Makefile 2008-09-24 11:22:39 UTC (rev 8191)
@@ -0,0 +1,25 @@
+BASE_PATH := .
+DOMAIN := games-desktop
+POT := $(DOMAIN).pot
+POS := $(wildcard *.po)
+
+all: $(POT) $(POS) stats
+
+update-po: $(POT)-update $(POS)
+
+$(POT) $(POT)-update:
+ ./desktop-xgettext $(BASE_PATH) > $(POT)
+ msguniq -o $(POT) $(POT)
+
+$(POS): $(POT)
+ msgmerge -U $@ $<
+ touch $@
+
+clean:
+ rm -f *~
+
+stats:
+ @for i in $(POS); do \
+ echo -n `basename $$i | sed 's/\.po//'`": "; \
+ msgfmt --statistics -o /dev/null $$i; \
+ done
Added: people/jorda/desktop-i18n/desktop-i18n.sh
===================================================================
--- people/jorda/desktop-i18n/desktop-i18n.sh (rev 0)
+++ people/jorda/desktop-i18n/desktop-i18n.sh 2008-09-24 11:22:39 UTC (rev 8191)
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# Shell "library" for .desktop file internationalization.
+#
+# Copyright © 2008 Jordà Polo <jorda at ettin.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.
+
+# Keys such as GenericName are also translatable, but it looks like it is
+# heavily misused. Many desktop files in the pkg-games repos simply use the
+# same string for GenericName and for Name or Exec (which is wrong). See also:
+# http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html
+i18n_keys="GenericName Comment"
+
+i18n_print_msg() {
+ string=$1
+ file=$2
+ comment=$3
+
+ echo ""
+ if [ "$comment" != "" ]; then
+ echo "#. $comment"
+ fi
+ echo "#: $file"
+ echo "msgid \"$string\""
+ echo "msgstr \"\""
+}
Added: people/jorda/desktop-i18n/desktop-translate
===================================================================
--- people/jorda/desktop-i18n/desktop-translate (rev 0)
+++ people/jorda/desktop-i18n/desktop-translate 2008-09-24 11:22:39 UTC (rev 8191)
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# This script reads a .desktop file from stdin and prints the same file, with
+# up-to-date translations, to stdout.
+#
+# Copyright © 2008 Jordà Polo <jorda at ettin.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.
+
+. desktop-i18n.sh
+
+i18n_keys_re="^\(`echo $i18n_keys | sed 's/ /\\\|/'`\)="
+
+while read line; do
+ # Remove previous translations
+ if echo $line | grep '^.*\[.*\]=' > /dev/null; then
+ continue
+ fi
+
+ echo $line
+
+ # Check whether the current line is translatable
+ key=`echo $line | sed -n "s/$i18n_keys_re.*/\1/p"`
+ if [ -z "$key" ]; then
+ continue
+ fi
+
+ # Generate available translations
+ msgid=`echo $line | sed "s/$i18n_keys_re//"`
+ for po in *.po; do
+ lang=`basename $po | sed 's/\.po//'`
+ msgstr=`msgattrib --translated --no-obsolete --no-fuzzy $po \
+ | msggrep --no-location --no-wrap --msgid -F -e "$msgid" \
+ | tail -n 1 | sed 's/^msgstr "\(.*\)"$/\1/'`
+ if [ "$msgstr" != "" ]; then
+ echo "$key[$lang]=$msgstr"
+ fi
+ done
+done
Property changes on: people/jorda/desktop-i18n/desktop-translate
___________________________________________________________________
Name: svn:executable
+ *
Copied: people/jorda/desktop-i18n/desktop-xgettext (from rev 8190, people/jorda/xgettextdesktop)
===================================================================
--- people/jorda/desktop-i18n/desktop-xgettext (rev 0)
+++ people/jorda/desktop-i18n/desktop-xgettext 2008-09-24 11:22:39 UTC (rev 8191)
@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+# Extract translatable strings from .desktop files.
+#
+# Copyright © 2008 Jordà Polo <jorda at ettin.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.
+
+. desktop-i18n.sh
+
+if [ ! -d "$1" ]; then
+ echo "Usage: $0 input-directory"
+ exit 1
+fi
+
+cat <<HEADER
+# LANGUAGE translation of Debian Games .desktop files.
+# Copyright © `date +%Y` Debian Games Team
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: pkg-games-desktop 0.1\n"
+"Report-Msgid-Bugs-To: jorda at ettin.org\n"
+"POT-Creation-Date: `date +"%F %H:%M%z"`\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+HEADER
+
+for file in `find $1 -name *.desktop`; do
+ for key in $i18n_keys; do
+ msg=`grep "^$key=" $file | sed "s/^$key=//"`
+ if [ "$msg" != "" ]; then
+ i18n_print_msg "$msg" "$file" "$key"
+ fi
+ done
+done
Property changes on: people/jorda/desktop-i18n/desktop-xgettext
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mergeinfo
+
Deleted: people/jorda/xgettextdesktop
===================================================================
--- people/jorda/xgettextdesktop 2008-09-23 18:31:12 UTC (rev 8190)
+++ people/jorda/xgettextdesktop 2008-09-24 11:22:39 UTC (rev 8191)
@@ -1,49 +0,0 @@
-#!/bin/sh
-
-# Keys such as GenericName are also translatable, but it looks like it is
-# heavily misused. Many desktop files in the pkg-games repos simply use the
-# same string for GenericName and for Name or Exec (which is wrong). See also:
-# http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html
-translatable_keys="Comment"
-
-print_msg() {
- string=$1
- file=$2
- comment=$3
-
- echo ""
- if [ "$comment" != "" ]; then
- echo "#. $comment"
- fi
- echo "#: $file"
- echo "msgid \"$string\""
- echo "msgstr \"\""
-}
-
-cat <<HEADER
-# LANGUAGE translation of Debian Games .desktop files
-# Copyright © `date +%Y` Debian Games Team
-# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: pkg-games-desktop 0.1\n"
-"Report-Msgid-Bugs-To: jorda at ettin.org\n"
-"POT-Creation-Date: `date +"%F %H:%M%z"`\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
-"Language-Team: LANGUAGE <LL at li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-HEADER
-
-for i in `find . -name *.desktop`; do
- for j in Comment; do
- msg=`grep "^$j=" $i | sed "s/^$j=//"`
- if [ "$msg" != "" ]; then
- print_msg "$msg" "$i" "$j"
- fi
- done
-done
More information about the Pkg-games-commits
mailing list