0ad/binaries/data/mods/public/gui/common/l10n.js
leper 0f21151c4b Some gui code cleanup/restructuring.
Moving some tooltip code that only needs templates to common/ to
allow to use that for the structree mod.

This was SVN commit r16127.
2015-01-08 21:37:59 +00:00

74 lines
4.7 KiB
JavaScript

const localisedResourceNames = {
"firstWord": {
// Translation: Word as used at the beginning of a sentence or as a single-word sentence.
"food": translateWithContext("firstWord", "Food"),
// Translation: Word as used at the beginning of a sentence or as a single-word sentence.
"meat": translateWithContext("firstWord", "Meat"),
// Translation: Word as used at the beginning of a sentence or as a single-word sentence.
"metal": translateWithContext("firstWord", "Metal"),
// Translation: Word as used at the beginning of a sentence or as a single-word sentence.
"ore": translateWithContext("firstWord", "Ore"),
// Translation: Word as used at the beginning of a sentence or as a single-word sentence.
"rock": translateWithContext("firstWord", "Rock"),
// Translation: Word as used at the beginning of a sentence or as a single-word sentence.
"ruins": translateWithContext("firstWord", "Ruins"),
// Translation: Word as used at the beginning of a sentence or as a single-word sentence.
"stone": translateWithContext("firstWord", "Stone"),
// Translation: Word as used at the beginning of a sentence or as a single-word sentence.
"treasure": translateWithContext("firstWord", "Treasure"),
// Translation: Word as used at the beginning of a sentence or as a single-word sentence.
"tree": translateWithContext("firstWord", "Tree"),
// Translation: Word as used at the beginning of a sentence or as a single-word sentence.
"wood": translateWithContext("firstWord", "Wood"),
// Translation: Word as used at the beginning of a sentence or as a single-word sentence.
"fruit": translateWithContext("firstWord", "Fruit"),
// Translation: Word as used at the beginning of a sentence or as a single-word sentence.
"grain": translateWithContext("firstWord", "Grain"),
// Translation: Word as used at the beginning of a sentence or as a single-word sentence.
"fish": translateWithContext("firstWord", "Fish"),
},
"withinSentence": {
// Translation: Word as used in the middle of a sentence (which may require using lowercase for your language).
"food": translateWithContext("withinSentence", "Food"),
// Translation: Word as used in the middle of a sentence (which may require using lowercase for your language).
"meat": translateWithContext("withinSentence", "Meat"),
// Translation: Word as used in the middle of a sentence (which may require using lowercase for your language).
"metal": translateWithContext("withinSentence", "Metal"),
// Translation: Word as used in the middle of a sentence (which may require using lowercase for your language).
"ore": translateWithContext("withinSentence", "Ore"),
// Translation: Word as used in the middle of a sentence (which may require using lowercase for your language).
"rock": translateWithContext("withinSentence", "Rock"),
// Translation: Word as used in the middle of a sentence (which may require using lowercase for your language).
"ruins": translateWithContext("withinSentence", "Ruins"),
// Translation: Word as used in the middle of a sentence (which may require using lowercase for your language).
"stone": translateWithContext("withinSentence", "Stone"),
// Translation: Word as used in the middle of a sentence (which may require using lowercase for your language).
"treasure": translateWithContext("withinSentence", "Treasure"),
// Translation: Word as used in the middle of a sentence (which may require using lowercase for your language).
"tree": translateWithContext("withinSentence", "Tree"),
// Translation: Word as used in the middle of a sentence (which may require using lowercase for your language).
"wood": translateWithContext("withinSentence", "Wood"),
// Translation: Word as used in the middle of a sentence (which may require using lowercase for your language).
"fruit": translateWithContext("withinSentence", "Fruit"),
// Translation: Word as used in the middle of a sentence (which may require using lowercase for your language).
"grain": translateWithContext("withinSentence", "Grain"),
// Translation: Word as used in the middle of a sentence (which may require using lowercase for your language).
"fish": translateWithContext("withinSentence", "Fish"),
}
};
function getLocalizedResourceName(resourceCode, context)
{
if (!localisedResourceNames[context])
{
warn("Internationalization: Unexpected context for resource type localization found: ‘" + context + "’. This context is not supported.");
return resourceCode;
}
if (!localisedResourceNames[context][resourceCode])
{
warn("Internationalization: Unexpected resource type found with code ‘" + resourceCode + ". This resource type must be internationalized.");
return resourceCode;
}
return localisedResourceNames[context][resourceCode];
}