forked from ansible/workshops
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
80 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
TRANSLATED_FOLDERS := $(shell find . -name 'po4a.cfg' -exec dirname {} \;) | ||
EXISTING_PO_FILES := $(shell find . -name '*.po') | ||
|
||
show-translated-folders: | ||
@echo $(TRANSLATED_FOLDERS) | ||
|
||
.SILENT: | ||
generate-po: | ||
for translated_folder in $(TRANSLATED_FOLDERS); do \ | ||
pushd 2>&1>/dev/null $$translated_folder && \ | ||
po4a po4a.cfg --no-translations 2>&1>/dev/null && \ | ||
popd 2>&1>/dev/null ; \ | ||
done | ||
|
||
.SILENT: | ||
list-po-needs-translation: | ||
for file in $(EXISTING_PO_FILES); do \ | ||
python pooneliner.py $$file ; \ | ||
done | ||
|
||
.SILENT: | ||
translation: | ||
for translated_folder in $(TRANSLATED_FOLDERS); do \ | ||
pushd 2>&1>/dev/null $$translated_folder && \ | ||
po4a po4a.cfg --no-update 2>&1>/dev/null && \ | ||
popd 2>&1>/dev/null ; \ | ||
done | ||
|
||
.SILENT: | ||
translation-clean: | ||
for translated_folder in $(TRANSLATED_FOLDERS); do \ | ||
pushd 2>&1>/dev/null $$translated_folder && \ | ||
rm -rf locales && \ | ||
popd 2>&1>/dev/null ; \ | ||
done | ||
|
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../po4a.cfg |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../po4a.cfg |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../po4a.cfg |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../po4a.cfg |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../po4a.cfg |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../po4a.cfg |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../po4a.cfg |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../po4a.cfg |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../po4a.cfg |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../po4a.cfg |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../po4a.cfg |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../po4a.cfg |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../po4a.cfg |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../po4a.cfg |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[options] --keep 0 --wrap-po no --master-charset UTF-8 --localized-charset UTF-8 --master-language en | ||
[po4a_langs] ja zh | ||
[po4a_paths] locales/README.pot $lang:locales/README.$lang.po | ||
[type: text] README.md $lang:README.$lang.md opt:"-o markdown" |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python | ||
|
||
import io | ||
import sys | ||
from babel.messages import pofile | ||
|
||
|
||
def main(): | ||
|
||
filename = sys.argv[1] | ||
|
||
with io.open(filename, 'rb') as f: | ||
cat = pofile.read_po(f) | ||
charset = cat.charset or 'utf-8' | ||
|
||
with io.open(filename, 'rb') as f: | ||
my_catalog = pofile.read_po(f, charset=charset) | ||
fuzzy_entries = len([m for m in my_catalog if m.id and m.fuzzy]) | ||
untranslated_entries = len([m for m in my_catalog if m.id and not m.string]) | ||
|
||
if fuzzy_entries or untranslated_entries: | ||
print(filename) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |