diff --git a/lang/fr.js b/lang/fr.js new file mode 100644 index 0000000..ee9135d --- /dev/null +++ b/lang/fr.js @@ -0,0 +1 @@ +_.setTranslation({"save this.": "sauvegarder.", "a small group arrives, all dust and bones.": "un petit groupe arrive, sale et affam\u00e9.", "use meds": "utiliser un m\u00e9dicament", "scraps of fur": "morceaux de fourrure", "scattered teeth": "tas de dents", "punch twice as fast, and with even more force": "frapper deux fois plus vite, et avec plus de force", "restart.": "recommencer.", "gather wood": "r\u00e9coleter du bois", "export": "exporter", "punches do more damage": "les points font plus de d\u00e9gats", "cancel": "annuler", "import": "importer", "yes": "oui", "put the save code here.": "copier le code ici.", "close": "fermer", "strange scales": "\u00e9cailles \u00e9tranges", "learned to throw punches with purpose": "appris \u00e0 donner des coups de points avec un objectif", "a weathered family takes up in one of the huts.": "une famille \u00e9puis\u00e9e s'intalle dans une hutte.", "app store.": "app store", "learned to fight quite effectively without weapons": "apprendre \u00e0 se battre de fa\u00e7on efficace sans arme", "see farther": "voir plus loin", "lights off.": "lumi\u00e8res \u00e9teintes.", "are you sure?": "\u00eates vous sur ?", "bits of meat": "morceaux de viande", "restart the game?": "recommencer la partie ?", "a stranger arrives in the night": "Une \u00e9trang\u00e8re arrive durant la nuit", "lights on.": "lumi\u00e8res allum\u00e9es.", "a convoy lurches in, equal parts worry and hope.": "un convoi arrive, plein de crainte et d'\u00e9spoir.", "eat meat": "manger de la viande", "save.": "sauvegarder.", "punches do even more damage.": "les coups de points font plus de d\u00e9gats", "bring your friends.": "Invitez vos amis.", "Restart?": "Recommencer ?", "tattered cloth": "tas de vetements", "this is irreversible.": "Il n'y a pas de retour en arri\u00e8re possible.", "Export / Import": "Exporter/Importer", "the town's booming. word does get around.": "la ville s'agrandie, le mot se passe.", "no": "non", "Share": "Partager", "or migrating computers": "pour sauver votre partie ou changer d'ordinateur", "leave": "partir", "if the code is invalid, all data will be lost.": "si le code est incorrect, toutes les donn\u00e9es seront perdues.", "share.": "partager.", "Export": "Exporter", "learned to strike faster without weapons": "appris \u00e0 attaquer plus vite sans arme", "a crudely made charm": "un charme rudimentaire", "got it": "compris", "export or import save data, for backing up": "exporter ou importer vos donn\u00e9es de sauvegarde"}); diff --git a/lang/fr.mo b/lang/fr.mo new file mode 100644 index 0000000..0671099 Binary files /dev/null and b/lang/fr.mo differ diff --git a/lang/fr.po b/lang/fr.po new file mode 100644 index 0000000..e9d0f65 --- /dev/null +++ b/lang/fr.po @@ -0,0 +1,288 @@ +msgid "" +msgstr "" +"Project-Id-Version: adarkroom\n" +"POT-Creation-Date: 2014-02-04 21:32+0100\n" +"PO-Revision-Date: 2014-02-04 22:00+0100\n" +"Last-Translator: Vanadar \n" +"Language-Team: \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.5.4\n" +"X-Poedit-KeywordsList: _;gettext;gettext_noop\n" +"X-Poedit-Basepath: .\n" +"Plural-Forms: s;\n" +"X-Poedit-SearchPath-0: ./../script\n" + +#: ../script/events.js:126 +msgid "eat meat" +msgstr "manger de la viande" + +#: ../script/events.js:146 +msgid "use meds" +msgstr "utiliser un médicament" + +#: ../script/events.js:456 +msgid "the {0} is dead." +msgstr "" + +#: ../script/events.js:474 +msgid "leave" +msgstr "partir" + +#: ../script/engine.js:20 +msgid "punches do more damage" +msgstr "les points font plus de dégats" + +#: ../script/engine.js:21 +msgid "learned to throw punches with purpose" +msgstr "appris à donner des coups de points avec un objectif" + +#: ../script/engine.js:24 +msgid "punches do even more damage." +msgstr "les coups de points font plus de dégats" + +#: ../script/engine.js:25 +msgid "learned to fight quite effectively without weapons" +msgstr "apprendre à se battre de façon efficace sans arme" + +#: ../script/engine.js:28 +msgid "punch twice as fast, and with even more force" +msgstr "frapper deux fois plus vite, et avec plus de force" + +#: ../script/engine.js:29 +msgid "learned to strike faster without weapons" +msgstr "appris à attaquer plus vite sans arme" + +#: ../script/engine.js:32 +msgid "melee weapons deal more damage" +msgstr "" + +#: ../script/engine.js:33 +msgid "learned to swing weapons with force" +msgstr "" + +#: ../script/engine.js:36 +msgid "go twice as far without eating" +msgstr "" + +#: ../script/engine.js:37 +msgid "learned how to ignore the hunger" +msgstr "" + +#: ../script/engine.js:40 +msgid "go twice as far without drinking" +msgstr "" + +#: ../script/engine.js:41 +msgid "learned to love the dry air" +msgstr "" + +#: ../script/engine.js:44 +msgid "dodge attacks more effectively" +msgstr "" + +#: ../script/engine.js:45 +msgid "learned to be where they're not" +msgstr "" + +#: ../script/engine.js:48 +msgid "land blows more often" +msgstr "" + +#: ../script/engine.js:49 +msgid "learned to predict their movement" +msgstr "" + +#: ../script/engine.js:52 +msgid "see farther" +msgstr "voir plus loin" + +#: ../script/engine.js:53 +msgid "learned to look ahead" +msgstr "" + +#: ../script/engine.js:56 +msgid "better avoid conflict in the wild" +msgstr "" + +#: ../script/engine.js:57 +msgid "learned how not to be seen" +msgstr "" + +#: ../script/engine.js:60 +msgid "restore more health when eating" +msgstr "" + +#: ../script/engine.js:61 +msgid "learned to make the most of food" +msgstr "" + +#: ../script/engine.js:103 ../script/engine.js:397 +msgid "lights off." +msgstr "lumières éteintes." + +#: ../script/engine.js:109 +msgid "restart." +msgstr "recommencer." + +#: ../script/engine.js:115 +msgid "share." +msgstr "partager." + +#: ../script/engine.js:121 +msgid "save." +msgstr "sauvegarder." + +#: ../script/engine.js:127 +msgid "app store." +msgstr "app store" + +#: ../script/engine.js:205 +msgid "Export / Import" +msgstr "Exporter/Importer" + +#: ../script/engine.js:208 +msgid "export or import save data, for backing up" +msgstr "exporter ou importer vos données de sauvegarde" + +#: ../script/engine.js:209 +msgid "or migrating computers" +msgstr "pour sauver votre partie ou changer d'ordinateur" + +#: ../script/engine.js:212 +msgid "export" +msgstr "exporter" + +#: ../script/engine.js:216 +msgid "import" +msgstr "importer" + +#: ../script/engine.js:220 +msgid "cancel" +msgstr "annuler" + +#: ../script/engine.js:226 +msgid "are you sure?" +msgstr "êtes vous sur ?" + +#: ../script/engine.js:227 +msgid "if the code is invalid, all data will be lost." +msgstr "si le code est incorrect, toutes les données seront perdues." + +#: ../script/engine.js:228 +msgid "this is irreversible." +msgstr "Il n'y a pas de retour en arrière possible." + +#: ../script/engine.js:231 ../script/engine.js:292 +msgid "yes" +msgstr "oui" + +#: ../script/engine.js:236 ../script/engine.js:297 +msgid "no" +msgstr "non" + +#: ../script/engine.js:252 +msgid "Export" +msgstr "Exporter" + +#: ../script/engine.js:255 +msgid "save this." +msgstr "sauvegarder." + +#: ../script/engine.js:259 +msgid "got it" +msgstr "compris" + +#: ../script/engine.js:269 +msgid "put the save code here." +msgstr "copier le code ici." + +#: ../script/engine.js:286 +msgid "Restart?" +msgstr "Recommencer ?" + +#: ../script/engine.js:289 +msgid "restart the game?" +msgstr "recommencer la partie ?" + +#: ../script/engine.js:320 +msgid "Share" +msgstr "Partager" + +#: ../script/engine.js:323 +msgid "bring your friends." +msgstr "Invitez vos amis." + +#: ../script/engine.js:326 +msgid "facebook" +msgstr "facebook" + +#: ../script/engine.js:333 +msgid "google+" +msgstr "google+" + +#: ../script/engine.js:340 +msgid "twitter" +msgstr "twitter" + +#: ../script/engine.js:347 +msgid "reddit" +msgstr "reddit" + +#: ../script/engine.js:354 +msgid "close" +msgstr "fermer" + +#: ../script/engine.js:388 ../script/engine.js:392 +msgid "lights on." +msgstr "lumières allumées." + +#: ../script/outside.js:90 +msgid "scraps of fur" +msgstr "morceaux de fourrure" + +#: ../script/outside.js:95 +msgid "bits of meat" +msgstr "morceaux de viande" + +#: ../script/outside.js:100 +msgid "strange scales" +msgstr "écailles étranges" + +#: ../script/outside.js:105 +msgid "scattered teeth" +msgstr "tas de dents" + +#: ../script/outside.js:110 +msgid "tattered cloth" +msgstr "tas de vetements" + +#: ../script/outside.js:115 +msgid "a crudely made charm" +msgstr "un charme rudimentaire" + +#: ../script/outside.js:156 +msgid "gather wood" +msgstr "récoleter du bois" + +#: ../script/outside.js:173 +msgid "a stranger arrives in the night" +msgstr "Une étrangère arrive durant la nuit" + +#: ../script/outside.js:175 +msgid "a weathered family takes up in one of the huts." +msgstr "une famille épuisée s'intalle dans une hutte." + +#: ../script/outside.js:177 +msgid "a small group arrives, all dust and bones." +msgstr "un petit groupe arrive, sale et affamé." + +#: ../script/outside.js:179 +msgid "a convoy lurches in, equal parts worry and hope." +msgstr "un convoi arrive, plein de crainte et d'éspoir." + +#: ../script/outside.js:181 +msgid "the town's booming. word does get around." +msgstr "la ville s'agrandie, le mot se passe." diff --git a/lang/po2js.py b/lang/po2js.py new file mode 100755 index 0000000..c53a874 --- /dev/null +++ b/lang/po2js.py @@ -0,0 +1,58 @@ +#!/usr/bin/python +# +# convert .po to .js +# + +import json +import optparse +import os +import polib +import re +import string +import sys + +parser = optparse.OptionParser(usage="usage: %prog [options] pofile...") +parser.add_option("--callback", default="_.setTranslation", dest="callback", help="callback function to call with data") +parser.add_option("--quiet", action="store_false", default=True, dest="verbose", help="don't print status messages to stdout") + +(options, args) = parser.parse_args() + +if args == None or len(args) == 0: + print("ERROR: you must specify at least one po file to translate"); + sys.exit(1) + +paramFix = re.compile("(\\(([0-9])\\))") + +for srcfile in args: + + destfile = os.path.splitext(srcfile)[0] + ".js" + if options.verbose: + print("INFO: converting %s to %s" % (srcfile, destfile)) + + xlate_map = {} + + po = polib.pofile(srcfile, autodetect_encoding=False, encoding="utf-8", wrapwidth=-1) + for entry in po: + if entry.obsolete or entry.msgstr == '' or entry.msgstr == entry.msgid: + continue + + xlate_map[entry.msgid] = entry.msgstr; + + dest = open(destfile, "w") + + dest.write(options.callback); + dest.write("("); + + encoder = json.JSONEncoder() + + for part in encoder.iterencode(xlate_map): + if part.startswith('"function('): + dest.write(part[1:-1]); + else: + dest.write(part); + + dest.write(");\n") + + dest.close() + + diff --git a/lib/icu.js b/lib/icu.js new file mode 100644 index 0000000..f6e91ff --- /dev/null +++ b/lib/icu.js @@ -0,0 +1,23 @@ +(function() { + + var dfs = {"am_pm":["AM","PM"],"day_name":["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],"day_short":["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],"era":["av. J.-C.","ap. J.-C."],"era_name":["avant Jésus-Christ","après Jésus-Christ"],"month_name":["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],"month_short":["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],"order_full":"DMY","order_long":"DMY","order_medium":"DMY","order_short":"DMY"}; + var nfs = {"decimal_separator":",","grouping_separator":" ","minus":"-"}; + var df = {SHORT_PADDED_CENTURY:function(d){if(d){return(((d.getDate()+101)+'').substring(1)+'/'+((d.getMonth()+101)+'').substring(1)+'/'+d.getFullYear());}},SHORT:function(d){if(d){return(((d.getDate()+101)+'').substring(1)+'/'+((d.getMonth()+101)+'').substring(1)+'/'+(d.getFullYear()+'').substring(2));}},SHORT_NOYEAR:function(d){if(d){return(((d.getDate()+101)+'').substring(1)+'/'+((d.getMonth()+101)+'').substring(1));}},SHORT_NODAY:function(d){if(d){return(((d.getMonth()+101)+'').substring(1)+'/'+(d.getFullYear()+'').substring(2));}},MEDIUM:function(d){if(d){return(d.getDate()+' '+dfs.month_short[d.getMonth()]+' '+d.getFullYear());}},MEDIUM_NOYEAR:function(d){if(d){return(d.getDate()+' '+dfs.month_short[d.getMonth()]);}},MEDIUM_WEEKDAY_NOYEAR:function(d){if(d){return(dfs.day_short[d.getDay()]+' '+d.getDate()+' '+dfs.month_short[d.getMonth()]);}},LONG_NODAY:function(d){if(d){return(dfs.month_name[d.getMonth()]+' '+d.getFullYear());}},LONG:function(d){if(d){return(d.getDate()+' '+dfs.month_name[d.getMonth()]+' '+d.getFullYear());}},FULL:function(d){if(d){return(dfs.day_name[d.getDay()]+' '+d.getDate()+' '+dfs.month_name[d.getMonth()]+' '+d.getFullYear());}}}; + + window.icu = window.icu || new Object(); + var icu = window.icu; + + icu.getCountry = function() { return "" }; + icu.getCountryName = function() { return "" }; + icu.getDateFormat = function(formatCode) { var retVal = {}; retVal.format = df[formatCode]; return retVal; }; + icu.getDateFormats = function() { return df; }; + icu.getDateFormatSymbols = function() { return dfs; }; + icu.getDecimalFormat = function(places) { var retVal = {}; retVal.format = function(n) { var ns = n < 0 ? Math.abs(n).toFixed(places) : n.toFixed(places); var ns2 = ns.split('.'); s = ns2[0]; var d = ns2[1]; var rgx = /(\d+)(\d{3})/;while(rgx.test(s)){s = s.replace(rgx, '$1' + nfs["grouping_separator"] + '$2');} return (n < 0 ? nfs["minus"] : "") + s + nfs["decimal_separator"] + d;}; return retVal; }; + icu.getDecimalFormatSymbols = function() { return nfs; }; + icu.getIntegerFormat = function() { var retVal = {}; retVal.format = function(i) { var s = i < 0 ? Math.abs(i).toString() : i.toString(); var rgx = /(\d+)(\d{3})/;while(rgx.test(s)){s = s.replace(rgx, '$1' + nfs["grouping_separator"] + '$2');} return i < 0 ? nfs["minus"] + s : s;}; return retVal; }; + icu.getLanguage = function() { return "fr" }; + icu.getLanguageName = function() { return "français" }; + icu.getLocale = function() { return "fr" }; + icu.getLocaleName = function() { return "français" }; + +})(); \ No newline at end of file diff --git a/lib/translate.js b/lib/translate.js new file mode 100644 index 0000000..64e4c17 --- /dev/null +++ b/lib/translate.js @@ -0,0 +1,86 @@ +(function() { + + var translate = function(text) + { + var xlate = translateLookup(text); + + if (typeof xlate == "function") + { + xlate = xlate.apply(this, arguments); + } + else if (arguments.length > 1) + { + var aps = Array.prototype.slice; + var args = aps.call( arguments, 1 ); + + xlate = formatter(xlate, args); + } + + return xlate; + }; + + // I want it available explicity as well as via the object + translate.translate = translate; + + //from https://gist.github.com/776196 via http://davedash.com/2010/11/19/pythonic-string-formatting-in-javascript/ + var defaultFormatter = (function() { + var re = /\{([^}]+)\}/g; + return function(s, args) { + return s.replace(re, function(_, match){ return args[match]; }); + } + }()); + var formatter = defaultFormatter; + translate.setFormatter = function(newFormatter) + { + formatter = newFormatter; + }; + + translate.format = function() + { + var aps = Array.prototype.slice; + var s = arguments[0]; + var args = aps.call( arguments, 1 ); + + return formatter(s, args); + }; + + var dynoTrans = null; + translate.setDynamicTranslator = function(newDynoTrans) + { + dynoTrans = newDynoTrans; + }; + + var translation = null; + translate.setTranslation = function(newTranslation) + { + translation = newTranslation; + }; + + function translateLookup(target) + { + if (translation == null || target == null) + { + return target; + } + + if (target in translation == false) + { + if (dynoTrans != null) + { + return dynoTrans(target); + } + return target; + } + + var result = translation[target]; + if (result == null) + { + return target; + } + + return result; + }; + + window._ = translate; + +})();