suites des trads

This commit is contained in:
Vanadar
2014-02-05 17:06:30 +01:00
parent 989c6b4cfc
commit 7ac28eeb1a
9 changed files with 2320 additions and 133 deletions
+4 -3
View File
@@ -39,8 +39,8 @@
<script src="script/path.js"></script>
<script src="script/ship.js"></script>
<script src="script/space.js"></script>
<script src="script/prestige.js"></script>
<script src="script/scoring.js"></script>
<script src="script/prestige.js"></script>
<script src="script/scoring.js"></script>
<!-- Event modules -->
<script src="script/events/global.js"></script>
<script src="script/events/room.js"></script>
@@ -63,6 +63,7 @@
<link rel="stylesheet" type="text/css" href="css/ship.css" />
<link rel="stylesheet" type="text/css" href="css/space.css" />
<script src="script/localization.js"></script>
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -77,7 +78,7 @@
</head>
<body>
<div id="wrapper">
<div id="saveNotify">saved.</div>
<div id="saveNotify"><script>document.write(_("saved."));</script></div>
<div id="content">
<div id="outerSlider">
<div id="main">
+1 -1
View File
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.
+2176 -43
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -487,7 +487,8 @@ var Engine = {
},
getIncomeMsg: function(num, delay) {
return (num > 0 ? "+" : "") + num + " per " + delay + "s";
return _("{0} per {1}s", (num > 0 ? "+" : "") + num, delay);
//return (num > 0 ? "+" : "") + num + " per " + delay + "s";
},
keyDown: function(e) {
+1 -1
View File
@@ -373,7 +373,7 @@ Events.Encounters = [
chance: 0.1
}
},
notification: _('a shot rings out, from somewhere in the long grass'à
notification: _('a shot rings out, from somewhere in the long grass')
}
}
}
+52
View File
@@ -0,0 +1,52 @@
(function(){
//only used for poedit to find translatable strings
var keywords = [ _('wood'),_('builder'),_('teeth'),_('meat'),_('fur'),
_('charm'),_('leather'),_('iron'), _('steel'), _('coal'),
_('hut'), _('cart'), _('trap'), _('gatherer'),_('cloth'),
_('torch'),_('medicine'),_('hunter'),_('trapper'),_('tanner'),
_("charcutier"),_('iron miner'),_('coal miner'), _('sulphur miner'), _('armourer'),
_('steelworker'),_('bait'),_('cured meat'), _('scales'), _('compass'),
_('scales'), _('bone spear'), _('rucksack'), _('l armour'), _('trading post'),
_('lodge'), _('tannery'), _('smokehouse'), _('workshop'), _('cured meat')];
delete keywords;
//translate text in css by overriding attributes
$("<style>").text('\
div#stores:before{ content: \''+ _("stores") + '\'}\
div#weapons:before{ content: \''+ _("weapons") + '\'}\
div#buildBtns:before{ content: \''+ _("build:") + '\'}\
div#craftBtns:before{ content: \''+ _("craft:") + '\'}\
div#buyBtns:before{ content: \''+ _("buy:") + '\'}\
').appendTo($('head'));
// resize buttons so the text is not wrap
function resizeButtons($div){
var maxWidth = 0;
$div.find('.button').css({
width: "auto",
display: "inline-block"
}).each(function(){
maxWidth = Math.max($(this).width(), maxWidth);
}).css({
display: "block",
width: maxWidth+"px"
});
}
parseOutsidePanel = false;
$(document).on("DOMNodeInserted", "#outsidePanel",function(){
resizeButtons($(this));
});
$(document).on("DOMNodeInserted", ".buttons",function(){
resizeButtons($(this));
});
document.addEventListener("DOMNodeInserted", function(){
if(parseOutsidePanel) return;
else if($("#outsidePanel").length){
resizeButtons($("#outsidePanel"));
$('#outsidePanel')[0].addEventListener("DOMNodeInserted", resizeButtons($("#outsidePanel")));
parseOutsidePanel = true;
}
});
})();
+12 -12
View File
@@ -128,7 +128,7 @@ var Outside = {
}
// Create the outside tab
this.tab = Header.addLocation("A Silent Forest", "outside", Outside);
this.tab = Header.addLocation(_("A Silent Forest"), "outside", Outside);
// Create the Outside panel
this.panel = $('<div>').attr('id', "outsidePanel")
@@ -494,7 +494,7 @@ var Outside = {
if(btn.length == 0) {
new Button.Button({
id: 'trapsButton',
text: "check traps",
text: _("check traps"),
click: Outside.checkTraps,
cooldown: Outside._TRAPS_DELAY,
width: '80px'
@@ -513,17 +513,17 @@ var Outside = {
var numHuts = $SM.get('game.buildings["hut"]', true);
var title;
if(numHuts == 0) {
title = "A Silent Forest";
title = _("A Silent Forest");
} else if(numHuts == 1) {
title = "A Lonely Hut";
title = _("A Lonely Hut");
} else if(numHuts <= 4) {
title = "A Tiny Village";
title = _("A Tiny Village");
} else if(numHuts <= 8) {
title = "A Modest Village";
title = _("A Modest Village");
} else if(numHuts <= 14) {
title = "A Large Village";
title = _("A Large Village");
} else {
title = "A Raucous Village";
title = _("A Raucous Village");
}
if(Engine.activeModule == this) {
@@ -535,7 +535,7 @@ var Outside = {
onArrival: function(transition_diff) {
Outside.setTitle();
if(!$SM.get('game.outside.seenForest')) {
Notifications.notify(Outside, "the sky is grey and the wind blows relentlessly");
Notifications.notify(Outside, _("the sky is grey and the wind blows relentlessly"));
$SM.set('game.outside.seenForest', true);
}
Outside.updateTrapButton();
@@ -545,7 +545,7 @@ var Outside = {
},
gatherWood: function() {
Notifications.notify(Outside, "dry brush and dead branches litter the forest floor");
Notifications.notify(Outside, _("dry brush and dead branches litter the forest floor"));
var gatherAmt = $SM.get('game.buildings["cart"]', true) > 0 ? 50 : 10;
$SM.add('stores.wood', gatherAmt);
},
@@ -571,12 +571,12 @@ var Outside = {
}
}
}
var s = 'the traps contain ';
var s = _('the traps contain ');
for(var i = 0, len = msg.length; i < len; i++) {
if(len > 1 && i > 0 && i < len - 1) {
s += ", ";
} else if(len > 1 && i == len - 1) {
s += " and ";
s += _(" and ");
}
s += msg[i];
}
+72 -72
View File
@@ -17,9 +17,9 @@ var Room = {
'trap': {
button: null,
maximum: 10,
availableMsg: 'builder says she can make traps to catch any creatures might still be alive out there',
buildMsg: 'more traps to catch more creatures',
maxMsg: "more traps won't help now",
availableMsg: _('builder says she can make traps to catch any creatures might still be alive out there'),
buildMsg: _('more traps to catch more creatures'),
maxMsg: _("more traps won't help now"),
type: 'building',
cost: function() {
var n = $SM.get('game.buildings["trap"]', true);
@@ -31,8 +31,8 @@ var Room = {
'cart': {
button: null,
maximum: 1,
availableMsg: 'builder says she can make a cart for carrying wood',
buildMsg: 'the rickety cart will carry more wood from the forest',
availableMsg: _('builder says she can make a cart for carrying wood'),
buildMsg: _('the rickety cart will carry more wood from the forest'),
type: 'building',
cost: function() {
return {
@@ -43,9 +43,9 @@ var Room = {
'hut': {
button: null,
maximum: 20,
availableMsg: "builder says there are more wanderers. says they'll work, too.",
buildMsg: 'builder puts up a hut, out in the forest. says word will get around.',
maxMsg: 'no more room for huts.',
availableMsg: _("builder says there are more wanderers. says they'll work, too."),
buildMsg: _('builder puts up a hut, out in the forest. says word will get around.'),
maxMsg: _('no more room for huts.'),
type: 'building',
cost: function() {
var n = $SM.get('game.buildings["hut"]', true);
@@ -57,8 +57,8 @@ var Room = {
'lodge': {
button: null,
maximum: 1,
availableMsg: 'villagers could help hunt, given the means',
buildMsg: 'the hunting lodge stands in the forest, a ways out of town',
availableMsg: _('villagers could help hunt, given the means'),
buildMsg: _('the hunting lodge stands in the forest, a ways out of town'),
type: 'building',
cost: function() {
return {
@@ -71,8 +71,8 @@ var Room = {
'trading post': {
button: null,
maximum: 1,
availableMsg: "a trading post would make commerce easier",
buildMsg: "now the nomads have a place to set up shop, they might stick around a while",
availableMsg: _("a trading post would make commerce easier"),
buildMsg: _("now the nomads have a place to set up shop, they might stick around a while"),
type: 'building',
cost: function() {
return {
@@ -84,8 +84,8 @@ var Room = {
'tannery': {
button: null,
maximum: 1,
availableMsg: "builder says leather could be useful. says the villagers could make it.",
buildMsg: 'tannery goes up quick, on the edge of the village',
availableMsg: _("builder says leather could be useful. says the villagers could make it."),
buildMsg: _('tannery goes up quick, on the edge of the village'),
type: 'building',
cost: function() {
return {
@@ -97,8 +97,8 @@ var Room = {
'smokehouse': {
button: null,
maximum: 1,
availableMsg: "should cure the meat, or it'll spoil. builder says she can fix something up.",
buildMsg: 'builder finishes the smokehouse. she looks hungry.',
availableMsg: _("should cure the meat, or it'll spoil. builder says she can fix something up."),
buildMsg: _('builder finishes the smokehouse. she looks hungry.'),
type: 'building',
cost: function() {
return {
@@ -110,8 +110,8 @@ var Room = {
'workshop': {
button: null,
maximum: 1,
availableMsg: "builder says she could make finer things, if she had the tools",
buildMsg: "workshop's finally ready. builder's excited to get to it",
availableMsg: _("builder says she could make finer things, if she had the tools"),
buildMsg: _("workshop's finally ready. builder's excited to get to it"),
type: 'building',
cost: function() {
return {
@@ -124,8 +124,8 @@ var Room = {
'steelworks': {
button: null,
maximum: 1,
availableMsg: "builder says the villagers could make steel, given the tools",
buildMsg: "a haze falls over the village as the steelworks fires up",
availableMsg: _("builder says the villagers could make steel, given the tools"),
buildMsg: _("a haze falls over the village as the steelworks fires up"),
type: 'building',
cost: function() {
return {
@@ -138,8 +138,8 @@ var Room = {
'armoury': {
button: null,
maximum: 1,
availableMsg: "builder says it'd be useful to have a steady source of bullets",
buildMsg: "armoury's done, welcoming back the weapons of the past.",
availableMsg: _("builder says it'd be useful to have a steady source of bullets"),
buildMsg: _("armoury's done, welcoming back the weapons of the past."),
type: 'building',
cost: function() {
return {
@@ -152,7 +152,7 @@ var Room = {
'torch': {
button: null,
type: 'tool',
buildMsg: 'a torch to keep the dark away',
buildMsg: _('a torch to keep the dark away'),
cost: function() {
return {
'wood': 1,
@@ -164,7 +164,7 @@ var Room = {
button: null,
type: 'upgrade',
maximum: 1,
buildMsg: 'this waterskin\'ll hold a bit of water, at least',
buildMsg: _('this waterskin\'ll hold a bit of water, at least'),
cost: function() {
return {
'leather': 50
@@ -175,7 +175,7 @@ var Room = {
button: null,
type: 'upgrade',
maximum: 1,
buildMsg: 'the cask holds enough water for longer expeditions',
buildMsg: _('the cask holds enough water for longer expeditions'),
cost: function() {
return {
'leather': 100,
@@ -187,7 +187,7 @@ var Room = {
button: null,
type: 'upgrade',
maximum: 1,
buildMsg: 'never go thirsty again',
buildMsg: _('never go thirsty again'),
cost: function() {
return {
'iron': 100,
@@ -198,7 +198,7 @@ var Room = {
'bone spear': {
button: null,
type: 'weapon',
buildMsg: "this spear's not elegant, but it's pretty good at stabbing",
buildMsg: _("this spear's not elegant, but it's pretty good at stabbing"),
cost: function() {
return {
'wood': 100,
@@ -210,7 +210,7 @@ var Room = {
button: null,
type: 'upgrade',
maximum: 1,
buildMsg: 'carrying more means longer expeditions to the wilds',
buildMsg: _('carrying more means longer expeditions to the wilds'),
cost: function() {
return {
'leather': 200
@@ -221,7 +221,7 @@ var Room = {
button: null,
type: 'upgrade',
maximum: 1,
buildMsg: 'the wagon can carry a lot of supplies',
buildMsg: _('the wagon can carry a lot of supplies'),
cost: function() {
return {
'wood': 500,
@@ -233,7 +233,7 @@ var Room = {
button: null,
type: 'upgrade',
maximum: 1,
buildMsg: 'the convoy can haul mostly everything',
buildMsg: _('the convoy can haul mostly everything'),
cost: function() {
return {
'wood': 1000,
@@ -245,7 +245,7 @@ var Room = {
'l armour': {
type: 'upgrade',
maximum: 1,
buildMsg: "leather's not strong. better than rags, though.",
buildMsg: _("leather's not strong. better than rags, though."),
cost: function() {
return {
'leather': 200,
@@ -256,7 +256,7 @@ var Room = {
'i armour': {
type: 'upgrade',
maximum: 1,
buildMsg: "iron's stronger than leather",
buildMsg: _("iron's stronger than leather"),
cost: function() {
return {
'leather': 200,
@@ -267,7 +267,7 @@ var Room = {
's armour': {
type: 'upgrade',
maximum: 1,
buildMsg: "steel's stronger than iron",
buildMsg: _("steel's stronger than iron"),
cost: function() {
return {
'leather': 200,
@@ -278,7 +278,7 @@ var Room = {
'iron sword': {
button: null,
type: 'weapon',
buildMsg: "sword is sharp. good protection out in the wilds.",
buildMsg: _("sword is sharp. good protection out in the wilds."),
cost: function() {
return {
'wood': 200,
@@ -290,7 +290,7 @@ var Room = {
'steel sword': {
button: null,
type: 'weapon',
buildMsg: "the steel is strong, and the blade true.",
buildMsg: _("the steel is strong, and the blade true."),
cost: function() {
return {
'wood': 500,
@@ -301,7 +301,7 @@ var Room = {
},
'rifle': {
type: 'weapon',
buildMsg: "black powder and bullets, like the old days.",
buildMsg: _("black powder and bullets, like the old days."),
cost: function() {
return {
'wood': 200,
@@ -433,7 +433,7 @@ var Room = {
}
},
name: "Room",
name: _("Room"),
init: function(options) {
this.options = $.extend(
this.options,
@@ -457,7 +457,7 @@ var Room = {
// Create the room tab
this.tab = Header.addLocation("A Dark Room", "room", Room);
this.tab = Header.addLocation(_("A Dark Room"), "room", Room);
// Create the Room panel
this.panel = $('<div>')
@@ -470,7 +470,7 @@ var Room = {
// Create the light button
new Button.Button({
id: 'lightButton',
text: 'light fire',
text: _('light fire'),
click: Room.lightFire,
cooldown: Room._STOKE_COOLDOWN,
width: '80px',
@@ -480,7 +480,7 @@ var Room = {
// Create the stoke button
new Button.Button({
id: 'stokeButton',
text: "stoke fire",
text: _("stoke fire"),
click: Room.stokeFire,
cooldown: Room._STOKE_COOLDOWN,
width: '80px',
@@ -516,9 +516,9 @@ var Room = {
setTimeout(Room.unlockForest, Room._NEED_WOOD_DELAY);
}
setTimeout($SM.collectIncome, 1000);
Notifications.notify(Room, "the room is " + Room.temperature.text);
Notifications.notify(Room, "the fire is " + Room.fire.text);
Notifications.notify(Room, _("the room is {0}", Room.temperature.text));
Notifications.notify(Room, _("the fire is {0}", Room.fire.text));
},
options: {}, // Nothing for now
@@ -526,8 +526,8 @@ var Room = {
onArrival: function(transition_diff) {
Room.setTitle();
if(Room.changed) {
Notifications.notify(Room, "the fire is " + Room.fire.text);
Notifications.notify(Room, "the room is " + Room.temperature.text);
Notifications.notify(Room, _("the fire is {0}", Room.fire.text));
Notifications.notify(Room, _("the room is {0}", Room.temperature.text));
Room.changed = false;
}
if($SM.get('game.builder.level') == 3) {
@@ -537,7 +537,7 @@ var Room = {
stores: {'wood' : 2 }
});
Room.updateIncomeView();
Notifications.notify(Room, "the stranger is standing by the fire. she says she can help. says she builds things.");
Notifications.notify(Room, _("the stranger is standing by the fire. she says she can help. says she builds things."));
}
Engine.moveStoresView(null, transition_diff);
@@ -552,11 +552,11 @@ var Room = {
}
return null;
},
Freezing: { value: 0, text: 'freezing' },
Cold: { value: 1, text: 'cold' },
Mild: { value: 2, text: 'mild' },
Warm: { value: 3, text: 'warm' },
Hot: { value: 4, text: 'hot' }
Freezing: { value: 0, text: _('freezing') },
Cold: { value: 1, text: _('cold') },
Mild: { value: 2, text: _('mild') },
Warm: { value: 3, text: _('warm') },
Hot: { value: 4, text: _('hot') }
},
FireEnum: {
@@ -568,15 +568,15 @@ var Room = {
}
return null;
},
Dead: { value: 0, text: 'dead' },
Smoldering: { value: 1, text: 'smoldering' },
Flickering: { value: 2, text: 'flickering' },
Burning: { value: 3, text: 'burning' },
Roaring: { value: 4, text: 'roaring' }
Dead: { value: 0, text: _('dead') },
Smoldering: { value: 1, text: _('smoldering') },
Flickering: { value: 2, text: _('flickering') },
Burning: { value: 3, text: _('burning') },
Roaring: { value: 4, text: _('roaring') }
},
setTitle: function() {
var title = Room.fire.value < 2 ? "A Dark Room" : "A Firelit Room";
var title = Room.fire.value < 2 ? _("A Dark Room") : _("A Firelit Room");
if(Engine.activeModule == this) {
document.title = title;
}
@@ -614,7 +614,7 @@ var Room = {
lightFire: function() {
var wood = $SM.get('stores.wood');
if(wood < 5) {
Notifications.notify(Room, "not enough wood to get the fire going");
Notifications.notify(Room, _("not enough wood to get the fire going"));
Button.clearCooldown($('#lightButton.button'));
return;
} else if(wood > 4) {
@@ -627,7 +627,7 @@ var Room = {
stokeFire: function() {
var wood = $SM.get('stores.wood');
if(wood === 0) {
Notifications.notify(Room, "the wood has run out");
Notifications.notify(Room, _("the wood has run out"));
Button.clearCooldown($('#stokeButton.button'));
return;
}
@@ -644,10 +644,10 @@ var Room = {
if(Engine.activeModule != Room) {
Room.changed = true;
}
Notifications.notify(Room, "the fire is " + Room.fire.text, true);
Notifications.notify(Room, _("the fire is {0}", Room.fire.text), true);
if(Room.fire.value > 1 && $SM.get('game.builder.level') < 0) {
$SM.set('game.builder.level', 0);
Notifications.notify(Room, "the light from the fire spills from the windows, out into the dark");
Notifications.notify(Room, _("the light from the fire spills from the windows, out into the dark"));
setTimeout(Room.updateBuilderState, Room._BUILDER_STATE_DELAY);
}
window.clearTimeout(Room._fireTimer);
@@ -660,7 +660,7 @@ var Room = {
var wood = $SM.get('stores.wood');
if(Room.fire.value <= Room.FireEnum.Flickering.value &&
$SM.get('game.builder.level') > 3 && wood > 0) {
Notifications.notify(Room, "builder stokes the fire", true);
Notifications.notify(Room, _("builder stokes the fire"), true);
$SM.set('stores.wood', wood - 1);
Room.fire = Room.FireEnum.fromInt(Room.fire.value + 1);
}
@@ -675,11 +675,11 @@ var Room = {
var old = Room.temperature.value;
if(Room.temperature.value > 0 && Room.temperature.value > Room.fire.value) {
Room.temperature = Room.TempEnum.fromInt(Room.temperature.value - 1);
Notifications.notify(Room, "the room is " + Room.temperature.text, true);
Notifications.notify(Room, _("the room is {0}" , Room.temperature.text), true);
}
if(Room.temperature.value < 4 && Room.temperature.value < Room.fire.value) {
Room.temperature = Room.TempEnum.fromInt(Room.temperature.value + 1);
Notifications.notify(Room, "the room is " + Room.temperature.text, true);
Notifications.notify(Room, _("the room is {0}" , Room.temperature.text), true);
}
if(Room.temperature.value != old) {
Room.changed = true;
@@ -690,15 +690,15 @@ var Room = {
unlockForest: function() {
$SM.set('stores.wood', 4);
Outside.init();
Notifications.notify(Room, "the wind howls outside");
Notifications.notify(Room, "the wood is running out");
Notifications.notify(Room, _("the wind howls outside"));
Notifications.notify(Room, _("the wood is running out"));
Engine.event('progress', 'outside');
},
updateBuilderState: function() {
var lBuilder = $SM.get('game.builder.level');
if(lBuilder == 0) {
Notifications.notify(Room, "a ragged stranger stumbles through the door and collapses in the corner");
Notifications.notify(Room, _("a ragged stranger stumbles through the door and collapses in the corner"));
lBuilder = $SM.setget('game.builder.level', 1);
setTimeout(Room.unlockForest, Room._NEED_WOOD_DELAY);
}
@@ -706,10 +706,10 @@ var Room = {
var msg = "";
switch(lBuilder) {
case 1:
msg = "the stranger shivers, and mumbles quietly. her words are unintelligible.";
msg = _("the stranger shivers, and mumbles quietly. her words are unintelligible.");
break;
case 2:
msg = "the stranger in the corner stops shivering. her breathing calms.";
msg = _("the stranger in the corner stops shivering. her breathing calms.");
break;
}
Notifications.notify(Room, msg);
@@ -911,7 +911,7 @@ var Room = {
for(var k in cost) {
var have = $SM.get('stores["'+k+'"]', true);
if(have < cost[k]) {
Notifications.notify(Room, "not enough " + k);
Notifications.notify(Room, _("not enough {0}", k));
return false;
} else {
storeMod[k] = have - cost[k];
@@ -1013,7 +1013,7 @@ var Room = {
craftable.button = new Button.Button({
id: 'build_' + k,
cost: craftable.cost(),
text: k,
text: _(k),
click: Room.build,
width: '80px',
ttPos: loc.children().length > 10 ? 'top right' : 'bottom right'
@@ -1047,7 +1047,7 @@ var Room = {
good.button = new Button.Button({
id: 'build_' + k,
cost: good.cost(),
text: k,
text: _(k),
click: Room.buy,
width: '80px'
}).css('opacity', 0).attr('buildThing', k).appendTo(buySection).animate({opacity:1}, 300, 'linear');