diff options
author | Danilo G. Baio <dbaio@FreeBSD.org> | 2018-08-28 23:52:43 +0000 |
---|---|---|
committer | Danilo G. Baio <dbaio@FreeBSD.org> | 2018-08-28 23:52:43 +0000 |
commit | 9c95515f3bf7140fdd62e98eb3d575658b18c20b (patch) | |
tree | ec9b9fbefa61d0b5753ae50ad54107b2eccf0c19 /share | |
parent | 436ce4e504e3f1f96236ee04489902c97b76b7bc (diff) | |
download | doc-9c95515f3bf7140fdd62e98eb3d575658b18c20b.tar.gz doc-9c95515f3bf7140fdd62e98eb3d575658b18c20b.zip |
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
Notes
Notes:
svn path=/head/; revision=52190
Diffstat (limited to 'share')
-rw-r--r-- | share/mk/doc.translate.mk | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/share/mk/doc.translate.mk b/share/mk/doc.translate.mk index dc63844414..2e07186ee8 100644 --- a/share/mk/doc.translate.mk +++ b/share/mk/doc.translate.mk @@ -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 |