[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Translating Manpages?



On Tue, Jan 27, 2004 at 01:48:32PM +0100, Robert Ribnitz wrote:
> Hello,
> 
> for my package (htdig), I am looking for the least painful way to have 
> localised (at the moment: french, but once the system is in place, 
> probably more)
> Manpages.
> 
> Any idea on what I could use? (the person translating needn't concern 
> themselves about groff/nroff)...

I'm the upstream author of po4a, and it was designed exactly to solve this
issue. Here is what I advice you:

  - run dos2unix on the manpages using dos encoding since po4a fails to fix
    this and since it drives gettext nuts.
  - mkdir debian/doc
  - put the attached makefile in this directory
  - make -C debian/doc

It will give you a htdig.doc.pot containing all the strings found in your
manpages. It will also try to generate the translations, but they will be
discarded since the po file does not contain any translations.

  - cp htdig.doc.pot fr.doc.po
  - edit fr.doc.po to translate it.
  - run the makefile again, and it will give you all the translated manpages
    you are dreaming about ;)

  - you can use the addendums with this makefile. Check the documentation
    (and the makefile itself to see the name they should have).

There is several issues:
  * since you already translated the manpage, you may want to use
    po4a-gettextize manually to retrieve the translations. 
    Send them to me so that I can try to automatize this as well if you want.
  * only man pages are handled by this makefile. I'd like to add pod
    support, for example. (but you don't care).
  * only french support.
    How can I generate targets, again? For now, I have to dupplicate the
    target that way:

%.fr.1: fr.doc.po
        $(PO4ATRANSLATE) -f man -m ../echo $@ | sed -e 's/\.fr\././' -p $< -a $@.addendum -l $@
                                                                       

%.fr.8: fr.doc.po
        $(PO4ATRANSLATE) -f man -m ../echo $@ | sed -e 's/\.fr\././' -p $< -a $@.addendum -l $@


Take care, Mt.

-- 
Dans la france profonde, il y a surtout des spéléologues.
   -- Le Chat
PROJECT=htdig


SECS=1 2 3 4 5 6 7 8

PO4ATRANSLATE  = po4a-translate
PO4AUPDATEPO   = po4a-updatepo
PO4AGETTEXTIZE = po4a-gettextize

MAN1 = $(notdir $(basename $(wildcard ../*.1)))
MAN2 = $(notdir $(basename $(wildcard ../*.2)))
MAN3 = $(notdir $(basename $(wildcard ../*.3)))
MAN4 = $(notdir $(basename $(wildcard ../*.4)))
MAN5 = $(notdir $(basename $(wildcard ../*.5)))
MAN6 = $(notdir $(basename $(wildcard ../*.6)))
MAN7 = $(notdir $(basename $(wildcard ../*.7)))
MAN8 = $(notdir $(basename $(wildcard ../*.8)))

LANGS = fr

TRANS=$(foreach lang,$(LANGS),\
                  $(foreach sec,$(SECS),\
		            $(foreach man,$(MAN$(sec)),$(man).$(lang).$(sec))))

PARTIALPOT=$(foreach sec,$(SECS), $(foreach man,$(MAN$(sec)),$(man).$(sec).partial.pot))

all: $(TRANS)

#### CREATION OF THE POT FILE ####

$(PROJECT).doc.pot: $(PARTIALPOT)
	msgcat --use-first $^ -o $@ 
	
%.partial.pot: ../%
	$(PO4AGETTEXTIZE) -f man -m $< -p $@

#### TAKE CARE OF THE PO FILES ####

%.doc.po: $(PROJECT).doc.pot
	@echo -n "Merging $(PROJECT).doc.pot and $@: "
	@msgmerge $@ $(PROJECT).doc.pot -o $@.new
# Typically all that changes was a date. I'd prefer not to cvs commit such
# changes, so detect and ignore them.
	@if diff -q -I'#:' -I'POT-Creation-Date:' -I'PO-Revision-Date:' $@ $@.new >/dev/null; then \
	  rm -f $@.new; \
	  touch $@; \
	else \
	  mv -f $@.new $@; \
	fi
	@msgfmt --statistics $@

#### MAKE THE TRANSLATIONS ####

%.fr.1: fr.doc.po
	$(PO4ATRANSLATE) -f man -m ../`echo $@ | sed -e 's/\.fr\././'` -p $< -a $@.addendum -l $@

%.fr.8: fr.doc.po
	$(PO4ATRANSLATE) -f man -m ../`echo $@ | sed -e 's/\.fr\././'` -p $< -a $@.addendum -l $@
	

#### MISC ####

clean:
	-rm -f $(foreach sec,$(SECS),*.$(sec)) *~ *.partial.pot


.PHONY: clean
.PRECIOUS: $(foreach lang,$(LANGS), $(lang).doc.po)

.INTERMEDIATE: $(PARTIALPOT)

Attachment: signature.asc
Description: Digital signature


Reply to: