Commit e00e0359 authored by Franco Fichtner's avatar Franco Fichtner

template: collect all strings from all know directories

xgettext currently destroys part of the template (especially the header)
while generating and appending multiple times.  Need to investigate further.
parent 5936f3c7
......@@ -36,6 +36,10 @@ LOCALEDIR= /usr/local/share/locale/%%LANG%%/LC_MESSAGES
LANGUAGES= de_DE es_CO fr_FR nl_NL ja_JP mn_MN ru_RU zh_CN
PLUGINSDIR?= /usr/plugins
COREDIR?= /usr/core
LANGDIR?= /usr/lang
TEMPLATE= en_US
INSTALL=
MERGE=
......@@ -64,13 +68,19 @@ CLEAN+= clean-${LANG}
MERGE+= merge-${LANG}
.endfor
_PLUGINSDIRS!= ${MAKE} -C ${PLUGINSDIR} list
PLUGINSDIRS= ${_PLUGINSDIRS:S/^/${PLUGINSDIR}\//g}
${TEMPLATE}:
@cp ${.CURDIR}/Volt.pm ${PERL_DIR}/${PERL_NAME}/
@: > ${TEMPLATE}.pot
cd ${.CURDIR}/.. && \
${XGETTEXT_PL} -D src -p ${.CURDIR} -o ${TEMPLATE}.pot
cd ${.CURDIR}/.. && find src lang/dynamic/helpers | \
xargs ${XGETTEXT} -j -o ${.CURDIR}/${TEMPLATE}.pot
.for ROOTDIR in ${PLUGINSDIRS} ${COREDIR}
${XGETTEXT_PL} -D ${ROOTDIR}/src -p ${.CURDIR} -o ${TEMPLATE}.pot
find ${ROOTDIR}/src -print0 | \
xargs -0 ${XGETTEXT} -j -o ${.CURDIR}/${TEMPLATE}.pot
.endfor
find ${LANGDIR}/dynamic/helpers -print0 | \
xargs -0 ${XGETTEXT} -j -o ${.CURDIR}/${TEMPLATE}.pot
template: ${TEMPLATE}
install: ${INSTALL}
......@@ -78,6 +88,6 @@ clean: ${CLEAN}
merge: ${MERGE}
dynamic:
@${.CURDIR}/dynamic/collect.py ${.CURDIR}/..
@${.CURDIR}/dynamic/collect.py ${PLUGINSDIRS} ${COREDIR}
.PHONY: ${INSTALL} ${MERGE} ${TEMPLATE} dynamic
......@@ -36,11 +36,11 @@ if len(sys.argv) < 2:
print 'Usage: collect.py rootdir'
sys.exit(1)
# get source location (root of core package)
OPNsenseRoot=sys.argv[1] + '/src'
# get source locations
RootPaths = sys.argv[1:]
# create target location
targetPath=sys.argv[1] + '/lang/dynamic/helpers'
targetPath = 'dynamic/helpers'
if len(glob.glob(targetPath)) == 0:
os.mkdir(targetPath)
......@@ -58,8 +58,9 @@ for filename in glob.glob('%s/plugins/*.py'%'/'.join(os.path.realpath(__file__).
# collect and sort tags
translations = list()
for textValue in lang.getTranslations(OPNsenseRoot):
translations.append(textValue)
for RootPath in RootPaths:
for textValue in lang.getTranslations(RootPath + '/src'):
translations.append(textValue)
translations.sort()
# fill with gettext tags
......
......@@ -32,8 +32,13 @@ __author__ = 'Ad Schellevis'
def getTranslations(root):
import json
filename='%s/opnsense/mvc/app/models/OPNsense/Core/ACL_Legacy_Page_Map.json'%root
aclMap = json.loads(open(filename).read())
try:
aclMap = json.loads(open(filename).read())
except IOError:
aclMap = dict()
for aclKey in aclMap.keys():
if aclMap[aclKey].has_key('descr'):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment