# Usually the message domain is the same as the package name.
 DOMAIN = $(PACKAGE)
 
-# These options get passed to xgettext.
-XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ 
-
 # This is the copyright holder that gets inserted into the header of the
 # $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
 # package.  (Note that the msgstr strings, extracted from the package's
 
 
 TRANSLATABLE_FILES = $(DIST_SOURCES) $(all_q_sources)
 
-$(POTFILE): $(TRANSLATABLE_FILES)
-       @$(MKDIR_P) po
-       $(XGETTEXT) --directory=$(top_srcdir) $(TRANSLATABLE_FILES) \
-       $(XGETTEXT_OPTIONS) \
+XGETTEXT_OPTIONS = \
        --copyright-holder="$(COPYRIGHT_HOLDER)" \
        --package-name=$(PACKAGE) \
        --package-version=$(VERSION) \
        --msgid-bugs-address=$(MSGID_BUGS_ADDRESS) \
-       --add-comments='TRANSLATORS:' \
-       -o $(POTFILE)
+       --add-comments='TRANSLATORS:'
+
+$(POTFILE): $(TRANSLATABLE_FILES) $(UI_FILES)
+       @$(MKDIR_P) po
+       $(XGETTEXT) --directory=$(top_srcdir) $(XGETTEXT_OPTIONS)    $(TRANSLATABLE_FILES) --language=C --keyword=_ --keyword=N_ -o $@
+       $(XGETTEXT) --directory=$(top_srcdir) $(XGETTEXT_OPTIONS) -j $(UI_FILES) --language=glade -o $@
 
 
 $(POFILES): $(POTFILE)
          lang=`echo $$f | sed -e 's%po/\(.*\)\.gmo%\1%' ` ; \
          $(INSTALL) -D $$f $(DESTDIR)$(prefix)/share/locale/$$lang/LC_MESSAGES/$(DOMAIN).mo ; \
        done
-       
 
 uninstall-hook:
        for f in $(GMOFILES); do \
 
 UNINSTALL_DATA_HOOKS += uninstall-icons
 
 
+UI_FILES = \
+       src/ui/gui/crosstabs.ui \
+       src/ui/gui/descriptives.ui \
+       src/ui/gui/examine.ui \
+       src/ui/gui/find.ui \
+       src/ui/gui/frequencies.ui \
+       src/ui/gui/rank.ui \
+       src/ui/gui/recode.ui \
+       src/ui/gui/variable-info.ui 
+
 nodist_src_ui_gui_psppire_DATA = \
        $(top_builddir)/src/ui/gui/data-editor.ui \
        $(top_builddir)/src/ui/gui/message-dialog.ui \
 
 
 dist_src_ui_gui_psppire_DATA = \
-       $(top_srcdir)/src/ui/gui/crosstabs.ui \
-       $(top_srcdir)/src/ui/gui/descriptives.ui \
-       $(top_srcdir)/src/ui/gui/examine.ui \
-       $(top_srcdir)/src/ui/gui/find.ui \
-       $(top_srcdir)/src/ui/gui/frequencies.ui \
-       $(top_srcdir)/src/ui/gui/rank.ui \
-       $(top_srcdir)/src/ui/gui/recode.ui \
-       $(top_srcdir)/src/ui/gui/variable-info.ui \
+       $(UI_FILES) \
        $(top_srcdir)/src/ui/gui/pspplogo.png \
        $(top_srcdir)/src/ui/gui/icons/value-labels.png \
        $(top_srcdir)/src/ui/gui/icons/goto-variable.png\