pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r2962 - branches/pingus_sdl/contrib


From: grumbel at BerliOS
Subject: [Pingus-CVS] r2962 - branches/pingus_sdl/contrib
Date: Thu, 16 Aug 2007 18:47:39 +0200

Author: grumbel
Date: 2007-08-16 18:47:38 +0200 (Thu, 16 Aug 2007)
New Revision: 2962

Added:
   branches/pingus_sdl/contrib/extract-gettext.rb
Removed:
   branches/pingus_sdl/contrib/extract-gettext.sh
   branches/pingus_sdl/contrib/extract-gettext.xsl
Log:
- added script to get text out of the level files

Added: branches/pingus_sdl/contrib/extract-gettext.rb
===================================================================
--- branches/pingus_sdl/contrib/extract-gettext.rb      2007-08-16 14:51:14 UTC 
(rev 2961)
+++ branches/pingus_sdl/contrib/extract-gettext.rb      2007-08-16 16:47:38 UTC 
(rev 2962)
@@ -0,0 +1,36 @@
+#!/usr/bin/ruby -w
+
+require "rexml/document"
+require "rexml/xpath"
+
+puts "# SOME DESCRIPTIVE TITLE."
+puts "# Copyright (C) YEAR Free Software Foundation, Inc."
+puts "# FIRST AUTHOR <address@hidden>, YEAR."
+puts "#"
+puts "#, fuzzy"
+puts "msgid \"\""
+puts "msgstr \"\""
+puts "\"Project-Id-Version: PACKAGE VERSION\\n\""
+puts "\"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\\n\""
+puts "\"Last-Translator: FULL NAME <address@hidden>\\n\""
+puts "\"Language-Team: LANGUAGE <address@hidden>\\n\""
+puts "\"MIME-Version: 1.0\\n\""
+puts "\"Content-Type: text/plain; charset=UTF-8\\n\""
+puts "\"Content-Transfer-Encoding: 8bit\\n\""
+puts ""
+
+lang = ARGV[0]
+ARGV[1..-1].each{|arg|
+  doc = REXML::Document.new(File.new(arg))
+  REXML::XPath.each(doc, "/pingus-level/global/address@hidden'en']") { 
|element|
+    puts "#: #{arg.gsub(/^\.\.\/\.\.\/pingus_0_6\//, "")}"
+    puts "msgid \"#{element.text.gsub(/\s+/, " ")}\""
+  }
+
+  REXML::XPath.each(doc, "/pingus-level/global/address@hidden'#{lang}']") { 
|element|
+    puts "msgstr \"#{element.text.gsub(/\s+/, " ")}\""    
+  }
+  puts ""
+}
+
+# EOF #


Property changes on: branches/pingus_sdl/contrib/extract-gettext.rb
___________________________________________________________________
Name: svn:executable
   + *

Deleted: branches/pingus_sdl/contrib/extract-gettext.sh
===================================================================
--- branches/pingus_sdl/contrib/extract-gettext.sh      2007-08-16 14:51:14 UTC 
(rev 2961)
+++ branches/pingus_sdl/contrib/extract-gettext.sh      2007-08-16 16:47:38 UTC 
(rev 2962)
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-OUTPUTFILE="/tmp/leveltexts.txt"
-TMPFILE=`tempfile`
-
-if [ -e $OUTPUTFILE ]; then
-    echo "$OUTPUTFILE exist, move it out of the way please."
-    exit 1;
-else
-    echo "### Levelnames and description, automatically  extracted from 
levelfiles" > $OUTPUTFILE
-    echo "" >> $OUTPUTFILE
-
-    for filename in ../data/levels/tutorial/*.xml; do
-        echo "Extracting text from $filename"
-        shortname=`basename $filename`
-        xalan \
-            -PARAM filename "'$shortname'" \
-            -IN $filename \
-            -OUT $TMPFILE \
-            -TEXT \
-            -Q \
-            -XSL extract-gettext.xsl
-        cat $TMPFILE >> $OUTPUTFILE
-    done
-
-    echo "### EOF ###" >> $OUTPUTFILE
-fi
-
-# EOF #

Deleted: branches/pingus_sdl/contrib/extract-gettext.xsl
===================================================================
--- branches/pingus_sdl/contrib/extract-gettext.xsl     2007-08-16 14:51:14 UTC 
(rev 2961)
+++ branches/pingus_sdl/contrib/extract-gettext.xsl     2007-08-16 16:47:38 UTC 
(rev 2962)
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
-  <xsl:output method="text"/>
-
-  <xsl:param name="filename"/>
-
-  <xsl:template match="/">
-
-    <xsl:text># -- Begin Level: </xsl:text>
-    <xsl:value-of select="$filename"/>
-    <xsl:text>&#x0a;</xsl:text>
-    <xsl:apply-templates/>
-    <xsl:text># -- End Level: </xsl:text>
-    <xsl:value-of select="$filename"/>
-    <xsl:text>&#x0a;</xsl:text>
-    <xsl:text>&#x0a;</xsl:text>
-    <xsl:text>&#x0a;</xsl:text>
-  </xsl:template>
-
-  <xsl:template match="/pingus-level/global/levelname">
-    <xsl:text># Levelname: &#x0a;</xsl:text>
-    <xsl:text>msgid  "</xsl:text>
-    <xsl:value-of select="text()"/>
-    <xsl:text>"&#x0a;</xsl:text>
-    <xsl:text>msgstr ""&#x0a;&#x0a;</xsl:text>
-  </xsl:template>
-
-  <xsl:template match="/pingus-level/global/description">
-    <xsl:text># Description: &#x0a;</xsl:text>
-    <xsl:text>msgid "</xsl:text>
-    <xsl:value-of select="text()"/>
-    <xsl:text>"&#x0a;</xsl:text>
-    <xsl:text>msgstr ""&#x0a;</xsl:text>
-  </xsl:template>
-
-  <xsl:template match="text()|@*"/>
-
-</xsl:stylesheet>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]