docs-common/common/entities Makefile, 1.3, 1.4 entities-it.ent, 1.4, 1.5 entities-it.xml, 1.4, 1.5 it.po, 1.4, 1.5

Tommy Reynolds (jtr) fedora-docs-commits at redhat.com
Sun Feb 26 21:07:43 UTC 2006


Author: jtr

Update of /cvs/docs/docs-common/common/entities
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv7816

Modified Files:
	Makefile entities-it.ent entities-it.xml it.po 
Log Message:
Add all the magical make-fu to all new translations to be added by
just updating the ${OTHERS} macro and editing the locale-specific
"${LANG}.po" file that gets generated.

The final product is the file "entities-${LANG}.ent", suitable for
reference in the <DOCTYPE> declaration of an FDP documnent file via a
locale-neutral wrapper filename.



Index: Makefile
===================================================================
RCS file: /cvs/docs/docs-common/common/entities/Makefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Makefile	25 Feb 2006 03:45:34 -0000	1.3
+++ Makefile	26 Feb 2006 21:07:34 -0000	1.4
@@ -1,24 +1,179 @@
 PRI_LANG=en
+OTHERS	=it
 
-all:	entities-it.ent
-
-clean:
-
-distclean clobber: clean
-	${RM} *.ent
-
-entities-it.ent: entities-it.xml entities.xsl
-	xsltproc -o $@ entities.xsl entities-it.xml
-
-entities-it.xml: entities-${PRI_LANG}.xml it.po
-	xml2po -p it.po entities-${PRI_LANG}.xml >$@
-
-it.po:	it.pot
-	if [ ! -f $@ ]; then						\
-		cp $< $@;						\
+#######################################################################
+# Populate make(1) with only those suffixes of interest to us
+#
+.SUFFIXES:
+.SUFFIXES:	.ent	.po	.pot	.xml	.xsl
+#
+#######################################################################
+
+#######################################################################
+# Define macros to explicitly instantiate the files to work with
+#
+OTHERXMLFILES=$(foreach L,${OTHERS},entities-${L}.xml)
+POFILES=$(foreach L,${OTHERS},${L}.po)
+ENTFILES=$(foreach L,${PRI_LANG} ${OTHERS},entities-${L}.ent)
+#
+#######################################################################
+
+#######################################################################
+# Rule: Apply stylesheet to transform XML into locale-specific ".ent" 
+# entities file
+#
+%.ent:	%.xml
+	xsltproc -o $@ entities.xsl $<
+#
+#######################################################################
+
+#######################################################################
+# Printf(1) format string for describing targets by "make help".
+HELPFMT	="%-23s\t| %s.\n"
+#
+#######################################################################
+
+#######################################################################
+# WARNING: put no targets before this one!
+#
+.PHONY:	all
+all::	${ENTFILES}
+#######################################################################
+
+#######################################################################
+# Target 'help' displays the available targets
+#
+.PHONY:	help
+help::
+	@printf ${HELPFMT} "make all" 	"Generate .ENT files"
+	@printf ${HELPFMT} "make help" 	"Display this list"
+#
+#######################################################################
+
+#######################################################################
+# Target 'entities.pot' makes a TEMPORARY seed translation file.  We
+# use the original-language entities XML file as the source.
+#
+.PHONY:	pot
+
+pot entities.pot:: entities-${PRI_LANG}.xml
+	xml2po -o entities.pot $<
+
+help::
+	@printf ${HELPFMT} "make pot" 		"Create template PO file"
+	@printf ${HELPFMT} "make entities.pot" 	"Create template PO file"
+#
+#######################################################################
+
+#######################################################################
+# 'PO_template' emits rules to update the locale-specific .PO file
+# whenever the "entities-${PRI_LANG}.xml", and therefore the 
+# "entities.pot" file, is changed.
+#
+define	PO_template
+.PHONY:	po-${1}
+po-${1} ${1}.po:: entities.pot
+	if [ ! -f ${1}.po ]; then					\
+		cp $$< ${1}.po;						\
 	else								\
-		msgmerge --update --backup=simple $@ $<;		\
+		msgmerge --update --backup=simple ${1}.po $$<;		\
 	fi
 
-it.pot:	entities-${PRI_LANG}.xml
+help::
+	@printf ${HELPFMT} "make po-${1}"	"Generate .PO file for locale '${1}'"
+	@printf ${HELPFMT} "make ${1}.po"	"Generate '${1}.po' file"
+endef
+
+$(foreach L,${OTHERS},$(eval $(call PO_template,${L})))
+
+.PHONY:	po-all
+po-all:	${foreach L,${OTHERS},${L}.po}
+
+help::
+	@printf ${HELPFMT} "make po-all"	"Generate all .PO files"
+#
+#######################################################################
+
+#######################################################################
+# 'UPDATE_template' generates the rules to derive the translated XML
+# files based on the "entities-${PRI_LANG}.xml" file and the selected
+# "${LANG}.po" file.
+#
+define UPDATE_template
+.PHONY:	xml-${1}
+xml-${1} entities-${1}.xml: entities-${PRI_LANG}.xml ${1}.po
+	xml2po -p ${1}.po entities-${PRI_LANG}.xml >entities-${1}.xml
+
+help::
+	@printf ${HELPFMT} "make xml-${1}"	"Translate XML for locale '${1}'"
+	@printf ${HELPFMT} "make entities-${1}.xml" "Build 'entities-${1}.xml' file"
+endef
+
+.PHONY:	xml-${PRI_LANG}
+xml-${PRI_LANG}:: entities-${PRI_LANG}.xml
+
+$(foreach L,${OTHERS},$(eval $(call UPDATE_template,${L})))
+
+.PHONY:	xml-all
+xml-all: $(foreach L,${OTHERS},entities-${L}.xml)
+
+help::
+	@printf ${HELPFMT} "make xml-all"	"Translate XML for all locales"
+#
+#######################################################################
+
+
+#######################################################################
+# Target 'showvars' displays both provided and computed macro values
+#
+.PHONY:	showvars
+showvars::
+	@echo "PRI_LANG=${PRI_LANG}"
+	@echo "OTHERS=${OTHERS}"
+	@echo "OTHERXMLFILES=${OTHERXMLFILES}"
+	@echo "ENTFILES=${ENTFILES}"
+	@echo "POFILES=${POFILES}"
+help::
+	@printf ${HELPFMT} "make showvars"	"Show certain macro values"
+#
+#######################################################################
+
+#######################################################################
+# Target 'clean' deletes all temporary files.
+#
+.PHONY:	clean
+clean::
+	${RM} *~
+	${RM} entities.pot
+	${RM} ${OTHERXMLFILES}
+
+help::
+	@printf ${HELPFMT} "make clean"	"Delete all temporary files"
+#
+#######################################################################
+
+#######################################################################
+# Target 'distclean' or 'clobber' deletes all generated product files
+# in addition to all temporary files.
+#
+.PHONY:	distclean clobber
+distclean clobber:: clean
+	${RM} ${ENTFILES}
+
+help::
+	@printf ${HELPFMT} "make distclean"	"Delete all generated files"
+	@printf ${HELPFMT} "make clobber"	"Delete all generated files"
+#
+#######################################################################
+
+#######################################################################
+# We create EXACTLY one .POT file, and treat is as a temporary file.
+# Do NOT EDIT the .POT file if you are sharing this directory!
+#
+entities.pot:: entities-${PRI_LANG}.xml
 	xml2po -o $@ $<
+
+help::
+	@printf ${HELPFMT} "make entities.pot"	"Create template .PO file"
+#
+#######################################################################


Index: entities-it.ent
===================================================================
RCS file: /cvs/docs/docs-common/common/entities/entities-it.ent,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- entities-it.ent	25 Feb 2006 20:29:12 -0000	1.4
+++ entities-it.ent	26 Feb 2006 21:07:34 -0000	1.5
@@ -1,5 +1,5 @@
 
-  <!-- These common entities are useful shorthand terms and names, which may be subject to change at anytime. This is an important value the the entity provides: a single location to update terms and common names. -->
+  <!-- These are the Italian (it) common entities. -->
 
   <!-- Group: Fedora common entries -->
 


Index: entities-it.xml
===================================================================
RCS file: /cvs/docs/docs-common/common/entities/entities-it.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- entities-it.xml	25 Feb 2006 20:29:12 -0000	1.4
+++ entities-it.xml	26 Feb 2006 21:07:34 -0000	1.5
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="no"?>
 <!DOCTYPE entities SYSTEM "entities.dtd">
 <entities>
-  <title>These common entities are useful shorthand terms and names, which may be subject to change at anytime. This is an important value the the entity provides: a single location to update terms and common names.</title>
+  <title>These are the Italian (it) common entities.</title>
   <group name="Fedora common entries">
     <entity name="FED">
       <comment>Generic root term</comment>


Index: it.po
===================================================================
RCS file: /cvs/docs/docs-common/common/entities/it.po,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- it.po	25 Feb 2006 20:29:12 -0000	1.4
+++ it.po	26 Feb 2006 21:07:34 -0000	1.5
@@ -4,7 +4,7 @@
 msgstr ""
 "Project-Id-Version: it\n"
 "POT-Creation-Date: 2006-02-25 13:56-0600\n"
-"PO-Revision-Date: 2006-02-23 03:14-0600\n"
+"PO-Revision-Date: 2006-02-26 15:05-0600\n"
 "Last-Translator: Tommy Reynolds <Tommy.Reynolds at MegaCoder.com>\n"
 "Language-Team: US English <en at li.org>\n"
 "MIME-Version: 1.0\n"
@@ -17,7 +17,7 @@
 "These common entities are useful shorthand terms and names, which may be "
 "subject to change at anytime. This is an important value the the entity "
 "provides: a single location to update terms and common names."
-msgstr ""
+msgstr "These are the Italian (it) common entities."
 
 #: entities-en.xml:14(comment) entities-en.xml:18(comment)
 msgid "Generic root term"
@@ -237,3 +237,4 @@
 #: entities-en.xml:0(None)
 msgid "translator-credits"
 msgstr "Tommy Reynolds <Tommy.Reynolds at MegaCoder.com> 2006"
+




More information about the Fedora-docs-commits mailing list