share/mk/doc.translate.mk: Improve make po
- Create .pot (Portable Object Template) files for the en_US documents Do not ignore en_US language and generate a `.pot` file instead of a `.po`. These are used as template for tools like Zanata. - Execute `msgattrib` even on a new `[.po|.pot]` file This will be useful to wrap long message lines and avoid bigger diffs in the future. Approved by: wosch Differential Revision: https://reviews.freebsd.org/D16726
This commit is contained in:
parent
436ce4e504
commit
9c95515f3b
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=52190
1 changed files with 17 additions and 18 deletions
|
|
@ -42,9 +42,6 @@ POSET_CMD= ${SED} -i '' -e '1s,^,\#${IDSTR1}${IDSTR2}\${.newline},' \
|
|||
MASTER_SRCS!= ${MAKE} -C ${EN_DIR} -V SRCS
|
||||
|
||||
${DOC}.translate.xml:
|
||||
.if ${TRAN_DIR} == ${EN_DIR}
|
||||
@${ECHO} "Please build PO file only in a non-English directory, ignored"
|
||||
.else
|
||||
# some SRCS files might need to be generated, make sure they exist
|
||||
@${MAKE} -C ${EN_DIR} ${MASTER_SRCS} > /dev/null
|
||||
# normalize the English original into a single file
|
||||
|
|
@ -52,32 +49,34 @@ ${DOC}.translate.xml:
|
|||
# remove redundant namespace attributes
|
||||
@${PO_XMLLINT} --nsclean ${.TARGET}.tmp > ${.TARGET}
|
||||
@${RM} ${.TARGET}.tmp
|
||||
@${MAKE} -C ${EN_DIR} clean > /dev/null
|
||||
.endif
|
||||
|
||||
.if ${TRAN_DIR} == ${EN_DIR}
|
||||
po:
|
||||
PO_FILE=${PO_LANG}.pot
|
||||
.else
|
||||
po: ${PO_LANG}.po
|
||||
PO_FILE=${PO_LANG}.po
|
||||
.endif
|
||||
po: ${PO_FILE}
|
||||
|
||||
.PHONY: po
|
||||
|
||||
${PO_LANG}.po: ${DOC}.translate.xml
|
||||
@${ITSTOOL} -o ${PO_LANG}.po.tmp ${DOC}.translate.xml
|
||||
.if exists(${PO_LANG}.po)
|
||||
@${ECHO} "${PO_LANG}.po exists, merging"
|
||||
@${MSGMERGE} -o ${PO_LANG}.po.new ${PO_LANG}.po ${PO_LANG}.po.tmp
|
||||
@${MSGATTRIB} --no-obsolete -o ${PO_LANG}.po.tmp ${PO_LANG}.po.new
|
||||
@${RM} ${PO_LANG}.po.new
|
||||
@${MV} ${PO_LANG}.po.tmp ${PO_LANG}.po
|
||||
${PO_FILE}: ${DOC}.translate.xml
|
||||
@${ITSTOOL} -o ${PO_FILE}.tmp ${DOC}.translate.xml
|
||||
.if exists(${PO_FILE})
|
||||
@${ECHO} "${PO_FILE} exists, merging"
|
||||
@${MSGMERGE} -o ${PO_FILE}.new ${PO_FILE} ${PO_FILE}.tmp
|
||||
@${MSGATTRIB} --no-obsolete -o ${PO_FILE}.tmp ${PO_FILE}.new
|
||||
@${RM} ${PO_FILE}.new
|
||||
@${MV} ${PO_FILE}.tmp ${PO_FILE}
|
||||
.else
|
||||
@${ECHO} "${PO_LANG}.po created, please check and correct the settings in the header"
|
||||
@${MV} ${PO_LANG}.po.tmp ${PO_LANG}.po
|
||||
@${ECHO} "${PO_FILE} created, please check and correct the settings in the header"
|
||||
# Just to wrap long message lines
|
||||
@${MSGATTRIB} -o ${PO_FILE} ${PO_FILE}.tmp
|
||||
@${RM} ${PO_FILE}.tmp
|
||||
@${POSET_CMD} ${.TARGET}
|
||||
.endif
|
||||
@${MAKE} -C ${EN_DIR} clean > /dev/null
|
||||
|
||||
${PO_LANG}.mo: ${PO_LANG}.po
|
||||
${PO_LANG}.mo: ${PO_FILE}
|
||||
@${MSGFMT} -o ${.TARGET} ${.ALLSRC}
|
||||
|
||||
tran ${DOC}.xml: ${DOC}.translate.xml ${PO_LANG}.mo
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue