|
From: <ge...@us...> - 2009-03-26 13:59:19
|
Revision: 1774
http://nocc.svn.sourceforge.net/nocc/?rev=1774&view=rev
Author: gerundt
Date: 2009-03-26 13:59:04 +0000 (Thu, 26 Mar 2009)
Log Message:
-----------
Add python script to create POT file for htdocs
Added Paths:
-----------
trunk/create_potfile_for_htdocs.py
trunk/htdocs/engine/languages/
trunk/htdocs/engine/languages/en.pot
Added: trunk/create_potfile_for_htdocs.py
===================================================================
--- trunk/create_potfile_for_htdocs.py (rev 0)
+++ trunk/create_potfile_for_htdocs.py 2009-03-26 13:59:04 UTC (rev 1774)
@@ -0,0 +1,86 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-;
+
+# Python script to create the POT file for htdocs
+#
+# Copyright 2009 Tim Gerundt <ti...@ge...>
+#
+# This file is part of NOCC. NOCC is free software under the terms of the
+# GNU General Public License. You should have received a copy of the license
+# along with NOCC. If not, see <http://www.gnu.org/licenses/>.
+#
+# $Id$
+
+from os.path import abspath, isfile, join, splitext, walk
+from time import strftime
+import string
+import re
+
+def getPhpFiles(path):
+ ''' Get all php files from a folder and his subfolders '''
+ phpfiles = []
+ walk(path, walkPhpFiles, phpfiles)
+ return phpfiles
+
+def walkPhpFiles(phpfiles, dirpath, itemnames):
+ ''' Helper function for getPhpFiles() '''
+ for itemname in itemnames: #For all dir items...
+ fullitempath = abspath(join(dirpath, itemname))
+ if isfile(fullitempath): #If a file...
+ filename = splitext(itemname)
+ if str.lower(filename[1]) == '.php' or str.lower(filename[1]) == '.inc': #If a PHP file...
+ phpfiles.append(fullitempath)
+
+def getTranslationsFromPhpFile(php_file, translations):
+ ''' Get the translations from a php file '''
+ rGettext = re.compile('_e?\(["\'](.*?)["\']', re.IGNORECASE)
+
+ i = 0
+ lines = open(php_file, 'r')
+ for line in lines: #For all lines...
+ i += 1
+ tmp = rGettext.findall(line)
+ if tmp: #If found a gettext function...
+ translation = tmp[0]
+ if translation in translations: #If the translation is already exists...
+ translations[translation] += [(php_file, i)]
+ else: #If the translation is NOT already exists...
+ translations[translation] = [(php_file, i)]
+
+#Main routine...
+translations = {}
+php_files = getPhpFiles('htdocs')
+for php_file in php_files: #For all php files...
+ getTranslationsFromPhpFile(php_file, translations)
+
+potfile = open('htdocs/engine/languages/en.pot', 'w')
+potfile.write('# This file is part from NOCC <http://nocc.sf.net/>\n')
+potfile.write('# Released under the "GNU General Public License"\n')
+potfile.write('#\n')
+potfile.write('# ID line follows -- this is updated by SVN\n')
+potfile.write('# $' + 'Id' + '$\n')
+potfile.write('#\n')
+potfile.write('msgid ""\n')
+potfile.write('msgstr ""\n')
+potfile.write('"Project-Id-Version: NOCC\\n"\n')
+potfile.write('"Report-Msgid-Bugs-To: http://sourceforge.net/tracker/?group_id=12177&atid=112177\\n"\n')
+potfile.write('"POT-Creation-Date: %s\\n"\n' % strftime('%Y-%m-%d %H:%M+0000'))
+potfile.write('"PO-Revision-Date: \\n"\n')
+potfile.write('"Last-Translator: \\n"\n')
+potfile.write('"Language-Team: English <noc...@li...>\\n"\n')
+potfile.write('"MIME-Version: 1.0\\n"\n')
+potfile.write('"Content-Type: text/plain; charset=iso-8859-1\\n"\n')
+potfile.write('"Content-Transfer-Encoding: 8bit\\n"\n')
+potfile.write('"X-Poedit-Language: English\\n"\n')
+potfile.write('"X-Poedit-SourceCharset: iso-8859-1\\n"\n')
+potfile.write('"X-Poedit-Basepath: ../\\n"\n')
+potfile.write('\n')
+for translation in translations: #For all translations...
+ references = translations[translation]
+# for reference in references: #For all references...
+# potfile.write('#: %s:%u\n' % (reference[0], reference[1]))
+ potfile.write('#, c-format\n')
+ potfile.write('msgid "%s"\n' % (translation))
+ potfile.write('msgstr ""\n')
+ potfile.write('\n')
+potfile.close()
Property changes on: trunk/htdocs/engine/languages
___________________________________________________________________
Added: tsvn:projectlanguage
+ 1033
Added: tsvn:autoprops
+ *.php = svn:keywords=Author Date Id Revision
Added: bugtraq:url
+ http://sourceforge.net/support/tracker.php?aid=%BUGID%
Added: bugtraq:logregex
+ (\d{6,})
Added: trunk/htdocs/engine/languages/en.pot
===================================================================
--- trunk/htdocs/engine/languages/en.pot (rev 0)
+++ trunk/htdocs/engine/languages/en.pot 2009-03-26 13:59:04 UTC (rev 1774)
@@ -0,0 +1,125 @@
+# This file is part from NOCC <http://nocc.sf.net/>
+# Released under the "GNU General Public License"
+#
+# ID line follows -- this is updated by SVN
+# $Id$
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: NOCC\n"
+"Report-Msgid-Bugs-To: http://sourceforge.net/tracker/?group_id=12177&atid=112177\n"
+"POT-Creation-Date: 2009-03-26 14:56+0000\n"
+"PO-Revision-Date: \n"
+"Last-Translator: \n"
+"Language-Team: English <noc...@li...>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-Language: English\n"
+"X-Poedit-SourceCharset: iso-8859-1\n"
+"X-Poedit-Basepath: ../\n"
+
+#, c-format
+msgid "Patches"
+msgstr ""
+
+#, c-format
+msgid "Development Team"
+msgstr ""
+
+#, c-format
+msgid "Error 404 (Page Not Found))"
+msgstr ""
+
+#, c-format
+msgid "FAQ"
+msgstr ""
+
+#, c-format
+msgid "Translations"
+msgstr ""
+
+#, c-format
+msgid "Project Page"
+msgstr ""
+
+#, c-format
+msgid "Feature Requests"
+msgstr ""
+
+#, c-format
+msgid "License"
+msgstr ""
+
+#, c-format
+msgid "Changelog"
+msgstr ""
+
+#, c-format
+msgid "Documentation"
+msgstr ""
+
+#, c-format
+msgid "ISO-8859-1"
+msgstr ""
+
+#, c-format
+msgid "Support Requests"
+msgstr ""
+
+#, c-format
+msgid "Mailing Lists"
+msgstr ""
+
+#, c-format
+msgid "English"
+msgstr ""
+
+#, c-format
+msgid "NOCC - Host your own Webmail Client"
+msgstr ""
+
+#, c-format
+msgid "Bug Tracking"
+msgstr ""
+
+#, c-format
+msgid "Fast, extensible multi-user Webmail (POP3,IMAP) client."
+msgstr ""
+
+#, c-format
+msgid "NOCC Webmail"
+msgstr ""
+
+#, c-format
+msgid "German"
+msgstr ""
+
+#, c-format
+msgid "Forums"
+msgstr ""
+
+#, c-format
+msgid "Supported"
+msgstr ""
+
+#, c-format
+msgid "nocc, webmail, php, pop3, imap, smtp, multiuser"
+msgstr ""
+
+#, c-format
+msgid "SVN Snapshot"
+msgstr ""
+
+#, c-format
+msgid "Download"
+msgstr ""
+
+#, c-format
+msgid "Home"
+msgstr ""
+
+#, c-format
+msgid "Screenshots"
+msgstr ""
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|