Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148470182
D2947.id6586.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D2947.id6586.diff
View Options
Index: share/mk/doc.commands.mk
===================================================================
--- share/mk/doc.commands.mk
+++ share/mk/doc.commands.mk
@@ -70,8 +70,13 @@
HTML2TXT?= ${PREFIX}/bin/links
HTML2TXTOPTS?= -dump ${HTML2TXTFLAGS}
+ITSTOOL?= ${PREFIX}/bin/itstool
+
JING?= ${PREFIX}/bin/jing
+MSGFMT?= ${PREFIX}/bin/msgfmt
+MSGMERGE?= ${PREFIX}/bin/msgmerge
+
XMLLINT?= ${PREFIX}/bin/xmllint
XSLTPROC?= ${PREFIX}/bin/xsltproc
Index: share/mk/doc.docbook.mk
===================================================================
--- share/mk/doc.docbook.mk
+++ share/mk/doc.docbook.mk
@@ -269,6 +269,37 @@
${SED} 's|@@URL_RELPREFIX@@|http://www.FreeBSD.org|g' < ${.TARGET} > ${DOC}.parsed.print.xml
${SED} -i '' -e 's|@@URL_RELPREFIX@@|../../../..|g' ${.TARGET}
+# translation -------------------------------------------------------
+
+# path to the English version to be translated
+ENGDOCDIR= ${PWD:S/${LANGCODE}/en_US.ISO8859-1/}
+# detect the document type from the path, and make it singular for use in the DTD
+# just removing the trailing "s" is less safe than distinct replacements
+SRCDOCTYPE= ${PWD:H:T:S/articles/article/:S/books/book/}
+# DTD for inclusion in translated documents
+FREEBSDDTD= <!DOCTYPE ${SRCDOCTYPE} PUBLIC \"-//FreeBSD//DTD DocBook XML V5.0-Based Extension//EN\" \"http://www.FreeBSD.org/XML/share/xml/freebsd50.dtd\">
+
+# create a po file for translations
+po ${DOC}.po: ${XML_INCLUDES}
+ ${MAKE} -C ${ENGDOCDIR} ${DOC}.parsed.xml
+ ${ITSTOOL} -k -o ${DOC}.po.tmp ${ENGDOCDIR}/${DOC}.parsed.xml
+ ( if [ -f "${DOC}.po" ]; then \
+ echo "${DOC}.po exists, merging" ; \
+ ${MSGMERGE} -o ${DOC}.po.new ${DOC}.po ${DOC}.po.tmp ; \
+ ${MV} ${DOC}.po.new ${DOC}.po ; \
+ ${RM} ${DOC}.po.tmp ; \
+ else \
+ ${MV} ${DOC}.po.tmp ${DOC}.po ; \
+ fi )
+
+# create the translated ${DOC}.xml from the .po file.
+tran: ${DOC}.po
+ # abort if there is an existing ${DOC}.xml?
+ ${MSGFMT} -o ${DOC}.mo ${DOC}.po
+ ${ITSTOOL} -l ${LANGCODE:S/_.*//} -k -m ${DOC}.mo -o ${DOC}.xml ${ENGDOCDIR}/${DOC}.parsed.xml
+ # put the FreeBSD DTD back in after line 1
+ ${SED} -i'' -e "1a \\${.newline}${FREEBSDDTD}${.newline}" ${DOC}.xml
+
# XHTML -------------------------------------------------------------
index.html: ${DOC}.parsed.xml ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 19, 2:52 AM (1 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29940753
Default Alt Text
D2947.id6586.diff (2 KB)
Attached To
Mode
D2947: Doc toolchain PO translation support
Attached
Detach File
Event Timeline
Log In to Comment