# # $Id$ # # Part of Equinox Desktop Environment (EDE). # Copyright (c) 2000-2007 EDE Authors. # # This program is licensed under terms of the # GNU General Public License version 2 or newer. # See COPYING for details. DEFAULT_POT = "messages.pot" ; # TranslationStrings [dir-where] : [source] : [output-file] ; # Scans [source] file(s) for translatable strings (usually marked as _("foo")) # and store result in [output-file] in [dir-where] directory. If [dir-where] # does not exists, it will be created. # [output-file] can be omitted; in that case DEFAULT_POT will be used. rule TranslationStrings { local strfile ; if $(3) { strfile = $(3) ; } else { strfile = $(DEFAULT_POT) ; } if ! $(XGETTEXT) { Echo "XGETTEXT wasn't defined; $(strfile) will not be created !" ; return ; } local path locale_dir target source i ; path = $(SEARCH_SOURCE) ; # Assure path name does not match pseudo target name by setting # a specified grist. For example if grist wasn't set, and there is # directory 'foo' with executable 'foo' in it, $(path) will be 'foo' # which will confuse jam to see it as target too, (re)building it. path = $(path:G=strings) ; locale_dir = [ FDirName $(path) $(<) ] ; target = [ FFileName $(locale_dir) $(strfile) ] ; source = $(>:R=$(path)) ; MkDir $(locale_dir) ; for i in $(source) { LocalDepends $(target) : $(i) ; } LocalDepends $(target) : $(locale_dir) ; LocalDepends potfile : $(target) ; LocalDepends translation : $(target) ; LocalDepends all : $(target) ; XGettext $(target) : $(source) ; LocalClean clean : $(target) ; CleandirSafe distclean : $(locale_dir) ; } # Translation [po-dir] : [file1.po file2.po...] ; # Compile translated files into binary representation, so they # can be used by programs. [po-dir] is directory name where # to look for translated files (.po) and where will be placed # binary ones (.mo). Second parameter is list of .po files. rule Translation { local moext mofile pofile path i ; moext = ".mo" ; path = $(SEARCH_SOURCE) ; # Assure path name does not match pseudo target name by setting # a specified grist. For example if grist wasn't set, and there is # directory 'foo' with executable 'foo' in it, $(path) will be 'foo' # which will confuse jam to see it as target too, (re)building it. path = $(path:G=translation) ; if ! $(MSGFMT) { Echo "MSGFMT wasn't defined; $(moext) files will not be created !" ; return ; } for i in $(>) { pofile = [ FFileName $(path) $(<) $(i) ] ; mofile = [ FFileName $(path) $(<) $(i:S=$(moext)) ] ; LocalDepends $(mofile) : $(pofile) ; LocalDepends all : $(mofile) ; LocalDepends translation : $(mofile) ; MakeTranslation1 $(mofile) : $(pofile) ; LocalClean clean : $(mofile) ; } } actions XGettext { $(XGETTEXT) -k'_' $(2) -o $(1) ; } actions MakeTranslation1 { $(MSGFMT) $(>) -o $(<) ; } NotFile translation potfile ; Always translation potfile ;