-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync translation infrastructure from foreman_plugin_template #11193
Draft
ekohl
wants to merge
1
commit into
Katello:master
Choose a base branch
from
ekohl:sync-translation-infra
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,20 +6,19 @@ | |
# make tx-update - download and merge translations from Transifex | ||
# make clean - clean everything | ||
# | ||
DOMAIN = katello | ||
VERSION = $(shell git describe --abbrev=0 --tags) | ||
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 | ||
ACTIONFILE = action_names.rb | ||
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 | ||
msgfmt -o $(shell dirname $@)/LC_MESSAGES/$(MOFILE) $< | ||
touch $(shell dirname $@)/LC_MESSAGES/$(MOFILE) | ||
|
||
# Generate MO files from PO files | ||
all-mo: $(MOFILES) | ||
|
@@ -32,9 +31,16 @@ all-mo: $(MOFILES) | |
cat $@ | ||
! grep -q msgid $@ | ||
|
||
%.edit.po: | ||
%.edit.po: %.po.time_stamp | ||
touch $@ | ||
|
||
# gettext will trash the .edit.po file if the time stamp doesn't exist or is older than the po file | ||
%.po.time_stamp: %.po | ||
touch --reference $< $@ | ||
|
||
# Prevent make from treating this as an intermediate file to be cleaned up | ||
.PRECIOUS: %.po.time_stamp | ||
|
||
check: $(POXFILES) | ||
|
||
# Unify duplicate translations | ||
|
@@ -44,34 +50,24 @@ uniq-po: | |
done | ||
|
||
tx-pull: $(EDITFILES) | ||
tx pull -f | ||
# Initialize new languages | ||
cd .. && tx pull -f --all --minimum-perc 50 | ||
# Force update all existing languages | ||
cd .. && tx pull -f --minimum-perc 0 | ||
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)] and rake plugin:po_to_json[$(DOMAIN)] from the Foreman installation, then make -C locale po-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 | ||
|
||
commit-translation-files: $(POFILES) | ||
git add $(POFILES) $(POTFILE) $(ACTIONFILE) ../app/assets/javascripts/katello/locale | ||
mo-files: $(MOFILES) | ||
git add $(POFILES) $(POTFILE) $(JSFILES) ../locale/*/LC_MESSAGES | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
git commit -m "i18n - pulling from tx" | ||
@echo | ||
@echo Changes commited! | ||
@echo | ||
|
||
# Workaround when rake task fails (https://github.com/ruby/rake/pull/182) | ||
extract: | ||
rxgettext \ | ||
--sort-output \ | ||
--sort-by-msgid \ | ||
--no-wrap \ | ||
--no-location \ | ||
-o ${DOMAIN}.pot \ | ||
--package-name=${DOMAIN} \ | ||
--package-version="${VERSION}" \ | ||
[email protected] \ | ||
--copyright-holder="Foreman developers" \ | ||
--copyright-year=$(shell date +%Y) \ | ||
$(shell find ../app -type f -name \*.rb -o -name \*.erb) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have noticed that
msgfmt
doesn't always update the timestamp, if there are no changes. Now I'm unsure if this is still an issue after the time_stamp handling is fixed.