1
0
forked from 0ad/0ad

Delete common/l10n.js.

It held resource strings when introduced by 0f21151c4b, but those were
moved to json files in 52f311da2b. 9b041467a2 moved two trivial
functions of this file to tooltips.js.
Remove a wrong comma from the JSdoc comment.
Alwas return a string.

Differential Revision: https://code.wildfiregames.com/D618
Confirmed by Itms in a forum PM that this doesn't break string freeze.

This was SVN commit r19779.
This commit is contained in:
elexis 2017-06-15 20:42:03 +00:00
parent 4ca1379bd9
commit 18b876bd55
3 changed files with 23 additions and 25 deletions

View File

@ -1,24 +0,0 @@
/**
* Format resource amounts to proper english and translate (for example: "200 food, 100 wood, and 300 metal").
*/
function getLocalizedResourceAmounts(resources)
{
let amounts = g_ResourceData.GetCodes()
.filter(type => !!resources[type])
.map(type => sprintf(translate("%(amount)s %(resourceType)s"), {
"amount": resources[type],
"resourceType": resourceNameWithinSentence(type)
}));
if (amounts.length > 1)
{
let lastAmount = amounts.pop();
amounts = sprintf(translate("%(previousAmounts)s and %(lastAmount)s"), {
// Translation: This comma is used for separating first to penultimate elements in an enumeration.
"previousAmounts": amounts.join(translate(", ")),
"lastAmount": lastAmount
});
}
return amounts;
}

View File

@ -57,6 +57,29 @@ function resourceNameWithinSentence(type)
return translateWithContext("withinSentence", g_ResourceData.GetNames()[type]);
}
/**
* Format resource amounts to proper english and translate (for example: "200 food, 100 wood and 300 metal").
*/
function getLocalizedResourceAmounts(resources)
{
let amounts = g_ResourceData.GetCodes()
.filter(type => !!resources[type])
.map(type => sprintf(translate("%(amount)s %(resourceType)s"), {
"amount": resources[type],
"resourceType": resourceNameWithinSentence(type)
}));
if (amounts.length < 2)
return amounts.join();
let lastAmount = amounts.pop();
return sprintf(translate("%(previousAmounts)s and %(lastAmount)s"), {
// Translation: This comma is used for separating first to penultimate elements in an enumeration.
"previousAmounts": amounts.join(translate(", ")),
"lastAmount": lastAmount
});
}
function bodyFont(text)
{
return g_TooltipTextFormats.body[0] + text + g_TooltipTextFormats.body[1];

View File

@ -8,7 +8,6 @@
<script file="gui/common/functions_global_object.js"/>
<script file="gui/common/functions_utility.js"/>
<script file="gui/common/gamedescription.js"/>
<script file="gui/common/l10n.js"/>
<script file="gui/common/music.js"/>
<script file="gui/common/network.js"/>
<script file="gui/common/settings.js"/>