').addClass('fighter').text(_(chara)).data('hp', hp).data('maxHp', maxhp).data('refname',chara);
$('
').addClass('hp').text(hp+'/'+maxhp).appendTo(fighter);
return fighter;
},
diff --git a/script/events/encounters.js b/script/events/encounters.js
index dd2ca77..9d1aaff 100644
--- a/script/events/encounters.js
+++ b/script/events/encounters.js
@@ -12,6 +12,8 @@ Events.Encounters = [
'start': {
combat: true,
enemy: 'snarling beast',
+ enemyName: _('snarling beast'),
+ deathMessage: _('the snarling beast is dead'),
chara: 'B',
damage: 1,
hit: 0.8,
@@ -47,6 +49,8 @@ Events.Encounters = [
'start': {
combat: true,
enemy: 'gaunt man',
+ enemyName: _('gaunt man'),
+ deathMessage: _('the gaunt man is dead'),
chara: 'G',
damage: 2,
hit: 0.8,
@@ -81,7 +85,9 @@ Events.Encounters = [
scenes: {
'start': {
combat: true,
- enemy: 'strange bird',
+ enemy: 'strange bird',
+ enemyName: _('strange bird'),
+ deathMessage: _('the strange bird is dead'),
chara: 'B',
damage: 3,
hit: 0.8,
@@ -117,7 +123,9 @@ Events.Encounters = [
scenes: {
'start': {
combat: true,
- enemy: 'shivering man',
+ enemy: 'shivering man',
+ enemyName: _('shivering man'),
+ deathMessage: _('the shivering man is dead'),
chara: 'S',
damage: 5,
hit: 0.5,
@@ -157,7 +165,9 @@ Events.Encounters = [
scenes: {
'start': {
combat: true,
- enemy: 'man-eater',
+ enemy: 'man-eater',
+ enemyName: _('man-eater'),
+ deathMessage: _('the man-eater is dead'),
chara: 'E',
damage: 3,
hit: 0.8,
@@ -192,7 +202,9 @@ Events.Encounters = [
scenes: {
'start': {
combat: true,
- enemy: 'scavenger',
+ enemy: 'scavenger',
+ enemyName: _('scavenger'),
+ deathMessage: _('the scavenger is dead'),
chara: 'S',
damage: 4,
hit: 0.8,
@@ -232,7 +244,9 @@ Events.Encounters = [
scenes: {
'start': {
combat: true,
- enemy: 'lizard',
+ enemy: 'lizard',
+ enemyName: _('lizard'),
+ deathMessage: _('the lizard is dead'),
chara: 'L',
damage: 5,
hit: 0.8,
@@ -268,7 +282,9 @@ Events.Encounters = [
scenes: {
'start': {
combat: true,
- enemy: 'feral terror',
+ enemy: 'feral terror',
+ enemyName: _('feral terror'),
+ deathMessage: _('the feral terror is dead'),
chara: 'F',
damage: 6,
hit: 0.8,
@@ -303,7 +319,9 @@ Events.Encounters = [
scenes: {
'start': {
combat: true,
- enemy: 'soldier',
+ enemy: 'soldier',
+ enemyName: _('soldier'),
+ deathMessage: _('the soldier is dead'),
ranged: true,
chara: 'D',
damage: 8,
@@ -344,7 +362,9 @@ Events.Encounters = [
scenes: {
'start': {
combat: true,
- enemy: 'sniper',
+ enemy: 'sniper',
+ enemyName: _('sniper'),
+ deathMessage: _('the sniper is dead'),
chara: 'S',
damage: 15,
hit: 0.8,
diff --git a/script/events/setpieces.js b/script/events/setpieces.js
index 7af71d8..b373408 100644
--- a/script/events/setpieces.js
+++ b/script/events/setpieces.js
@@ -2848,7 +2848,7 @@ Events.Setpieces = {
onLoad: function() {
World.markVisited(World.curPos[0], World.curPos[1]);
World.setWater(World.getMaxWater());
- Notifications.notify(null, 'water replenished');
+ Notifications.notify(null, _('water replenished'));
},
loot: {
'cured meat': {
diff --git a/script/localization.js b/script/localization.js
index 0fbf89a..c4e8676 100644
--- a/script/localization.js
+++ b/script/localization.js
@@ -1,13 +1,13 @@
(function(){
//only used for poedit to find translatable strings
- var keywords = [ _('wood'),_('builder'),_('teeth'),_('meat'),_('fur'),
+ var keywords = [ _('wood'),_('builder'),_('teeth'),_('meat'),_('fur'), _('alien alloy'), _('bullets'),
_('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')];
+ _('gatherer'),_('cloth'), _('scales'), _('cured meat'), _('thieves'),
+ _('not enough fur.'), _('not enough wood.'), _('not enough coal.'), _('not enough iron.'), _('not enough steel.'), _('baited trap'),
+ _('the compass points east.'), _('the compass points west.'), _('the compass points north.'), _('the compass points south.')];
delete keywords;
//translate text in css by overriding attributes
@@ -17,19 +17,26 @@
div#buildBtns:before{ content: \''+ _("build:") + '\'}\
div#craftBtns:before{ content: \''+ _("craft:") + '\'}\
div#buyBtns:before{ content: \''+ _("buy:") + '\'}\
+ div#outfitting:before{ content: \''+ _("supplies:") + '\'}\
+ div#perks:before{ content: \''+ _("perks:") + '\'}\
+ div#lootButtons:before { content: \''+ _("take:") + '\'}\
').appendTo($('head'));
// resize buttons so the text is not wrap
function resizeButtons($div){
- var maxWidth = 0;
- $div.find('.button').css({
+ return;
+ var maxWidth = 80;
+ $div.find('.button').each(function(){
+ $(this).data('display',$(this).css('display'));
+ }).css({
width: "auto",
display: "inline-block"
}).each(function(){
maxWidth = Math.max($(this).width(), maxWidth);
}).css({
- display: "block",
width: maxWidth+"px"
+ }).each(function(){
+ $(this).css('display',$(this).data('display'));
});
}
@@ -37,9 +44,13 @@
$(document).on("DOMNodeInserted", "#outsidePanel",function(){
resizeButtons($(this));
});
- $(document).on("DOMNodeInserted", ".buttons",function(){
+ $(document).on("DOMNodeInserted", "#roomPanel",function(){
resizeButtons($(this));
});
+ $(document).on("DOMNodeInserted", "#buttons",function(){
+ resizeButtons($(this));
+ });
+
document.addEventListener("DOMNodeInserted", function(){
if(parseOutsidePanel) return;
else if($("#outsidePanel").length){
diff --git a/script/outside.js b/script/outside.js
index d16b3f3..fca4236 100644
--- a/script/outside.js
+++ b/script/outside.js
@@ -2,7 +2,7 @@
* Module that registers the outdoors functionality
*/
var Outside = {
- name: "Outside",
+ name: _("Outside"),
_GATHER_DELAY: 60,
_TRAPS_DELAY: 90,
@@ -10,12 +10,14 @@ var Outside = {
_INCOME: {
'gatherer': {
+ name: _('gatherer'),
delay: 10,
stores: {
'wood': 1
}
},
'hunter': {
+ name: _('hunter'),
delay: 10,
stores: {
'fur': 0.5,
@@ -23,6 +25,7 @@ var Outside = {
}
},
'trapper': {
+ name: _('trapper'),
delay: 10,
stores: {
'meat': -1,
@@ -30,6 +33,7 @@ var Outside = {
}
},
'tanner': {
+ name: _('tanner'),
delay: 10,
stores: {
'fur': -5,
@@ -37,6 +41,7 @@ var Outside = {
}
},
'charcutier': {
+ name: _('charcutier'),
delay: 10,
stores: {
'meat': -5,
@@ -45,6 +50,7 @@ var Outside = {
}
},
'iron miner': {
+ name: _('iron miner'),
delay: 10,
stores: {
'cured meat': -1,
@@ -52,6 +58,7 @@ var Outside = {
}
},
'coal miner': {
+ name: _('coal miner'),
delay: 10,
stores: {
'cured meat': -1,
@@ -59,6 +66,7 @@ var Outside = {
}
},
'sulphur miner': {
+ name: _('sulphur miner'),
delay: 10,
stores: {
'cured meat': -1,
@@ -66,6 +74,7 @@ var Outside = {
}
},
'steelworker': {
+ name: _('steelworker'),
delay: 10,
stores: {
'iron': -1,
@@ -74,6 +83,7 @@ var Outside = {
}
},
'armourer': {
+ name: _('armourer'),
delay: 10,
stores: {
'steel': -1,
@@ -299,16 +309,19 @@ var Outside = {
return num;
},
- makeWorkerRow: function(name, num) {
+ makeWorkerRow: function(key, num) {
+ name = Outside._INCOME[key].name;
+ if(!name) name = key;
var row = $('
')
- .attr('id', 'workers_row_' + name.replace(' ','-'))
+ .attr('key', key)
+ .attr('id', 'workers_row_' + key.replace(' ','-'))
.addClass('workerRow');
$('
').addClass('row_key').text(name).appendTo(row);
var val = $('
').addClass('row_val').appendTo(row);
$('
').text(num).appendTo(val);
- if(name != 'gatherer') {
+ if(key != 'gatherer') {
$('').addClass('upManyBtn').appendTo(val).click([10], Outside.increaseWorker);
$('
').addClass('upBtn').appendTo(val).click([1], Outside.increaseWorker);
$('
').addClass('dnBtn').appendTo(val).click([1], Outside.decreaseWorker);
@@ -318,10 +331,10 @@ var Outside = {
$('
').addClass('clear').appendTo(row);
var tooltip = $('
').addClass('tooltip bottom right').appendTo(row);
- var income = Outside._INCOME[name];
+ var income = Outside._INCOME[key];
for(var s in income.stores) {
var r = $('
').addClass('storeRow');
- $('
').addClass('row_key').text(s).appendTo(r);
+ $('
').addClass('row_key').text(_(s)).appendTo(r);
$('
').addClass('row_val').text(Engine.getIncomeMsg(income.stores[s], income.delay)).appendTo(r);
r.appendTo(tooltip);
}
@@ -330,7 +343,7 @@ var Outside = {
},
increaseWorker: function(btn) {
- var worker = $(this).closest('.workerRow').children('.row_key').text();
+ var worker = $(this).closest('.workerRow').attr('key');
if(Outside.getNumGatherers() > 0) {
var increaseAmt = Math.min(Outside.getNumGatherers(), btn.data);
Engine.log('increasing ' + worker + ' by ' + increaseAmt);
@@ -339,7 +352,7 @@ var Outside = {
},
decreaseWorker: function(btn) {
- var worker = $(this).closest('.workerRow').children('.row_key').text();
+ var worker = $(this).closest('.workerRow').attr('key');
if($SM.get('game.workers["'+worker+'"]') > 0) {
var decreaseAmt = Math.min($SM.get('game.workers["'+worker+'"]') || 0, btn.data);
Engine.log('decreasing ' + worker + ' by ' + decreaseAmt);
@@ -352,7 +365,7 @@ var Outside = {
var row = $('div#' + id, village);
if(row.length == 0 && num > 0) {
row = $('
').attr('id', id).addClass('storeRow');
- $('
').addClass('row_key').text(name).appendTo(row);
+ $('
').addClass('row_key').text(_(name)).appendTo(row);
$('
').addClass('row_val').text(num).appendTo(row);
$('
').addClass('clear').appendTo(row);
var curPrev = null;
@@ -473,7 +486,7 @@ var Outside = {
stores[store] = income.stores[store] * num;
if(curIncome[store] != stores[store]) needsUpdate = true;
var row = $('
').addClass('storeRow');
- $('
').addClass('row_key').text(store).appendTo(row);
+ $('
').addClass('row_key').text(_(store)).appendTo(row);
$('
').addClass('row_val').text(Engine.getIncomeMsg(stores[store], income.delay)).appendTo(row);
row.appendTo(tooltip);
}
diff --git a/script/path.js b/script/path.js
index 07b7b24..fb2289d 100644
--- a/script/path.js
+++ b/script/path.js
@@ -26,7 +26,7 @@ var Path = {
World.init();
// Create the path tab
- this.tab = Header.addLocation("A Dusty Path", "path", Path);
+ this.tab = Header.addLocation(_("A Dusty Path"), "path", Path);
// Create the Path panel
this.panel = $('
').attr('id', "pathPanel")
@@ -40,7 +40,7 @@ var Path = {
// Add the embark button
new Button.Button({
id: 'embarkButton',
- text: "embark",
+ text: _("embark"),
click: Path.embark,
width: '80px',
cooldown: World.DEATH_COOLDOWN
@@ -57,7 +57,7 @@ var Path = {
openPath: function() {
Path.init();
Engine.event('progress', 'path');
- Notifications.notify(Room, 'the compass points ' + World.dir);
+ Notifications.notify(Room, _('the compass points ' + World.dir));
},
getWeight: function(thing) {
@@ -106,7 +106,7 @@ var Path = {
var r = $('#' + id);
if($SM.get('character.perks["'+k+'"]') && r.length == 0) {
r = $('
').attr('id', id).addClass('perkRow').appendTo(perks);
- $('
').addClass('row_key').text(k).appendTo(r);
+ $('
').addClass('row_key').text(_(k)).appendTo(r);
$('
').addClass('tooltip bottom right').text(Engine.Perks[k].desc).appendTo(r);
}
}
@@ -129,17 +129,17 @@ var Path = {
}
// Add the armour row
- var armour = "none";
+ var armour = _("none");
if($SM.get('stores["s armour"]', true) > 0)
- armour = "steel";
+ armour = _("steel");
else if($SM.get('stores["i armour"]', true) > 0)
- armour = "iron";
+ armour = _("iron");
else if($SM.get('stores["l armour"]', true) > 0)
- armour = "leather";
+ armour = _("leather");
var aRow = $('#armourRow');
if(aRow.length == 0) {
aRow = $('
').attr('id', 'armourRow').addClass('outfitRow').prependTo(outfit);
- $('
').addClass('row_key').text('armour').appendTo(aRow);
+ $('
').addClass('row_key').text(_('armour')).appendTo(aRow);
$('
').addClass('row_val').text(armour).appendTo(aRow);
$('
').addClass('clear').appendTo(aRow);
} else {
@@ -150,7 +150,7 @@ var Path = {
var wRow = $('#waterRow');
if(wRow.length == 0) {
wRow = $('
').attr('id', 'waterRow').addClass('outfitRow').insertAfter(aRow);
- $('
').addClass('row_key').text('water').appendTo(wRow);
+ $('
').addClass('row_key').text(_('water')).appendTo(wRow);
$('
').addClass('row_val').text(World.getMaxWater()).appendTo(wRow);
$('
').addClass('clear').appendTo(wRow);
} else {
@@ -183,7 +183,7 @@ var Path = {
if((store.type == 'tool' || store.type == 'weapon') && have > 0) {
total += num * Path.getWeight(k);
if(row.length == 0) {
- row = Path.createOutfittingRow(k, num);
+ row = Path.createOutfittingRow(k, num, store.name);
var curPrev = null;
outfit.children().each(function(i) {
@@ -226,7 +226,7 @@ var Path = {
}
// Update bagspace
- $('#bagspace').text('free ' + Math.floor(Path.getCapacity() - total) + '/' + Path.getCapacity());
+ $('#bagspace').text(_('free {0}/{1}', Math.floor(Path.getCapacity() - total) , Path.getCapacity()));
if(Path.outfit['cured meat'] > 0) {
Button.setDisabled($('#embarkButton'), false);
@@ -235,8 +235,9 @@ var Path = {
}
},
- createOutfittingRow: function(name, num) {
- var row = $('
').attr('id', 'outfit_row_' + name.replace(' ', '-')).addClass('outfitRow');
+ createOutfittingRow: function(key, num, name) {
+ if(!name) name = _(key);
+ var row = $('
').attr('id', 'outfit_row_' + key.replace(' ', '-')).addClass('outfitRow').attr('key',key);
$('
').addClass('row_key').text(name).appendTo(row);
var val = $('
').addClass('row_val').appendTo(row);
@@ -247,18 +248,18 @@ var Path = {
$('
').addClass('dnManyBtn').appendTo(val).click([10], Path.decreaseSupply);
$('
').addClass('clear').appendTo(row);
- var numAvailable = $SM.get('stores["'+name+'"]', true);
+ var numAvailable = $SM.get('stores["'+key+'"]', true);
var tt = $('
').addClass('tooltip bottom right').appendTo(row);
- $('
').addClass('row_key').text('weight').appendTo(tt);
- $('
').addClass('row_val').text(Path.getWeight(name)).appendTo(tt);
- $('
').addClass('row_key').text('available').appendTo(tt);
+ $('
').addClass('row_key').text(_('weight')).appendTo(tt);
+ $('
').addClass('row_val').text(Path.getWeight(key)).appendTo(tt);
+ $('
').addClass('row_key').text(_('available')).appendTo(tt);
$('
').addClass('row_val').addClass('numAvailable').text(numAvailable).appendTo(tt);
return row;
},
increaseSupply: function(btn) {
- var supply = $(this).closest('.outfitRow').children('.row_key').text().replace('-', ' ');
+ var supply = $(this).closest('.outfitRow').attr('key');
Engine.log('increasing ' + supply + ' by up to ' + btn.data);
var cur = Path.outfit[supply];
cur = typeof cur == 'number' ? cur : 0;
@@ -272,7 +273,7 @@ var Path = {
},
decreaseSupply: function(btn) {
- var supply = $(this).closest('.outfitRow').children('.row_key').text().replace('-', ' ');
+ var supply = $(this).closest('.outfitRow').attr('key');
Engine.log('decreasing ' + supply + ' by up to ' + btn.data);
var cur = Path.outfit[supply];
cur = typeof cur == 'number' ? cur : 0;
@@ -291,7 +292,7 @@ var Path = {
},
setTitle: function() {
- document.title = 'A Dusty Path';
+ document.title = _('A Dusty Path');
},
embark: function() {
diff --git a/script/room.js b/script/room.js
index e381ed1..b550aef 100644
--- a/script/room.js
+++ b/script/room.js
@@ -15,6 +15,7 @@ var Room = {
Craftables: {
'trap': {
+ name: _('trap'),
button: null,
maximum: 10,
availableMsg: _('builder says she can make traps to catch any creatures might still be alive out there'),
@@ -29,6 +30,7 @@ var Room = {
}
},
'cart': {
+ name: _('cart'),
button: null,
maximum: 1,
availableMsg: _('builder says she can make a cart for carrying wood'),
@@ -41,6 +43,7 @@ var Room = {
}
},
'hut': {
+ name: _('hut'),
button: null,
maximum: 20,
availableMsg: _("builder says there are more wanderers. says they'll work, too."),
@@ -55,6 +58,7 @@ var Room = {
}
},
'lodge': {
+ name: _('lodge'),
button: null,
maximum: 1,
availableMsg: _('villagers could help hunt, given the means'),
@@ -69,6 +73,7 @@ var Room = {
}
},
'trading post': {
+ name: _('trading post'),
button: null,
maximum: 1,
availableMsg: _("a trading post would make commerce easier"),
@@ -82,6 +87,7 @@ var Room = {
}
},
'tannery': {
+ name: _('tannery'),
button: null,
maximum: 1,
availableMsg: _("builder says leather could be useful. says the villagers could make it."),
@@ -95,6 +101,7 @@ var Room = {
}
},
'smokehouse': {
+ name: _('smokehouse'),
button: null,
maximum: 1,
availableMsg: _("should cure the meat, or it'll spoil. builder says she can fix something up."),
@@ -108,6 +115,7 @@ var Room = {
}
},
'workshop': {
+ name: _('workshop'),
button: null,
maximum: 1,
availableMsg: _("builder says she could make finer things, if she had the tools"),
@@ -122,6 +130,7 @@ var Room = {
}
},
'steelworks': {
+ name: _('steelworks'),
button: null,
maximum: 1,
availableMsg: _("builder says the villagers could make steel, given the tools"),
@@ -136,6 +145,7 @@ var Room = {
}
},
'armoury': {
+ name: _('armoury'),
button: null,
maximum: 1,
availableMsg: _("builder says it'd be useful to have a steady source of bullets"),
@@ -150,6 +160,7 @@ var Room = {
}
},
'torch': {
+ name: _('torch'),
button: null,
type: 'tool',
buildMsg: _('a torch to keep the dark away'),
@@ -161,6 +172,7 @@ var Room = {
}
},
'waterskin': {
+ name: _('waterskin'),
button: null,
type: 'upgrade',
maximum: 1,
@@ -172,6 +184,7 @@ var Room = {
}
},
'cask': {
+ name: _('cask'),
button: null,
type: 'upgrade',
maximum: 1,
@@ -184,6 +197,7 @@ var Room = {
}
},
'water tank': {
+ name: _('water tank'),
button: null,
type: 'upgrade',
maximum: 1,
@@ -196,6 +210,7 @@ var Room = {
}
},
'bone spear': {
+ name: _('bone spear'),
button: null,
type: 'weapon',
buildMsg: _("this spear's not elegant, but it's pretty good at stabbing"),
@@ -207,6 +222,7 @@ var Room = {
}
},
'rucksack': {
+ name: _('rucksack'),
button: null,
type: 'upgrade',
maximum: 1,
@@ -218,6 +234,7 @@ var Room = {
}
},
'wagon': {
+ name: _('wagon'),
button: null,
type: 'upgrade',
maximum: 1,
@@ -230,6 +247,7 @@ var Room = {
}
},
'convoy': {
+ name: _('convoy'),
button: null,
type: 'upgrade',
maximum: 1,
@@ -243,6 +261,7 @@ var Room = {
}
},
'l armour': {
+ name: _('l armour'),
type: 'upgrade',
maximum: 1,
buildMsg: _("leather's not strong. better than rags, though."),
@@ -254,6 +273,7 @@ var Room = {
}
},
'i armour': {
+ name: _('i armour'),
type: 'upgrade',
maximum: 1,
buildMsg: _("iron's stronger than leather"),
@@ -265,6 +285,7 @@ var Room = {
}
},
's armour': {
+ name: _('s armour'),
type: 'upgrade',
maximum: 1,
buildMsg: _("steel's stronger than iron"),
@@ -276,6 +297,7 @@ var Room = {
}
},
'iron sword': {
+ name: _('iron sword'),
button: null,
type: 'weapon',
buildMsg: _("sword is sharp. good protection out in the wilds."),
@@ -288,6 +310,7 @@ var Room = {
}
},
'steel sword': {
+ name: _('steel sword'),
button: null,
type: 'weapon',
buildMsg: _("the steel is strong, and the blade true."),
@@ -300,6 +323,7 @@ var Room = {
}
},
'rifle': {
+ name: _('rifle'),
type: 'weapon',
buildMsg: _("black powder and bullets, like the old days."),
cost: function() {
@@ -782,7 +806,7 @@ var Room = {
if(row.length == 0 && num > 0) {
row = $('
').attr('id', id).addClass('storeRow');
- $('
').addClass('row_key').text(k).appendTo(row);
+ $('
').addClass('row_key').text(_(k)).appendTo(row);
$('
').addClass('row_val').text(Math.floor(num)).appendTo(row);
$('
').addClass('clear').appendTo(row);
var curPrev = null;
@@ -835,7 +859,7 @@ var Room = {
var income = $SM.get('income["'+incomeSource+'"]');
for(var store in income.stores) {
if(store == storeName && income.stores[store] != 0) {
- $('
').addClass('row_key').text(incomeSource).appendTo(tt);
+ $('
').addClass('row_key').text(_(incomeSource)).appendTo(tt);
$('
')
.addClass('row_val')
.text(Engine.getIncomeMsg(income.stores[store], income.delay))
@@ -863,7 +887,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 " + k));
return false;
} else {
storeMod[k] = have - cost[k];
@@ -883,7 +907,7 @@ var Room = {
build: function(buildBtn) {
var thing = $(buildBtn).attr('buildThing');
if(Room.temperature.value <= Room.TempEnum.Cold.value) {
- Notifications.notify(Room, "builder just shivers");
+ Notifications.notify(Room, _("builder just shivers"));
return false;
}
var craftable = Room.Craftables[thing];
@@ -911,7 +935,7 @@ var Room = {
for(var k in cost) {
var have = $SM.get('stores["'+k+'"]', true);
if(have < cost[k]) {
- Notifications.notify(Room, _("not enough {0}", k));
+ Notifications.notify(Room, _("not enough "+k));
return false;
} else {
storeMod[k] = have - cost[k];
@@ -1025,7 +1049,7 @@ var Room = {
costTooltip.empty();
var cost = craftable.cost();
for(var k in cost) {
- $("
").addClass('row_key').text(k).appendTo(costTooltip);
+ $("
").addClass('row_key').text(_(k)).appendTo(costTooltip);
$("
").addClass('row_val').text(cost[k]).appendTo(costTooltip);
}
if(max && !craftable.button.hasClass('disabled')) {
@@ -1058,7 +1082,7 @@ var Room = {
costTooltip.empty();
var cost = good.cost();
for(var k in cost) {
- $("
").addClass('row_key').text(k).appendTo(costTooltip);
+ $("
").addClass('row_key').text(_(k)).appendTo(costTooltip);
$("
").addClass('row_val').text(cost[k]).appendTo(costTooltip);
}
if(max && !good.button.hasClass('disabled')) {
diff --git a/script/ship.js b/script/ship.js
index f184737..3c6c006 100644
--- a/script/ship.js
+++ b/script/ship.js
@@ -8,7 +8,7 @@ var Ship = {
BASE_HULL: 0,
BASE_THRUSTERS: 1,
- name: "Ship",
+ name: _("Ship"),
init: function(options) {
this.options = $.extend(
this.options,
@@ -24,7 +24,7 @@ var Ship = {
}
// Create the Ship tab
- this.tab = Header.addLocation("An Old Starship", "ship", Ship);
+ this.tab = Header.addLocation(_("An Old Starship"), "ship", Ship);
// Create the Ship panel
this.panel = $('
').attr('id', "shipPanel")
@@ -35,20 +35,20 @@ var Ship = {
// Draw the hull label
var hullRow = $('
').attr('id', 'hullRow').appendTo('div#shipPanel');
- $('
').addClass('row_key').text('hull:').appendTo(hullRow);
+ $('
').addClass('row_key').text(_('hull:')).appendTo(hullRow);
$('
').addClass('row_val').text($SM.get('game.spaceShip.hull')).appendTo(hullRow);
$('
').addClass('clear').appendTo(hullRow);
// Draw the thrusters label
var engineRow = $('
').attr('id', 'engineRow').appendTo('div#shipPanel');
- $('
').addClass('row_key').text('engine:').appendTo(engineRow);
+ $('
').addClass('row_key').text(_('engine:')).appendTo(engineRow);
$('
').addClass('row_val').text($SM.get('game.spaceShip.thrusters')).appendTo(engineRow);
$('
').addClass('clear').appendTo(engineRow);
// Draw the reinforce button
new Button.Button({
id: 'reinforceButton',
- text: 'reinforce hull',
+ text: _('reinforce hull'),
click: Ship.reinforceHull,
width: '100px',
cost: {'alien alloy': Ship.ALLOY_PER_HULL}
@@ -57,7 +57,7 @@ var Ship = {
// Draw the engine button
new Button.Button({
id: 'engineButton',
- text: 'upgrade engine',
+ text: _('upgrade engine'),
click: Ship.upgradeEngine,
width: '100px',
cost: {'alien alloy': Ship.ALLOY_PER_THRUSTER}
@@ -66,7 +66,7 @@ var Ship = {
// Draw the lift off button
var b = new Button.Button({
id: 'liftoffButton',
- text: 'lift off',
+ text: _('lift off'),
click: Ship.checkLiftOff,
width: '100px',
cooldown: Ship.LIFTOFF_COOLDOWN
@@ -88,7 +88,7 @@ var Ship = {
onArrival: function(transition_diff) {
Ship.setTitle();
if(!$SM.get('game.spaceShip.seenShip')) {
- Notifications.notify(Ship, 'somewhere above the debris cloud, the wanderer fleet hovers. been on this rock too long.');
+ Notifications.notify(Ship, _('somewhere above the debris cloud, the wanderer fleet hovers. been on this rock too long.'));
$SM.set('game.spaceShip.seenShip', true);
}
@@ -103,7 +103,7 @@ var Ship = {
reinforceHull: function() {
if($SM.get('stores["alien alloy"]', true) < Ship.ALLOY_PER_HULL) {
- Notifications.notify(Ship, "not enough alien alloy");
+ Notifications.notify(Ship, _("not enough alien alloy"));
return false;
}
$SM.add('stores["alien alloy"]', -Ship.ALLOY_PER_HULL);
@@ -116,7 +116,7 @@ var Ship = {
upgradeEngine: function() {
if($SM.get('stores["alien alloy"]', true) < Ship.ALLOY_PER_THRUSTER) {
- Notifications.notify(Ship, "not enough alien alloy");
+ Notifications.notify(Ship, _("not enough alien alloy"));
return false;
}
$SM.add('stores["alien alloy"]', -Ship.ALLOY_PER_THRUSTER);
@@ -131,15 +131,15 @@ var Ship = {
checkLiftOff: function() {
if(!$SM.get('game.spaceShip.seenWarning')) {
Events.startEvent({
- title: 'Ready to Leave?',
+ title: _('Ready to Leave?'),
scenes: {
'start': {
text: [
- "time to get out of this place. won't be coming back."
+ _("time to get out of this place. won't be coming back.")
],
buttons: {
'fly': {
- text: 'lift off',
+ text: _('lift off'),
onChoose: function() {
$SM.set('game.spaceShip.seenWarning', true);
Ship.liftOff();
@@ -147,7 +147,7 @@ var Ship = {
nextScene: 'end'
},
'wait': {
- text: 'linger',
+ text: _('linger'),
onChoose: function() {
Button.clearCooldown($('#liftoffButton'));
},
diff --git a/script/space.js b/script/space.js
index f45a5ba..f4388f0 100644
--- a/script/space.js
+++ b/script/space.js
@@ -39,7 +39,7 @@ var Space = {
// Create the hull display
var h = $('
').attr('id', 'hullRemaining').appendTo(this.panel);
- $('
').addClass('row_key').text('hull: ').appendTo(h);
+ $('
').addClass('row_key').text(_('hull: ')).appendTo(h);
$('
').addClass('row_val').appendTo(h);
//subscribe to stateUpdates
@@ -73,17 +73,17 @@ var Space = {
if(Engine.activeModule == this) {
var t;
if(Space.altitude < 10) {
- t = "Troposphere";
+ t = _("Troposphere");
} else if(Space.altitude < 20) {
- t = "Stratosphere";
+ t = _("Stratosphere");
} else if(Space.altitude < 30) {
- t = "Mesosphere";
+ t = _("Mesosphere");
} else if(Space.altitude < 45) {
- t = "Thermosphere";
+ t = _("Thermosphere");
} else if(Space.altitude < 60){
- t = "Exosphere";
+ t = _("Exosphere");
} else {
- t = "Space";
+ t = _("Space");
}
document.title = t;
}
@@ -418,14 +418,14 @@ var Space = {
.appendTo('body');
$('
')
.addClass('endGame')
- .text('score for this game: ' + Score.calculateScore())
+ .text(_('score for this game: {0}', Score.calculateScore()))
.appendTo('.centerCont')
.animate({opacity:1},1500);
$('
')
.appendTo('.centerCont');
$('')
.addClass('endGame')
- .text('total score: ' + Prestige.get().score)
+ .text(_('total score: {0}', Prestige.get().score))
.appendTo('.centerCont')
.animate({opacity:1},1500);
$('
')
@@ -436,7 +436,7 @@ var Space = {
$('#content, #notifications').remove();
$('')
.addClass('endGame endGameRestart')
- .text('restart.')
+ .text(_('restart.'))
.click(Engine.confirmDelete)
.appendTo('.centerCont')
.animate({opacity:1},1500);
diff --git a/script/world.js b/script/world.js
index 62a1c9e..b666f90 100644
--- a/script/world.js
+++ b/script/world.js
@@ -43,58 +43,58 @@ var World = {
Weapons: {
'fists': {
- verb: 'punch',
+ verb: _('punch'),
type: 'unarmed',
damage: 1,
cooldown: 2
},
'bone spear': {
- verb: 'stab',
+ verb: _('stab'),
type: 'melee',
damage: 2,
cooldown: 2
},
'iron sword': {
- verb: 'swing',
+ verb: _('swing'),
type: 'melee',
damage: 4,
cooldown: 2
},
'steel sword': {
- verb: 'slash',
+ verb: _('slash'),
type: 'melee',
damage: 6,
cooldown: 2
},
'bayonet': {
- verb: 'thrust',
+ verb: _('thrust'),
type: 'melee',
damage: 8,
cooldown: 2
},
'rifle': {
- verb: 'shoot',
+ verb: _('shoot'),
type: 'ranged',
damage: 5,
cooldown: 1,
cost: { 'bullets': 1 }
},
'laser rifle': {
- verb: 'blast',
+ verb: _('blast'),
type: 'ranged',
damage: 8,
cooldown: 1,
cost: { 'energy cell': 1 }
},
'grenade': {
- verb: 'lob',
+ verb: _('lob'),
type: 'ranged',
damage: 15,
cooldown: 5,
cost: { 'grenade': 1 }
},
'bolas': {
- verb: 'tangle',
+ verb: _('tangle'),
type: 'ranged',
damage: 'stun',
cooldown: 15,
@@ -116,22 +116,22 @@ var World = {
World.TILE_PROBS[World.TILE.BARRENS] = 0.5;
// Setpiece definitions
- World.LANDMARKS[World.TILE.OUTPOST] = { num: 0, minRadius: 0, maxRadius: 0, scene: 'outpost', label: 'An Outpost' };
- World.LANDMARKS[World.TILE.IRON_MINE] = { num: 1, minRadius: 5, maxRadius: 5, scene: 'ironmine', label: 'Iron Mine' };
- World.LANDMARKS[World.TILE.COAL_MINE] = { num: 1, minRadius: 10, maxRadius: 10, scene: 'coalmine', label: 'Coal Mine' };
- World.LANDMARKS[World.TILE.SULPHUR_MINE] = { num: 1, minRadius: 20, maxRadius: 20, scene: 'sulphurmine', label: 'Sulphur Mine' };
- World.LANDMARKS[World.TILE.HOUSE] = { num: 10, minRadius: 0, maxRadius: World.RADIUS * 1.5, scene: 'house', label: 'An Old House' };
- World.LANDMARKS[World.TILE.CAVE] = { num: 5, minRadius: 3, maxRadius: 10, scene: 'cave', label: 'A Damp Cave' };
- World.LANDMARKS[World.TILE.TOWN] = { num: 10, minRadius: 10, maxRadius: 20, scene: 'town', label: 'An Abandoned Town' };
- World.LANDMARKS[World.TILE.CITY] = { num: 20, minRadius: 20, maxRadius: World.RADIUS * 1.5, scene: 'city', label: 'A Ruined City' };
- World.LANDMARKS[World.TILE.SHIP] = { num: 1, minRadius: 28, maxRadius: 28, scene: 'ship', label: 'A Crashed Starship'};
- World.LANDMARKS[World.TILE.BOREHOLE] = { num: 10, minRadius: 15, maxRadius: World.RADIUS * 1.5, scene: 'borehole', label: 'A Borehole'};
- World.LANDMARKS[World.TILE.BATTLEFIELD] = { num: 5, minRadius: 18, maxRadius: World.RADIUS * 1.5, scene: 'battlefield', label: 'A Battlefield'};
- World.LANDMARKS[World.TILE.SWAMP] = { num: 1, minRadius: 15, maxRadius: World.RADIUS * 1.5, scene: 'swamp', label: 'A Murky Swamp'};
+ World.LANDMARKS[World.TILE.OUTPOST] = { num: 0, minRadius: 0, maxRadius: 0, scene: 'outpost', label: _('An Outpost') };
+ World.LANDMARKS[World.TILE.IRON_MINE] = { num: 1, minRadius: 5, maxRadius: 5, scene: 'ironmine', label: _('Iron Mine') };
+ World.LANDMARKS[World.TILE.COAL_MINE] = { num: 1, minRadius: 10, maxRadius: 10, scene: 'coalmine', label: _('Coal Mine') };
+ World.LANDMARKS[World.TILE.SULPHUR_MINE] = { num: 1, minRadius: 20, maxRadius: 20, scene: 'sulphurmine', label: _('Sulphur Mine') };
+ World.LANDMARKS[World.TILE.HOUSE] = { num: 10, minRadius: 0, maxRadius: World.RADIUS * 1.5, scene: 'house', label: _('An Old House') };
+ World.LANDMARKS[World.TILE.CAVE] = { num: 5, minRadius: 3, maxRadius: 10, scene: 'cave', label: _('A Damp Cave') };
+ World.LANDMARKS[World.TILE.TOWN] = { num: 10, minRadius: 10, maxRadius: 20, scene: 'town', label: _('An Abandoned Town') };
+ World.LANDMARKS[World.TILE.CITY] = { num: 20, minRadius: 20, maxRadius: World.RADIUS * 1.5, scene: 'city', label: _('A Ruined City') };
+ World.LANDMARKS[World.TILE.SHIP] = { num: 1, minRadius: 28, maxRadius: 28, scene: 'ship', label: _('A Crashed Starship')};
+ World.LANDMARKS[World.TILE.BOREHOLE] = { num: 10, minRadius: 15, maxRadius: World.RADIUS * 1.5, scene: 'borehole', label: _('A Borehole')};
+ World.LANDMARKS[World.TILE.BATTLEFIELD] = { num: 5, minRadius: 18, maxRadius: World.RADIUS * 1.5, scene: 'battlefield', label: _('A Battlefield')};
+ World.LANDMARKS[World.TILE.SWAMP] = { num: 1, minRadius: 15, maxRadius: World.RADIUS * 1.5, scene: 'swamp', label: _('A Murky Swamp')};
// Only add the cache if there is prestige data
if($SM.get('previous.stores')) {
- World.LANDMARKS[World.TILE.CACHE] = { num: 1, minRadius: 10, maxRadius: World.RADIUS * 1.5, scene: 'cache', label: 'A Destroyed Village'};
+ World.LANDMARKS[World.TILE.CACHE] = { num: 1, minRadius: 10, maxRadius: World.RADIUS * 1.5, scene: 'cache', label: _('A Destroyed Village')};
}
if(typeof $SM.get('features.location.world') == 'undefined') {
@@ -247,7 +247,7 @@ var World = {
water = World.createItemDiv('water', World.water);
water.prependTo(supplies);
} else if(World.water > 0) {
- $('div#supply_water', supplies).text('water:' + World.water);
+ $('div#supply_water', supplies).text(_('water:{0}' , World.water));
} else {
water.remove();
}
@@ -267,21 +267,21 @@ var World = {
item.appendTo(supplies);
}
} else if(num > 0) {
- $('div#' + item.attr('id'), supplies).text(k + ':' + num);
+ $('div#' + item.attr('id'), supplies).text(_(k) + ':' + num);
} else {
item.remove();
}
}
// Update label
- var t = 'pockets';
+ var t = _('pockets');
if($SM.get('stores.rucksack', true) > 0) {
- t = 'rucksack';
+ t = _('rucksack');
}
$('#backpackTitle').text(t);
// Update bagspace
- $('#backpackSpace').text('free ' + Math.floor(Path.getCapacity() - total) + '/' + Path.getCapacity());
+ $('#backpackSpace').text(_('free {0}/{1}', Math.floor(Path.getCapacity() - total) , Path.getCapacity()));
},
setWater: function(w) {
@@ -298,14 +298,14 @@ var World = {
if(World.health > World.getMaxHealth()) {
World.health = World.getMaxHealth();
}
- $('#healthCounter').text('hp: ' + World.health + '/' + World.getMaxHealth());
+ $('#healthCounter').text(_('hp: {0}/{1}', World.health , World.getMaxHealth()));
}
},
createItemDiv: function(name, num) {
var div = $('').attr('id', 'supply_' + name.replace(' ', '-'))
.addClass('supplyItem')
- .text(name + ':' + num);
+ .text(_('{0}:{1}',_(name), num));
return div;
},
@@ -340,9 +340,9 @@ var World = {
World.doSpace();
if(World.checkDanger()) {
if(World.danger) {
- Notifications.notify(World, 'dangerous to be this far from the village without proper protection');
+ Notifications.notify(World, _('dangerous to be this far from the village without proper protection'));
} else {
- Notifications.notify(World, 'safer here');
+ Notifications.notify(World, _('safer here'));
}
}
},
@@ -442,12 +442,12 @@ var World = {
var num = Path.outfit['cured meat'];
num--;
if(num == 0) {
- Notifications.notify(World, 'the meat has run out');
+ Notifications.notify(World, _('the meat has run out'));
} else if(num < 0) {
// Starvation! Hooray!
num = 0;
if(!World.starvation) {
- Notifications.notify(World, 'starvation sets in');
+ Notifications.notify(World, _('starvation sets in'));
World.starvation = true;
} else {
$SM.set('character.starved', $SM.get('character.starved', true));
@@ -472,11 +472,11 @@ var World = {
var water = World.water;
water--;
if(water == 0) {
- Notifications.notify(World, 'there is no more water');
+ Notifications.notify(World, _('there is no more water'));
} else if(water < 0) {
water = 0;
if(!World.thirst) {
- Notifications.notify(World, 'the thirst becomes unbearable');
+ Notifications.notify(World, _('the thirst becomes unbearable'));
World.thirst = true;
} else {
$SM.set('character.dehydrated', $SM.get('character.dehydrated', true));
@@ -549,30 +549,30 @@ var World = {
case World.TILE.FOREST:
switch(newTile) {
case World.TILE.FIELD:
- msg = "the trees yield to dry grass. the yellowed brush rustles in the wind.";
+ msg = _("the trees yield to dry grass. the yellowed brush rustles in the wind.");
break;
case World.TILE.BARRENS:
- msg = "the trees are gone. parched earth and blowing dust are poor replacements.";
+ msg = _("the trees are gone. parched earth and blowing dust are poor replacements.");
break;
}
break;
case World.TILE.FIELD:
switch(newTile) {
case World.TILE.FOREST:
- msg = "trees loom on the horizon. grasses gradually yield to a forest floor of dry branches and fallen leaves.";
+ msg = _("trees loom on the horizon. grasses gradually yield to a forest floor of dry branches and fallen leaves.");
break;
case World.TILE.BARRENS:
- msg = "the grasses thin. soon, only dust remains.";
+ msg = _("the grasses thin. soon, only dust remains.");
break;
}
break;
case World.TILE.BARRENS:
switch(newTile) {
case World.TILE.FIELD:
- msg = "the barrens break at a sea of dying grass, swaying in the arid breeze.";
+ msg = _("the barrens break at a sea of dying grass, swaying in the arid breeze.");
break;
case World.TILE.FOREST:
- msg = "a wall of gnarled trees rises from the dust. their branches twist into a skeletal canopy overhead.";
+ msg = _("a wall of gnarled trees rises from the dust. their branches twist into a skeletal canopy overhead.");
break;
}
break;
@@ -774,12 +774,12 @@ var World = {
ttClass += " bottom";
}
if(World.curPos[0] == i && World.curPos[1] == j) {
- mapString += '
@Wanderer
';
+ mapString += '
@'+_('Wanderer')+'
';
} else if(World.state.mask[i][j]) {
var c = World.state.map[i][j];
switch(c) {
case World.TILE.VILLAGE:
- mapString += '
' + c + 'The Village
';
+ mapString += '
' + c + ''+_('The Village')+'
';
break;
default:
if(typeof World.LANDMARKS[c] != 'undefined' && (c != World.TILE.OUTPOST || !World.outpostUsed(i, j))) {
@@ -808,7 +808,7 @@ var World = {
Engine.event('game event', 'death');
Engine.keyLock = true;
// Dead! Discard any world changes and go home
- Notifications.notify(World, 'the world fades');
+ Notifications.notify(World, _('the world fades'));
World.state = null;
Path.outfit = {};
$('#outerSlider').animate({opacity: '0'}, 600, 'linear', function() {
@@ -909,7 +909,7 @@ var World = {
},
useOutpost: function() {
- Notifications.notify(null, 'water replenished');
+ Notifications.notify(null, _('water replenished'));
World.setWater(World.getMaxWater());
// Mark this outpost as used
World.usedOutposts[World.curPos[0] + ',' + World.curPos[1]] = true;
@@ -936,7 +936,7 @@ var World = {
},
setTitle: function() {
- document.title = 'A Barren World';
+ document.title = _('A Barren World');
},
copyPos: function(pos) {