[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2952 - branches/pingus_sdl/data/po
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r2952 - branches/pingus_sdl/data/po |
Date: |
Thu, 16 Aug 2007 06:20:48 +0200 |
Author: grumbel
Date: 2007-08-16 06:20:47 +0200 (Thu, 16 Aug 2007)
New Revision: 2952
Added:
branches/pingus_sdl/data/po/extract-levels.guile
branches/pingus_sdl/data/po/extract-levels.sh
Log:
- simple script to extract text from level files
Added: branches/pingus_sdl/data/po/extract-levels.guile
===================================================================
--- branches/pingus_sdl/data/po/extract-levels.guile 2007-08-16 03:46:42 UTC
(rev 2951)
+++ branches/pingus_sdl/data/po/extract-levels.guile 2007-08-16 04:20:47 UTC
(rev 2952)
@@ -0,0 +1,48 @@
+#!/usr/bin/guile \
+-e main -s
+!#
+
+(define *current-file* "")
+(define pattern-list
+ '((pingus-level head levelname)
+ (pingus-level head description)))
+
+;;(regexp-substitute/global #f "\"" str 'pre "\\\"" 'post))))
+(define (print-msg sexpr)
+ (let ((str (apply string-append sexpr))) ;; string escaping missing
+ (cond ((not (string-null? str))
+ (display "#: ")
+ (display *current-file*)
+ (newline)
+ (display "msgid = \"")
+ (display str)
+ (display "\"\n")
+ (display "msgstr = \"\"\n")
+ (newline)
+ ))))
+
+(define (grep-sexpr func pattern sexpr)
+ (cond ((null? pattern)
+ (func sexpr))
+ (else
+ (for-each (lambda (el)
+ (if (equal? (car pattern) (car el))
+ (grep-sexpr func (cdr pattern) (cdr el))))
+ sexpr))))
+
+(define (main args)
+ (set! args (cdr args))
+ (for-each (lambda (file)
+ (set! *current-file* file)
+ (let* ((port (open-input-file file))
+ (sexpr (list (read port))))
+
+ (for-each (lambda (pattern)
+ (grep-sexpr print-msg pattern sexpr))
+ pattern-list)
+
+ (close-port port)))
+ args)
+ (display "\n;; EOF ;;\n"))
+
+;; EOF ;;
Property changes on: branches/pingus_sdl/data/po/extract-levels.guile
___________________________________________________________________
Name: svn:executable
+ *
Added: branches/pingus_sdl/data/po/extract-levels.sh
===================================================================
--- branches/pingus_sdl/data/po/extract-levels.sh 2007-08-16 03:46:42 UTC
(rev 2951)
+++ branches/pingus_sdl/data/po/extract-levels.sh 2007-08-16 04:20:47 UTC
(rev 2952)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+set -e
+./extract-levels.guile ../levels/*/*.pingus > levels.pot
+
+# EOF #
Property changes on: branches/pingus_sdl/data/po/extract-levels.sh
___________________________________________________________________
Name: svn:executable
+ *
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2952 - branches/pingus_sdl/data/po,
grumbel at BerliOS <=