fin des trads, un peu de ménage & de doc

This commit is contained in:
vanadar
2014-02-08 14:13:59 +01:00
parent 5dd42bcc4d
commit cc2f374143
10 changed files with 1717 additions and 1634 deletions
+29
View File
@@ -0,0 +1,29 @@
HOWTO TRANSLATE
===================
for people who doesn't need translation :
- all strings sent to the page must go through the javascript function _() which will translate it. so please, if you add new strings, wrap them with _('') function.
- if you want to add some strings in the css (using content), please, edit /script/localization.js too
- thank you :)
ADD A NEW LANGUAGE
======================
- copy the /lang/fr folder to /lang/{new_language}
- open /lang/{new_language}/strings.po with a software like PoEdit (available on linux/mac/windows, no excuses)
- translate ...
- keep translating ...
- finished ? sure ?
- use the python script (/tools/po2js.py) to convert the po file to a js file
- edit index.html and add the following script after '<script src="lib/translate.js"></script>' (replace the path with your language)
<script>
//load language
document.write('<script src="lang/fr/strings.js"><\/script>');
document.write('<link rel="stylesheet" type="text/css" href="lang/fr/main.css" \/>');
</script>
- if your sentence are too big and you need to update some css, overload it in /lang/{new_language}/main.css
+2 -2
View File
@@ -29,8 +29,8 @@
<script>
//load language
document.write('<script src="lang/fr.js"><\/script>');
document.write('<link rel="stylesheet" type="text/css" href="lang/fr.css" \/>');
document.write('<script src="lang/fr/strings.js"><\/script>');
document.write('<link rel="stylesheet" type="text/css" href="lang/fr/main.css" \/>');
</script>
<script src="script/Button.js"></script>
-1
View File
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.
View File
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large Load Diff
+2 -40
View File
@@ -1,12 +1,13 @@
(function(){
//only used for poedit to find translatable strings
var keywords = [ _('wood'),_('builder'),_('teeth'),_('meat'),_('fur'), _('alien alloy'), _('bullets'),
var keywords = [ _('saved.'), _('wood'),_('builder'),_('teeth'),_('meat'),_('fur'), _('alien alloy'), _('bullets'),
_('charm'),_('leather'),_('iron'), _('steel'), _('coal'),
_('torch'),_('medicine'),_('hunter'),_('trapper'),_('tanner'),
_("charcutier"),_('iron miner'),_('coal miner'), _('sulphur miner'), _('armourer'),
_('steelworker'),_('bait'),_('cured meat'), _('scales'), _('compass'),
_('gatherer'),_('cloth'), _('scales'), _('cured meat'), _('thieves'),
_('not enough fur.'), _('not enough wood.'), _('not enough coal.'), _('not enough iron.'), _('not enough steel.'), _('baited trap'),
_('not enough scales.'), _('not enough teeth.'), _('not enough leather.'),
_('the compass points east.'), _('the compass points west.'), _('the compass points north.'), _('the compass points south.')];
delete keywords;
@@ -21,43 +22,4 @@
div#perks:before{ content: \''+ _("perks:") + '\'}\
div#lootButtons:before { content: \''+ _("take:") + '\'}\
').appendTo($('head'));
// resize buttons so the text is not wrap
function resizeButtons($div){
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({
width: maxWidth+"px"
}).each(function(){
$(this).css('display',$(this).data('display'));
});
}
parseOutsidePanel = false;
$(document).on("DOMNodeInserted", "#outsidePanel",function(){
resizeButtons($(this));
});
$(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){
resizeButtons($("#outsidePanel"));
$('#outsidePanel')[0].addEventListener("DOMNodeInserted", resizeButtons($("#outsidePanel")));
parseOutsidePanel = true;
}
});
})();
View File