Date: Tue, 28 Aug 2018 23:52:43 +0000 (UTC) From: "Danilo G. Baio" <dbaio@FreeBSD.org> To: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: svn commit: r52190 - head/share/mk Message-ID: <201808282352.w7SNqhjJ073012@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dbaio (ports committer) Date: Tue Aug 28 23:52:43 2018 New Revision: 52190 URL: https://svnweb.freebsd.org/changeset/doc/52190 Log: 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 Modified: head/share/mk/doc.translate.mk Modified: head/share/mk/doc.translate.mk ============================================================================== --- head/share/mk/doc.translate.mk Tue Aug 28 22:39:12 2018 (r52189) +++ head/share/mk/doc.translate.mk Tue Aug 28 23:52:43 2018 (r52190) @@ -42,9 +42,6 @@ POSET_CMD= ${SED} -i '' -e '1s,^,\#${IDSTR1}${IDSTR2}\ 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808282352.w7SNqhjJ073012>