mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Add Git pre-commit hook for generating POT file
It will generate a POT file, then add it to the commit if more than one line is changed (because there's no point committing it if the only change is to the creation time), and discard the generated file otherwise. The generated POT file changes the order of a few of its entries, so I've included that in this commit.
This commit is contained in:
+39
-39
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: LOOT 0.9.2\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/loot/loot/issues\n"
|
||||
"POT-Creation-Date: 2016-07-28 16:31+0200\n"
|
||||
"POT-Creation-Date: 2016-08-04 18:29+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -755,44 +755,6 @@ msgstr ""
|
||||
msgid "Failed to open file in its default application."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:43
|
||||
msgid ""
|
||||
"An error occurred while trying to read the local masterlist's version. If "
|
||||
"this error happens again, try deleting the \".git\" folder in %1%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:47
|
||||
msgid "N/A: No masterlist present"
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:80 src/backend/masterlist.cpp:81
|
||||
msgid "(edited)"
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:118 src/backend/masterlist.cpp:132
|
||||
msgid ""
|
||||
"An error occurred while trying to access the local masterlist repository. If "
|
||||
"this error happens again, try deleting the \".git\" folder in %1%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:239
|
||||
msgid ""
|
||||
"An error occurred while trying to read information on the updated "
|
||||
"masterlist. If this error happens again, try deleting the \".git\" folder in "
|
||||
"%1%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:253
|
||||
msgid "Masterlist revision"
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:257
|
||||
msgid ""
|
||||
"The latest masterlist revision contains a syntax error, LOOT is using the "
|
||||
"most recent valid revision instead. Syntax errors are usually minor and "
|
||||
"fixed within hours."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/metadata/condition_grammar.h:146
|
||||
#: src/backend/metadata/condition_grammar.h:281
|
||||
#: src/backend/metadata/condition_grammar.h:365
|
||||
@@ -878,3 +840,41 @@ msgid ""
|
||||
"Cyclic interaction detected between plugins \"%1%\" and \"%2%\". Back cycle: "
|
||||
"%3%"
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:43
|
||||
msgid ""
|
||||
"An error occurred while trying to read the local masterlist's version. If "
|
||||
"this error happens again, try deleting the \".git\" folder in %1%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:47
|
||||
msgid "N/A: No masterlist present"
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:80 src/backend/masterlist.cpp:81
|
||||
msgid "(edited)"
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:118 src/backend/masterlist.cpp:132
|
||||
msgid ""
|
||||
"An error occurred while trying to access the local masterlist repository. If "
|
||||
"this error happens again, try deleting the \".git\" folder in %1%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:239
|
||||
msgid ""
|
||||
"An error occurred while trying to read information on the updated "
|
||||
"masterlist. If this error happens again, try deleting the \".git\" folder in "
|
||||
"%1%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:253
|
||||
msgid "Masterlist revision"
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/masterlist.cpp:257
|
||||
msgid ""
|
||||
"The latest masterlist revision contains a syntax error, LOOT is using the "
|
||||
"most recent valid revision instead. Syntax errors are usually minor and "
|
||||
"fixed within hours."
|
||||
msgstr ""
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
# This is a Git pre-commit hook. Install it to `.git/hooks`.
|
||||
#
|
||||
# Run xgettext to write a new resources/l10n/template.pot, then add it to the
|
||||
# commit if more than one line in it has changed, otherwise discard any changes
|
||||
# to it.
|
||||
|
||||
xgettext -k"translate:1,1t" -k"translate:1c,2,t" --add-location=full --from-code=utf-8 --package-name=LOOT --package-version=0.9.2 --copyright-holder="WrinklyNinja" --msgid-bugs-address="https://github.com/loot/loot/issues" -o resources/l10n/template.pot src/gui/html/js/*.* src/gui/*.cpp src/backend/*/*.* src/backend/*.*
|
||||
|
||||
sed -i 's|charset=CHARSET|charset=UTF-8|' resources/l10n/template.pot
|
||||
|
||||
LINES_ADDED=$(git diff --numstat resources/l10n/template.pot | cut -f 1)
|
||||
LINES_REMOVED=$(git diff --numstat resources/l10n/template.pot | cut -f 2)
|
||||
|
||||
if [[ "$LINES_ADDED" -eq "$LINES_REMOVED" && "$LINES_ADDED" -eq 1 ]]; then
|
||||
git checkout -- resources/l10n/template.pot
|
||||
else
|
||||
git add resources/l10n/template.pot
|
||||
fi
|
||||
Reference in New Issue
Block a user