1
0
forked from 0ad/0ad

Add a script to lint the translations with Dennis.

Two of our printf calls are not compatible with python-format and will
be ignored until Dennis supports the corresponding formats. Also removed
meaningless enclosing characters that were wrongly considered HTML.

Reviewed By: leper
Differential Revision: https://code.wildfiregames.com/D214
This was SVN commit r19669.
This commit is contained in:
Nicolas Auvray 2017-05-27 12:26:26 +00:00
parent 4a78efe0e3
commit 3d53614bce
6 changed files with 40 additions and 1 deletions

View File

@ -22,6 +22,7 @@
"MarkForTranslationWithContext": [[1], 2] "MarkForTranslationWithContext": [[1], 2]
}, },
"commentTags": [ "commentTags": [
"dennis-ignore:",
"Translation:" "Translation:"
] ]
} }

View File

@ -66,6 +66,7 @@ function updateCounters()
let counters = []; let counters = [];
if (Engine.ConfigDB_GetValue("user", "overlay.fps") === "true") if (Engine.ConfigDB_GetValue("user", "overlay.fps") === "true")
// dennis-ignore: *
counters.push(sprintf(translate("FPS: %(fps)4s"), { "fps": Engine.GetFPS() })); counters.push(sprintf(translate("FPS: %(fps)4s"), { "fps": Engine.GetFPS() }));
if (Engine.ConfigDB_GetValue("user", "overlay.realtime") === "true") if (Engine.ConfigDB_GetValue("user", "overlay.realtime") === "true")

View File

@ -89,7 +89,7 @@ function updateResultingLocale()
} }
else else
{ {
resultingLocaleText.caption = translate("<invalid>"); resultingLocaleText.caption = translate("invalid locale");
dictionaryFile.caption = ""; dictionaryFile.caption = "";
var acceptButton = Engine.GetGUIObjectByName("acceptButton"); var acceptButton = Engine.GetGUIObjectByName("acceptButton");
acceptButton.enabled = false; acceptButton.enabled = false;

View File

@ -259,6 +259,7 @@
"markForPluralTranslation": [1, 2] "markForPluralTranslation": [1, 2]
}, },
"commentTags": [ "commentTags": [
"dennis-ignore:",
"Translation:" "Translation:"
] ]
} }

View File

@ -0,0 +1,35 @@
#!/bin/sh
# This script uses the Dennis PO(T) linter to find issues.
# See http://dennis.readthedocs.io/en/latest/index.html for
# installation instructions.
set +e # Lint everything without failing
# Move to the root of the repository (this script is in build/jenkins/)
cd "$(dirname $0)"/../../
# Configuration for the linter
# Ignore
# - W302: Translated string is identical to source string
parameters='--excluderules W302'
# Run lint and output to a file that will be posted on Phabricator
echo "Running Dennis..."
{
echo "Linting templates..."
echo "Engine"
dennis-cmd lint ${parameters} binaries/data/l10n/*.pot
echo "Mod mod"
dennis-cmd lint ${parameters} binaries/data/mods/mod/l10n/*.pot
echo "Public mod"
dennis-cmd lint ${parameters} binaries/data/mods/public/l10n/*.pot
echo "Linting translations..."
echo "Engine"
dennis-cmd lint ${parameters} binaries/data/l10n/*.po
echo "Mod mod"
dennis-cmd lint ${parameters} binaries/data/mods/mod/l10n/*.po
echo "Public mod"
dennis-cmd lint ${parameters} binaries/data/mods/public/l10n/*.po
} > .phabricator-comment

View File

@ -828,6 +828,7 @@ std::wstring GetBuildTimestamp(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), i
else else
{ {
// Translation: First item is a date and time, item between parenthesis is the Subversion revision number of the current build. // Translation: First item is a date and time, item between parenthesis is the Subversion revision number of the current build.
// dennis-ignore: *
sprintf_s(buf, ARRAY_SIZE(buf), g_L10n.Translate("%s (%ls)").c_str(), dateTimeString.c_str(), svn_revision); sprintf_s(buf, ARRAY_SIZE(buf), g_L10n.Translate("%s (%ls)").c_str(), dateTimeString.c_str(), svn_revision);
} }
} }