Skip to content

Commit

Permalink
Sync locale Makefile from plugin template
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl committed Dec 18, 2023
1 parent 0cf5192 commit 5b7dce2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions locale/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
# make tx-update - download and merge translations from Transifex
# make clean - clean everything
#
DOMAIN = foreman_rh_cloud
VERSION = $(shell ruby -e 'require "rubygems";spec = Gem::Specification::load(Dir.glob("../*.gemspec")[0]);puts spec.version')
DOMAIN = $(shell ruby -rrubygems -e 'puts Gem::Specification::load(Dir.glob("../*.gemspec")[0]).name')
VERSION = $(shell ruby -rrubygems -e 'puts Gem::Specification::load(Dir.glob("../*.gemspec")[0]).version')
POTFILE = $(DOMAIN).pot
MOFILE = $(DOMAIN).mo
POFILES = $(shell find . -name '$(DOMAIN).po')
MOFILES = $(patsubst %.po,%.mo,$(POFILES))
POXFILES = $(patsubst %.po,%.pox,$(POFILES))
EDITFILES = $(patsubst %.po,%.edit.po,$(POFILES))
JSFILES = $(shell find ../app/assets/javascripts/*/locale -name '$(DOMAIN).js')

%.mo: %.po
mkdir -p $(shell dirname $@)/LC_MESSAGES
Expand Down Expand Up @@ -42,18 +43,20 @@ uniq-po:
done

tx-pull: $(EDITFILES)
tx pull -f
cd .. && tx pull -f --all
for f in $(EDITFILES) ; do \
sed -i 's/^\("Project-Id-Version: \).*$$/\1$(DOMAIN) $(VERSION)\\n"/' $$f; \
done

tx-update: tx-pull
@echo
@echo Run rake plugin:gettext[$(DOMAIN)] from the Foreman installation, then make -C locale mo-files to finish
@echo Run rake plugin:gettext[$(DOMAIN)] from the Foreman installation
@echo then run rake plugin:po_to_json[$(DOMAIN)] from the Foreman installation
@echo then run make -C locale mo-files to finish
@echo

mo-files: $(MOFILES)
git add $(POFILES) $(POTFILE) ../locale/*/LC_MESSAGES
git add $(POFILES) $(POTFILE) $(JSFILES) ../locale/*/LC_MESSAGES
git commit -m "i18n - pulling from tx"
@echo
@echo Changes commited!
Expand Down

0 comments on commit 5b7dce2

Please sign in to comment.