Skip to content

Commit

Permalink
Merge branch 'vanadar-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Continuities committed May 19, 2014
2 parents 4043658 + 957dbdf commit 88f9d3f
Show file tree
Hide file tree
Showing 24 changed files with 4,388 additions and 912 deletions.
29 changes: 29 additions & 0 deletions doc/translation.txt
Original file line number Diff line number Diff line change
@@ -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


26 changes: 23 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html itemscope itemtype="http://schema.org/CreativeWork">
<head>
<meta charset="UTF-8"/>
<!--
A Dark Room (v1.4)
==================
Expand All @@ -25,6 +26,24 @@
<script src="lib/jquery.event.move.js"></script>
<script src="lib/jquery.event.swipe.js"></script>
<script src="lib/base64.js"></script>
<script src="lib/translate.js"></script>

<script>
// try to read "lang" param's from url
var lang = decodeURIComponent((new RegExp('[?|&]lang=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
// if no language requested, try to read it from local storage
if(!lang){
try {
lang = localStorage.lang;
} catch(e) {}
}
// if a language different than english requested, load all translations
if(lang && lang != 'en'){
document.write('<script src="lang/'+lang+'/strings.js"><\/script>');
document.write('<link rel="stylesheet" type="text/css" href="lang/'+'lang'+'/main.css" \/>');
}
</script>

<script src="script/Button.js"></script>
<script src="script/engine.js"></script>
<script src="script/state_manager.js"></script>
Expand All @@ -37,8 +56,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>
Expand All @@ -61,6 +80,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(){
Expand All @@ -75,7 +95,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">
Expand Down
3 changes: 3 additions & 0 deletions lang/fr/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.button{width: 100px !important;}
#outsidePanel .button{width: 115px !important;}
.eventPanel .button {width: 122px !important;}
1 change: 1 addition & 0 deletions lang/fr/strings.js

Large diffs are not rendered by default.

Binary file added lang/fr/strings.mo
Binary file not shown.
Loading

0 comments on commit 88f9d3f

Please sign in to comment.