*Added a gettext scons tool to site_scons/site_tools. This tool provides a gettextMoFile builder, which takes a gettext template file (.po) and compiles it using msgfmt to a .mo.
*NVDA root sconstruct: cause all of NVDA's po files to be compiled to mo files if source is being built.
*Removed locale compilation code from source/generate.py as its now redundant.
print "Unknown commandline variables: %s"%unknown\r
Exit(1)\r
\r
-env = Environment(variables=vars,tools=["textfile"])\r
+env = Environment(variables=vars,tools=["textfile","gettext"])\r
version = env["version"]\r
release = env["release"]\r
certFile = env["certFile"]\r
Export('sourceLibDir')\r
sourceLibDir64=sourceDir.Dir('lib64')\r
Export('sourceLibDir64')\r
-\r
buildDir = Dir("build")\r
outFilePrefix = "nvda{type}_{version}".format(type="" if release else "_snapshot", version=version)\r
\r
#Process nvdaHelper scons files\r
env.SConscript('nvdaHelper/sconscript',exports=['env'])\r
\r
+#Allow all NVDA's gettext po files to be compiled in source/locale\r
+print sourceDir.path\r
+for po in env.Glob(sourceDir.path+'/locale/*/lc_messages/*.po'):\r
+ m=env.gettextMoFile(po)\r
+\r
# A builder to generate an NVDA distribution.\r
def NVDADistGenerator(target, source, env, for_signature):\r
buildCmd = ["cd", source[0].path, "&&",\r
--- /dev/null
+###\r
+#This file is a part of the NVDA project.\r
+#URL: http://www.nvda-project.org/\r
+#Copyright 2010 James Teh <jamie@jantrid.net>.\r
+#This program is free software: you can redistribute it and/or modify\r
+#it under the terms of the GNU General Public License version 2.0, as published by\r
+#the Free Software Foundation.\r
+#This program is distributed in the hope that it will be useful,\r
+#but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
+#This license can be found at:\r
+#http://www.gnu.org/licenses/old-licenses/gpl-2.0.html\r
+###\r
+\r
+import os\r
+import sys\r
+import imp\r
+import glob\r
+\r
+_msgfmt=None\r
+def loadMsgfmt():\r
+ global _msgfmt\r
+ if not _msgfmt:\r
+ modInfo=imp.find_module('msgfmt',[os.path.join(sys.prefix,'tools/i18n')])\r
+ _msgfmt=imp.load_module('msgfmt',*modInfo)\r
+ else:\r
+ _msgfmt.MESSAGES={}\r
+ return _msgfmt\r
+\r
+def gettextMoFile_actionFunc(target,source,env):\r
+ msgfmt=loadMsgfmt()\r
+ msgfmt.make(source[0].abspath,target[0].abspath)\r
+ return 0\r
+\r
+def exists(env):\r
+ return bool(loadMsgfmt())\r
+\r
+def generate(env):\r
+ env['BUILDERS']['gettextMoFile']=env.Builder(\r
+ action=env.Action(gettextMoFile_actionFunc,lambda t,s,e: 'Compiling gettext template %s'%s[0].path),\r
+ suffix='.mo',\r
+ src_suffix='.po'\r
+ )\r
import os\r
from glob import glob\r
import txt2tags\r
-__path__ = [os.path.join(sys.exec_prefix, "Tools", "i18n")]\r
-import msgfmt\r
-del __path__\r
import keyCommandsDoc\r
\r
COM_INTERFACES = (\r
print "not found."\r
print\r
\r
- print "Language files:"\r
- poFiles=glob('locale/*/LC_MESSAGES/nvda.po')\r
- for f in poFiles:\r
- print f\r
- msgfmt.make(f, None)\r
- #Clear msgfmt.MESSAGES so that msgfmt.make can safely be called again in the next iteration\r
- msgfmt.MESSAGES.clear()\r
- print\r
-\r
print "HTML documentation (except Key Commands):"\r
files = glob(r"..\user_docs\*\*.t2t")\r
# Using txt2tags as a module to handle files is a bit weird.\r