Skip to content

Commit

Permalink
Removed translation belonging to other plugins ckan#17
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofMadejski committed Mar 21, 2017
1 parent e6b444b commit bcb285f
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 42 deletions.
21 changes: 0 additions & 21 deletions ckanext/qa/i18n/ckanext-qa.pot
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ msgstr ""
msgid "File could not be downloaded."
msgstr ""

#: ckanext/qa/tasks.py:268 ckanext/qa/tasks.py:341 ckanext/qa/tasks.py:346
#: ckanext/qa/templates/qa/openness_stars.html:24
#: ckanext/qa/templates/qa/openness_stars_brief.html:23
#: ckanext/qa/templates/report/openness.html:88
msgid "Reason"
msgstr ""

#: ckanext/qa/tasks.py:269
#, python-format
msgid "Error details: %s."
Expand Down Expand Up @@ -209,11 +202,6 @@ msgstr ""
msgid "Score"
msgstr ""

#: ckanext/qa/templates/report/openness.html:28
#: ckanext/qa/templates/report/openness.html:85
msgid "Organization"
msgstr ""

#: ckanext/qa/templates/report/openness.html:33
#: ckanext/qa/templates/report/openness.html:56
msgid "Total stars"
Expand All @@ -223,12 +211,3 @@ msgstr ""
#: ckanext/qa/templates/report/openness.html:55
msgid "Average score"
msgstr ""

#: ckanext/qa/templates/report/openness.html:82
msgid "Dataset"
msgstr ""

#: ckanext/qa/templates/report/openness.html:83
msgid "Notes"
msgstr ""

22 changes: 1 addition & 21 deletions ckanext/qa/i18n/pl/LC_MESSAGES/ckanext-qa.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: ckanext-qa 0.3\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRES\n"
"POT-Creation-Date: 2017-03-17 13:32+0100\n"
"PO-Revision-Date: 2015-03-28 18:07+0100\n"
"Last-Translator: Krzysztof Madejski <[email protected]>\n"
Expand Down Expand Up @@ -49,13 +49,6 @@ msgstr "Brak otwartej licencji"
msgid "File could not be downloaded."
msgstr "Nie udało się pobrać pliku."

#: ckanext/qa/tasks.py:268 ckanext/qa/tasks.py:341 ckanext/qa/tasks.py:346
#: ckanext/qa/templates/qa/openness_stars.html:24
#: ckanext/qa/templates/qa/openness_stars_brief.html:23
#: ckanext/qa/templates/report/openness.html:88
msgid "Reason"
msgstr "Wytłumaczenie"

#: ckanext/qa/tasks.py:269
#, python-format
msgid "Error details: %s."
Expand Down Expand Up @@ -218,11 +211,6 @@ msgstr "Do oceny"
msgid "Score"
msgstr "Ocena"

#: ckanext/qa/templates/report/openness.html:28
#: ckanext/qa/templates/report/openness.html:85
msgid "Organization"
msgstr ""

#: ckanext/qa/templates/report/openness.html:33
#: ckanext/qa/templates/report/openness.html:56
msgid "Total stars"
Expand All @@ -232,11 +220,3 @@ msgstr "W sumie gwiazdek"
#: ckanext/qa/templates/report/openness.html:55
msgid "Average score"
msgstr "Średnia ocena"

#: ckanext/qa/templates/report/openness.html:82
msgid "Dataset"
msgstr ""

#: ckanext/qa/templates/report/openness.html:83
msgid "Notes"
msgstr "Notatki"
66 changes: 66 additions & 0 deletions ckanext/qa/i18n/unique_pot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

# When you copy templates from CKAN (or other plugins) you end up with already translated translations in your pot file.
# This script filters them out from your .pot file. Run it right after `python setup.py extract_messages`

PLUGIN_NAME=qa
PLUGIN_DEPENDENCIES="report archiver"

SAVE_REUSED=0
VERBOSE=0
CURR_DIR=$(readlink -m $0/..)
SRC_DIR=$(readlink -m $0/../../../../..)

while getopts ":p:r:" opt; do
case $opt in
l) LANGUAGES="$OPTARG"
;;
p) PLUGIN_DEPENDENCIES="$OPTARG"
;;
r) SAVE_REUSED=1
;;
v) VERBOSE=1
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
done

function run_verbose {
if [ $VERBOSE ]; then
echo "# Running: $1"
fi
eval $1
}

# Find strings that we have reused from core CKAN and other plugins
DEP_POTS=""
for PLUGIN in $PLUGIN_DEPENDENCIES; do
DEP=$SRC_DIR/ckanext-$PLUGIN/ckanext/$PLUGIN/i18n/ckanext-$PLUGIN.pot
echo $DEP
if [ -f $DEP ]; then
DEP_POTS="$DEP_POTS $DEP"
else
echo "Warning: .pot file for dependent $PLUGIN plugin doesn't exist, skipping $DEP"
fi
done
echo $DEP_POTS

run_verbose "msgcat $SRC_DIR/ckan/ckan/i18n/ckan.pot $DEP_POTS -o $CURR_DIR/_dependencies.pot"

# Identify reused translations
touch $CURR_DIR/_reused_translations.pot
run_verbose "msgcat --use-first --more-than=1 $CURR_DIR/_dependencies.pot $CURR_DIR/ckanext-$PLUGIN_NAME.pot -o $CURR_DIR/_reused_translations.pot"

# Leave only unique strings in our pot
run_verbose "msgcat --unique $CURR_DIR/ckanext-$PLUGIN_NAME.pot $CURR_DIR/_reused_translations.pot -o $CURR_DIR/ckanext-$PLUGIN_NAME.pot"

rm $CURR_DIR/_dependencies.pot
if [ ! $SAVE_REUSED ]; then
rm $CURR_DIR/_reused_translations.pot
else
echo "Saving $CURR_DIR/_reused_translations.pot"
fi

echo ""
echo "I've updated $CURR_DIR/ckanext-$PLUGIN_NAME.pot."

0 comments on commit bcb285f

Please sign in to comment.