#-*- Makefile -*-

Rsharedir = ../share
Rlocaledir = $(Rsharedir)/locale

RGUI-CATALOGS = $(wildcard RGui-*.gmo)
# no use on Windows en@quot.gmo
CATALOGS = $(filter-out en@quot.gmo $(RGUI-CATALOGS), $(wildcard *.gmo))

all:
	@echo
	@echo "---------- Installing translations ------------"
	@mkdir -p $(Rsharedir)
	@catalogs='$(CATALOGS)'; \
	echo -n "msgs: "; \
	for cat in $$catalogs; do \
	  lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
	  echo -n "$$lang "; \
	  dir=$(Rlocaledir)/$$lang/LC_MESSAGES; \
	  mkdir -p $$dir; \
	  cp -p $$cat $$dir/R.mo; \
	done
	@echo
	@catalogs='$(RGUI-CATALOGS)'; \
	echo -n "RGui: "; \
	for cat in $$catalogs; do \
	  lang=`echo $$cat | sed -e 's/\.gmo$$//' -e 's/^RGui-//'`; \
	  echo -n "$$lang "; \
	  dir=$(Rlocaledir)/$$lang/LC_MESSAGES; \
	  mkdir -p $$dir; \
	  cp -p $$cat $$dir/RGui.mo; \
	done
	@echo
	@echo

clean:
	rm -rf $(Rlocaledir)
