Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Berry <bryan@olenepal.org>2010-03-12 12:30:27 (GMT)
committer Bryan Berry <bryan@olenepal.org>2010-03-12 12:30:27 (GMT)
commita9777c80c6e5040f40a4ffa83afec9c850944d33 (patch)
tree988c1c37ea2db577c8579a2e46e59d6b0ca1ee9d
parentcf8da1c07633324f23a7d26818bcdb87e60ec7ea (diff)
added example for testing i18n
-rwxr-xr-xexamples/6_Maths_matchingAnglesAndShapes/js/lesson.js25
-rw-r--r--i18n/BeautifulSoup-3.0.8/BeautifulSoup.pycbin0 -> 72448 bytes
-rw-r--r--i18n/example/foo.js7
-rw-r--r--i18n/example/foo.js~1
-rw-r--r--i18n/example/index.es.html11
-rw-r--r--i18n/example/messages.es.po44
-rw-r--r--i18n/example/messages.html.pot (copied from i18n/example/messages.po)2
-rw-r--r--i18n/example/messages.js.pot27
-rw-r--r--i18n/example/messages.mobin607 -> 1178 bytes
-rw-r--r--i18n/example/messages.pot31
-rw-r--r--i18n/example/tmp/index.es.html48
-rw-r--r--i18n/example/tmp/messages.es.po25
-rw-r--r--i18n/example/tmp/messages.mobin0 -> 607 bytes
-rw-r--r--i18n/example/tmp/messages.po (copied from i18n/example/messages.po)0
-rw-r--r--i18n/example/tmp/messages.pot (renamed from i18n/example/messages.po)2
-rwxr-xr-xi18n/example/ui.kFooter.js374
-rwxr-xr-xi18n/example/ui.kHeader.js237
-rwxr-xr-xi18n/example/ui.kHeader.js~237
18 files changed, 1047 insertions, 24 deletions
diff --git a/examples/6_Maths_matchingAnglesAndShapes/js/lesson.js b/examples/6_Maths_matchingAnglesAndShapes/js/lesson.js
index cd808a6..0fd84c6 100755
--- a/examples/6_Maths_matchingAnglesAndShapes/js/lesson.js
+++ b/examples/6_Maths_matchingAnglesAndShapes/js/lesson.js
@@ -43,7 +43,7 @@ function format(format_string /*, args*/) {
$(document).ready(function() {
-
+ var _ = $._;
var i = 0, j = 0, flag = 0;
var s=0, m=0, h=0;
var clickedObjects = []; //array storing the clicks of the two succesive clicks
@@ -58,14 +58,14 @@ $(document).ready(function() {
var restart = 0; //not restarted
var clickCounter = 0;
var NUM_OBJECTS = 24; //total number of objects in the game
- var shapes_angles = new Array('Acute-Angle','Right-Angle','Obtuse-Angle','Triangle','Square','Rhombus','Rectangle','Parallelogram','Pentagon','Hexagon','Septagon','Octagon','Acute-Angle','Right-Angle','Obtuse-Angle','Triangle','Square','Rhombus','Rectangle','Parallelogram','Pentagon','Hexagon','Septagon','Octagon');
+ var shapes_angles = new Array('Acute-Angle','Right-Angle','Obtuse-Angle','Triangle','Square','Rhombus','Rectangle','Parallelogram','Pentagon','Hexagon','Septagon','Octagon',_('Acute-Angle'),_('Right-Angle'),_('Obtuse-Angle'),_('Triangle'),_('Square'),_('Rhombus'),_('Rectangle'),_('Parallelogram'),_('Pentagon'),_('Hexagon'),_('Septagon'),_('Octagon'));
//var section = $('#section');
var $content = $('#content');
var shapes; //store the current shape or angle name
Karma.scaleWindow();
- $('#kHeader').kHeader({title:"Maths: Matching Angles with Shapes"});
+ $('#kHeader').kHeader({title:_("Maths: Matching Angles with Shapes")});
var $kFooter = $('#kFooter').kFooter({scoreboard: false, startButton: true,
pauseButton: true, restartButton: true, timer: true});
@@ -101,9 +101,21 @@ $(document).ready(function() {
play = 0;
$('#content').html('');
$('#content').append('<div id="gameOver">GAME OVER<br/>Congratulations!!!</div>');
- $('#content').append('<div id="gameOverInfo">You have completed the game in <span class="specialText">'+clickCounter+
- '</span> clicks within <span class="specialText">'+h+'</span> hour <span class="specialText">'+m+
- '</span> minutes and <span class="specialText">'+s+'</span> seconds .</div>');
+ /* $('#content').append($(document.createElement('div'))
+ .attr({id: 'gameOverInfo'})
+ // clicks < 2 is impossible
+ .html(format($.i18n.ngettext('You have completed the game in <span class="specialText">%d</span> clicks within <span class="specialText">%d</span> hour,',
+ 'You have completed the game in <span class="specialText">%d</span> clicks within <span class="specialText">%d</span> hours,',
+ h),
+ clickCounter, h)
+ + format($.i18n.ngettext('<span class="specialText">%d</span> minute and ',
+ '<span class="specialText">%d</span> minutes and ',
+ m),
+ m)
+ + format ($.i18n.ngettext('<span class="specialText">%d</span> second.',
+ '<span class="specialText">%d</span> seconds.',
+ s),
+ s))); */
}
};
@@ -246,4 +258,3 @@ $(document).ready(function() {
});//end of DOM
-
diff --git a/i18n/BeautifulSoup-3.0.8/BeautifulSoup.pyc b/i18n/BeautifulSoup-3.0.8/BeautifulSoup.pyc
new file mode 100644
index 0000000..e5165bb
--- /dev/null
+++ b/i18n/BeautifulSoup-3.0.8/BeautifulSoup.pyc
Binary files differ
diff --git a/i18n/example/foo.js b/i18n/example/foo.js
new file mode 100644
index 0000000..7a85c7f
--- /dev/null
+++ b/i18n/example/foo.js
@@ -0,0 +1,7 @@
+$(document).ready(function(){
+
+pgettext("$.ui.kHeader", "Lesson Plan");
+
+
+
+}); \ No newline at end of file
diff --git a/i18n/example/foo.js~ b/i18n/example/foo.js~
new file mode 100644
index 0000000..90ea59e
--- /dev/null
+++ b/i18n/example/foo.js~
@@ -0,0 +1 @@
+pgettext('$.ui.kHeader', "Lesson Plan"); \ No newline at end of file
diff --git a/i18n/example/index.es.html b/i18n/example/index.es.html
index 041b8ab..68401df 100644
--- a/i18n/example/index.es.html
+++ b/i18n/example/index.es.html
@@ -1,17 +1,18 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE HTML>
<html>
- <head>
+ <head>
+<meta charset="utf-8"/>
<title class="translate">
- Un Titulo en Castellano
+ Un Título en Inglés
</title>
</head>
<body>
<h1 class="translate">
- Un Encabezado en Castellano
+ Un Encabezado en Inglés
</h1>
<p>
<div class="someClass translate">
- Eso es un 'div' con <i>'markup'</i>.
+ Esto es un div con <i>marco upo</i>
</div>
<h1>
Instructions
diff --git a/i18n/example/messages.es.po b/i18n/example/messages.es.po
index e7f3d73..1ab3e2e 100644
--- a/i18n/example/messages.es.po
+++ b/i18n/example/messages.es.po
@@ -1,25 +1,53 @@
+# #-#-#-#-# messages.js.pot (PACKAGE VERSION) #-#-#-#-#
+# Spanish translations for PACKAGE package.
+# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# hitman <hitman@xiaopo>, 2010.
+#
+# #-#-#-#-# messages.html.pot (PACKAGE VERSION) #-#-#-#-#
# Spanish translations for PACKAGE package.
# Copyright (C) 2010 ORGANIZATION
-# Peter Gijsels <peter.gijsels@gmail.com>, 2010.
+# hitman <hitman@xiaopo>, 2010.
#
msgid ""
msgstr ""
+"#-#-#-#-# messages.js.pot (PACKAGE VERSION) #-#-#-#-#\n"
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2010-03-07 15:51+CET\n"
-"PO-Revision-Date: 2010-03-07 16:02+0100\n"
-"Last-Translator: Peter Gijsels <>\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-03-12 17:17+0545\n"
+"PO-Revision-Date: 2010-03-12 17:20+0545\n"
+"Last-Translator: hitman <hitman@xiaopo>\n"
"Language-Team: Spanish\n"
"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=ASCII\n"
+"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"#-#-#-#-# messages.html.pot (PACKAGE VERSION) #-#-#-#-#\n"
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2010-03-12 17:14+NPT\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: ENCODING\n"
"Generated-By: html2po.py 1.0\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+#: ui.kHeader.js:69
+msgctxt "$.ui.kHeader"
+msgid "Lesson Plan"
+msgstr "Plan de lección"
+
+#: ui.kHeader.js:77
+msgctxt "$.ui.kHeader"
+msgid "Teacher's Note"
+msgstr "Nota de profesora"
+
msgid "An English Header"
-msgstr "Un Encabezado en Castellano"
+msgstr "Un Encabezado en Inglés"
msgid "An English Title"
-msgstr "Un Titulo en Castellano"
+msgstr "Un Título en Inglés"
msgid "This is a div with <i>markup</i>."
-msgstr "Eso es un 'div' con <i>'markup'</i>."
+msgstr "Esto es un div con <i>marco upo</i>"
diff --git a/i18n/example/messages.po b/i18n/example/messages.html.pot
index 4c06dee..3e15eb1 100644
--- a/i18n/example/messages.po
+++ b/i18n/example/messages.html.pot
@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2010-03-07 16:25+CET\n"
+"POT-Creation-Date: 2010-03-12 17:14+NPT\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/i18n/example/messages.js.pot b/i18n/example/messages.js.pot
new file mode 100644
index 0000000..b390cc7
--- /dev/null
+++ b/i18n/example/messages.js.pot
@@ -0,0 +1,27 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-03-12 17:17+0545\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ui.kHeader.js:69
+msgctxt "$.ui.kHeader"
+msgid "Lesson Plan"
+msgstr ""
+
+#: ui.kHeader.js:77
+msgctxt "$.ui.kHeader"
+msgid "Teacher's Note"
+msgstr ""
diff --git a/i18n/example/messages.mo b/i18n/example/messages.mo
index d3d72bd..29a4591 100644
--- a/i18n/example/messages.mo
+++ b/i18n/example/messages.mo
Binary files differ
diff --git a/i18n/example/messages.pot b/i18n/example/messages.pot
index e614122..e3e7ae5 100644
--- a/i18n/example/messages.pot
+++ b/i18n/example/messages.pot
@@ -1,11 +1,30 @@
+# #-#-#-#-# messages.js.pot (PACKAGE VERSION) #-#-#-#-#
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+# #-#-#-#-# messages.html.pot (PACKAGE VERSION) #-#-#-#-#
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
+#, fuzzy
msgid ""
msgstr ""
+"#-#-#-#-# messages.js.pot (PACKAGE VERSION) #-#-#-#-#\n"
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2010-03-07 15:51+CET\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-03-12 17:17+0545\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+"#-#-#-#-# messages.html.pot (PACKAGE VERSION) #-#-#-#-#\n"
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2010-03-12 17:14+NPT\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -14,6 +33,15 @@ msgstr ""
"Content-Transfer-Encoding: ENCODING\n"
"Generated-By: html2po.py 1.0\n"
+#: ui.kHeader.js:69
+msgctxt "$.ui.kHeader"
+msgid "Lesson Plan"
+msgstr ""
+
+#: ui.kHeader.js:77
+msgctxt "$.ui.kHeader"
+msgid "Teacher's Note"
+msgstr ""
msgid "An English Header"
msgstr ""
@@ -23,4 +51,3 @@ msgstr ""
msgid "This is a div with <i>markup</i>."
msgstr ""
-
diff --git a/i18n/example/tmp/index.es.html b/i18n/example/tmp/index.es.html
new file mode 100644
index 0000000..041b8ab
--- /dev/null
+++ b/i18n/example/tmp/index.es.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+ <head>
+ <title class="translate">
+ Un Titulo en Castellano
+ </title>
+ </head>
+ <body>
+ <h1 class="translate">
+ Un Encabezado en Castellano
+ </h1>
+ <p>
+ <div class="someClass translate">
+ Eso es un 'div' con <i>'markup'</i>.
+ </div>
+ <h1>
+ Instructions
+ </h1>
+ To translate (part of) this page I followed these steps:
+ <ul>
+ <li>
+ I added a class "translate" to each html element that needs to be
+ translated.
+ </li>
+ <li>
+ I ran the script ../html2po.py to generate messages.po (this
+ xgettext(1) equivalent for html)
+ </li>
+ <li>
+ I moved messages.po to messages.pot
+ </li>
+ <li>
+ msginit -l es -i messages.pot -o messages.es.po
+ </li>
+ <li>
+ I added the Spanish translations to messages.es.po
+ </li>
+ <li>
+ msgfmt -i messages.es.po
+ </li>
+ <li>
+ ../translate-html.py -o index.es.html
+ </li>
+ </ul>
+ </p>
+ </body>
+</html>
+
diff --git a/i18n/example/tmp/messages.es.po b/i18n/example/tmp/messages.es.po
new file mode 100644
index 0000000..e7f3d73
--- /dev/null
+++ b/i18n/example/tmp/messages.es.po
@@ -0,0 +1,25 @@
+# Spanish translations for PACKAGE package.
+# Copyright (C) 2010 ORGANIZATION
+# Peter Gijsels <peter.gijsels@gmail.com>, 2010.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2010-03-07 15:51+CET\n"
+"PO-Revision-Date: 2010-03-07 16:02+0100\n"
+"Last-Translator: Peter Gijsels <>\n"
+"Language-Team: Spanish\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ASCII\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: html2po.py 1.0\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+msgid "An English Header"
+msgstr "Un Encabezado en Castellano"
+
+msgid "An English Title"
+msgstr "Un Titulo en Castellano"
+
+msgid "This is a div with <i>markup</i>."
+msgstr "Eso es un 'div' con <i>'markup'</i>."
diff --git a/i18n/example/tmp/messages.mo b/i18n/example/tmp/messages.mo
new file mode 100644
index 0000000..d3d72bd
--- /dev/null
+++ b/i18n/example/tmp/messages.mo
Binary files differ
diff --git a/i18n/example/messages.po b/i18n/example/tmp/messages.po
index 4c06dee..4c06dee 100644
--- a/i18n/example/messages.po
+++ b/i18n/example/tmp/messages.po
diff --git a/i18n/example/messages.po b/i18n/example/tmp/messages.pot
index 4c06dee..e614122 100644
--- a/i18n/example/messages.po
+++ b/i18n/example/tmp/messages.pot
@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2010-03-07 16:25+CET\n"
+"POT-Creation-Date: 2010-03-07 15:51+CET\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/i18n/example/ui.kFooter.js b/i18n/example/ui.kFooter.js
new file mode 100755
index 0000000..d280b79
--- /dev/null
+++ b/i18n/example/ui.kFooter.js
@@ -0,0 +1,374 @@
+/**
+* @fileOverview a footer widget
+* @author Bryan Berry <bryan@olenepal.org>
+* uses MIT License
+*/
+
+
+
+(function($){
+
+ // This is a dummy function, just here as placeholder to
+ // to make the jsdoc tool happy
+ /** @name $.ui.kFooter
+ * @namespace kFooter widget
+ * @example Emits the event kFooterWinGame when the maxScore is reached <br />
+ * Emits the event kFooterRestart when game restarted <br />
+ * Start button emits kFooterStart event when clicked <br />
+ * Restart button emits kFooterRestart event when clicked <br />
+ * Pause button emits the kFooterPause event when clicked <br />
+ */
+ $.ui.kFooter = function(){};
+
+ $.widget('ui.kFooter',
+ /** @lends $.ui.kFooter.prototype */
+ {
+ /** Gets the current score
+ * @returns {Number} current score
+ */
+ getScore : function(){
+ return this._getData('score');
+ },
+ /** Sets the current score
+ * @param {Number} newScore new score
+ */
+ setScore : function(newScore){
+ this._setData('score', parseInt(newScore));
+ this._refresh();
+ },
+ /** Gets the current total
+ * @returns {Number} current total
+ */
+ getTotal : function(){
+ return this._getData('total');
+ },
+ /** Sets the current total
+ * @param {Number} newTotal new total
+ */
+ setTotal : function(newTotal){
+ this._setData('total', parseInt(newTotal));
+ this._refresh();
+ },
+ /**
+ * Resets the score and total to initial values and triggers
+ * the "kFooterRestart" event
+ */
+ restart : function(){
+ this.element.trigger('kFooterRestart');
+ this._setData('score', this._getData('initialScore'));
+ this._setData('total', this._getData('initialTotal'));
+ this._refresh();
+ },
+ /** Increments the score by 1 or by the supplied numeric argument
+ * @param {Number} [val] increment value
+ */
+ inc : function(val){
+ var incVal = parseInt(val) || 1;
+ this._setData('score', this._getData('score') + incVal);
+ this._refresh();
+ if(this._getData('winScore') === this._getData('score')){
+ this.element.trigger('kFooterWinGame');
+ }
+ },
+ /** Increments the total by 1 or by the supplied numeric argument
+ * @param {Number} [val] increment value
+ */
+ incTotal : function(val){
+ var incVal = parseInt(val) || 1;
+ this._setData('total', this._getData('total') + incVal);
+ this._refresh();
+ },
+ /** Decrements the score by 1 or by the supplied numeric argument
+ * @param {Number} [val] decrement value
+ */
+ dec : function(val){
+ var decVal = parseInt(val) || 1;
+ this._setData('score', this._getData('score') - decVal);
+ this._refresh();
+ },
+ /** Decrements the total by 1 or by the supplied numeric argument
+ * @param {Number} [val] decrement value
+ */
+ decTotal : function(val){
+ var decVal = parseInt(val) || 1;
+ this._setData('total', this._getData('total') - decVal);
+ this._refresh();
+ },
+ /** Start the timer, defaults to 0:00 if no arguments supplied
+ * @param {Number} [minutes] value for minutes, default to 0
+ * @param {Number} [seconds] value for seconds, default to 0
+ */
+ startTimer : function(minutes, seconds){
+ var timerRunning = this._getData('timerRunning')|| false;
+
+ if (this._$timer && timerRunning === false){
+ var mins = minutes || 0;
+ var secs = seconds || 0;
+ var timerId = null;
+ var self = this;
+
+
+ this._setData('mins', mins);
+ this._setData('secs', secs);
+
+ var addLeadingZero = function(num){
+ if(''.concat(num).length === 1){
+ return "0".concat(num);
+ } else {
+ return num;
+ }
+
+ };
+
+ var increaseTimer = function(){
+ if (self._getData('timerRunning') === false){
+ return;
+ }
+
+ var s = self._getData('secs') + 1;
+ var m = null;
+ var timerId = null;
+
+ if (s < 60) {
+ self._setData('secs', s);
+ self._$timerSecs.text(self._n(addLeadingZero(s)));
+ } else {
+ s = 0;
+ m = self._getData('mins') + 1;
+ self._$timerSecs.text(self._n(addLeadingZero(s)));
+ self._$timerMins.text(self._n(addLeadingZero(m)));
+ self._setData('secs', s);
+ self._setData('mins', m);
+ }
+
+ timerId = setTimeout(increaseTimer, 1000);
+ self._setData('timerId', timerId);
+
+ };
+
+ timerId = setTimeout(increaseTimer , 1000);
+
+ this._setData('timerRunning', true);
+ this._setData('timerId', timerId);
+ }
+ },
+ /** Stop the timer
+ */
+ stopTimer : function(){
+ this._setData('timerRunning', false);
+ },
+ pgettext : function(context, msg){
+ if($.i18n){
+ return $.i18n.pgettext(context, msg);
+ }
+ return msg;
+ },
+ _n : function(val, loc){
+ if ($.i18n){
+ return $._n(val, loc);
+ }
+ return val;
+ },
+ _init : function(){
+
+ var divDisplay = "inline";
+ var score = this.options.score;
+ var total = this.options.total;
+ var self = this;
+
+ var options = $.extend({}, $.ui.kFooter.defaults, this.options);
+
+ this._setData('initialScore', parseInt(options.score));
+ this._setData('initialTotal', parseInt(options.total));
+ this._setData('score', parseInt(options.score));
+ this._setData('total', parseInt(options.total));
+ this._setData('winScore', parseInt(options.winningScore));
+ this._setData('locale', options.locale);
+
+
+ this.element.addClass('ui-widget ui-widget-content ' +
+ ' ui-kFooter');
+
+
+ var $kFooter = $("<ul></ul>");
+
+
+ if(options.scoreboard === true){
+
+ var $scoreboard = $("<li class='left'>" +
+ this.pgettext('$.ui.kFooter', "Score") +
+ "</li>" + "<li class='left'>" +
+ "<span id='kFooterScore' class='ui-corner-all number'>" +
+ this._n(score) + "</span></li>" +
+ "<li class='left'>" +
+ this.pgettext('$.ui.kFooter', "Total") + "</li>" +
+ "<li class='left'><span id='kFooterTotal' " +
+ "class='ui-corner-all number'>" +
+ this._n(total) + "</span></li>")
+ .appendTo($kFooter);
+
+ this._score = $('#kFooterScore', $scoreboard);
+ this._total = $('#kFooterTotal', $scoreboard);
+
+ }
+
+ if(options.timer === true){
+ this._$timer = $("<li class='left'>" +
+ this.pgettext('$.ui.kFooter', "Timer") +
+ "</li>" +
+ "<li class='left'><span id='kFooterMins'" +
+ "class='ui-corner-all" +
+ " number timer'>" + this._n("00") +
+ "</span></li>" +
+ "<li class='left'><span id='kFooterSecs'" +
+ "class='ui-corner-all " +
+ "number timer'>"+ this._n("00") +
+ "</span></li>")
+ .appendTo($kFooter);
+
+ this._$timerMins = $('#kFooterMins', this._$timer);
+ this._$timerSecs = $('#kFooterSecs', this._$timer);
+ }
+
+ //if options.checkAnswerBtn === true
+
+ if (options.restartButton === true){
+ var $restartButton = $("<li class='right'><button " +
+ "class='ui-corner-all ui-state-default'>" +
+ "<span class='ui-icon ui-icon-arrowrefresh-1-w'>" +
+ "</span>" +
+ "<span class='text left'>" +
+ this.pgettext('$.ui.kFooter', 'Play Again') +
+ "</span></button></li>")
+ .click(function(){
+ self.startTimer();
+ self.restart();
+ })
+ .appendTo($kFooter);
+ }
+
+ if (options.pauseButton === true){
+ var $pauseButton = $("<li class='right'><button " +
+ "class='ui-corner-all ui-state-default'>" +
+ "<span class='ui-icon ui-icon-pause'>" +
+ "</span>" +
+ "<span class='text left'>" +
+ this.pgettext('$.ui.kFooter', 'Pause') +
+ "</span></button></li>")
+ .click(function(){
+ self.stopTimer();
+ self.element.trigger('kFooterPause');
+ })
+ .appendTo($kFooter);
+ }
+
+ if (options.startButton === true){
+ var $startButton = $("<li class='right'><button " +
+ "class='ui-corner-all ui-state-default'>" +
+ "<span class='ui-icon ui-icon-play'>" +
+ "</span>" +
+ "<span class='text left'>" +
+ this.pgettext('$.ui.kFooter', 'Start') +
+ "</span></button></li>")
+ .click(function(){
+ self.startTimer();
+ self.element.trigger('kFooterStart');
+ })
+ .appendTo($kFooter);
+ }
+
+ $('button', $kFooter).hover(
+ function(){
+ $(this).addClass("ui-state-hover");
+ },
+ function(){
+ $(this).removeClass("ui-state-hover");
+ });
+
+
+ // Check if any html w/in this.element, if so wrap it in <li> </li>
+ // and add to $kFooter later
+ var $userHtml = this.element
+ .children()
+ .appendTo($kFooter);
+
+
+ $userHtml.wrap('<li class="left"></li>');
+
+ //get rid of userHtml
+ this.element.empty();
+
+ this.element.append($kFooter);
+
+ },
+ _refresh : function(){
+ this._score.text(this._n(this._getData('score')));
+ this._total.text(this._n(this._getData('total')));
+ },
+ /** Removes the kFooter widget and all related data from the DOM */
+ destroy : function(){
+ this.element.remove();
+ $.widget.prototype.destroy.apply(this, arguments);
+ }
+
+
+ });
+
+ $.ui.kFooter.getter = ['getScore', 'getTotal', '_n', '_' ];
+
+ $.ui.kFooter.i18n = {};
+
+
+ /** Default settings for the kFooter widget
+ * @namespace Default settings for the kFooter widget
+ * @extends $.ui.kFooter
+ */
+ $.ui.kFooter.defaults = {
+ /** Initial score
+ * @type Number
+ * @default 0
+ */
+ score: 0,
+ /** Initial total
+ * @type Number
+ * @default 0
+ */
+ total: 0,
+ /** The score that will win the game
+ * @type Number
+ * @default 0
+ */
+ winningScore: 0,
+ /** Default locale, valid options are "en" and "ne"
+ * @type String
+ * @default "en"
+ */
+ locale: "ne",
+ /** Display the scoreboard
+ * @type boolean
+ * @default true
+ */
+ scoreboard: true,
+ /** Display the Start Button
+ * @type boolean
+ * @default false
+ */
+ startButton: false,
+ /** Display the Retart Button
+ * @type boolean
+ * @default true
+ */
+ restartButton: true,
+ /** Display the Pause Button
+ * @type boolean
+ * @default false
+ */
+ pauseButton: false,
+ /** Display the timer
+ * @type boolean
+ * @default false
+ */
+ timer: false
+ };
+
+ })(jQuery); \ No newline at end of file
diff --git a/i18n/example/ui.kHeader.js b/i18n/example/ui.kHeader.js
new file mode 100755
index 0000000..38279e6
--- /dev/null
+++ b/i18n/example/ui.kHeader.js
@@ -0,0 +1,237 @@
+/**
+* @fileOverview a Header widget
+* @author Bryan Berry <bryan@olenepal.org>
+* uses MIT License
+*/
+
+
+
+(function($){
+
+ // This is a dummy function, just here as placeholder to
+ // to make the jsdoc tool happy
+ /** @name $.ui.kHeader
+ * @namespace kHeader widget
+ * @example
+ */
+ $.ui.kHeader = function(){};
+
+ $.widget('ui.kHeader',
+ /** @lends $.ui.kHeader.prototype */
+ { pgettext : function(context, msg){
+ if($.i18n){
+ return $.i18n.pgettext(context, msg);
+ }
+ return msg;
+ },
+ _n : function(val, loc){
+ if ($.i18n){
+ return $._n(val, loc);
+ }
+ return val;
+ },
+
+ _init : function(){
+ var options = $.extend({}, $.ui.kHeader.defaults, this.options);
+
+ this.element.addClass('ui-widget ui-widget-content');
+
+ var $kHeader = $("<ul></ul>");
+
+ var backLink = "#";
+ var urlParams = window.location.search.slice(1).split('&');
+ if (urlParams){
+ backLink = urlParams[0].split('=')[1];
+ }
+
+ var $backBtn = $("<li class='left'> <a href='" + backLink +
+ "' class='kHeader-btn kHeader-back'></a></li>")
+ .appendTo($kHeader);
+
+ var $lessonTitle = $("<li class='left kHeader-title'>" +
+ "<span>" + options.title +
+ "</span></li>")
+ .appendTo($kHeader);
+
+
+
+ if (options.lessonPlan || options.teacherNote){
+
+ var $dropDownArrow = $("<span class='kHeader-kDoc right'>" +
+ "</span>")
+ .appendTo($lessonTitle);
+
+ var $dropDownArea = $("<div class='drop-down'></div>");
+
+ if (options.lessonPlan){
+ $("<div>" +
+ "<a href='./kDoc.html?back=index.html&doc=lessonPlan'>" +
+ pgettext("$.ui.kHeader", "Lesson Plan") +
+ "</a></div>")
+ .appendTo($dropDownArea);
+ }
+
+ if (options.teachersNote){
+ $("<div>" +
+ "<a href='./kDoc.html?back=index.html&doc=teachersNote'>" +
+ pgettext("$.ui.kHeader", "Teacher's Note") +
+ "</a></div>")
+ .appendTo($dropDownArea);
+ }
+
+ $dropDownArea.appendTo($dropDownArrow);
+
+ $dropDownArrow.hover(
+ function(){
+ $dropDownArea.show();
+ },
+ function(){
+ $dropDownArea.hide();
+ }
+ );
+
+ }
+
+ if(options.zoom === true){
+
+ var iframeScale = 1.0;
+ var translateY = 0;
+ var getIframeStyle = function(){
+ return window.frames[0].document.body.style;
+ };
+
+ var zoomIn = function(){
+ var iframeStyle = getIframeStyle();
+ iframeScale = iframeScale + 0.1;
+ translateY = translateY + 50;
+ var scale = 'scale(' + iframeScale + ')';
+ var translate = "translate(0px, " + translateY + "px)";
+
+ iframeStyle.MozTransform = scale + ' ' + translate;
+ iframeStyle.WebkitTransform = scale + ' ' + translate;
+ };
+
+ var zoomOut = function(){
+ var iframeStyle = getIframeStyle();
+ iframeScale = iframeScale - 0.1;
+ translateY = translateY - 50;
+
+ var scale = 'scale(' + iframeScale + ')';
+ var translate = "translate(0px, " + translateY + "px)";
+
+
+ iframeStyle.MozTransform = scale + ' ' + translate;
+ iframeStyle.WebkitTransform = scale + ' ' + translate;
+
+ };
+
+ $("<li class='left kHeader-zoomIn kHeader-btn'>" +
+ " </li>")
+ .click(zoomIn)
+ .appendTo($kHeader);
+
+ $("<li class='left kHeader-zoomOut " +
+ "kHeader-btn'> </li>")
+ .click(zoomOut)
+ .appendTo($kHeader);
+ }
+
+
+
+ if($('#' + options.help).length){
+ if($.ui.dialog){
+ var $help = $('#'+ options.help)
+ .dialog({
+ position:[ "right", "top"],
+ modal:'true',autoOpen:false,width:500,
+ height: 400,
+ dialogClass: 'kHeader-help'
+ });
+ } else {
+
+ if(console){
+ console.log("You need to add the jQuery UI dialog" +
+ " widget in order to use Help feature.");
+ }
+ }
+
+ }
+
+ $("<li class='right'> <a href='#'" +
+ "' class='kHeader-btn kHeader-help'></a></li>")
+ .click(function(){
+ if($.ui.dialog && $help){
+ $help.dialog('open');
+ }
+ })
+ .appendTo($kHeader);
+
+
+ $("<li class='right'> <a href='http://olenepal.org'" +
+ "' class='kHeader-btn kHeader-brand'" +
+ "title='साझा शिक्षा ई-पाटी'></a></li>")
+ .appendTo($kHeader);
+
+ this.element.append($kHeader);
+
+ //0-width divs that hold hover imgs for pre-loading
+ var $preloadImgDivs = $("<div class='kHeader-preload-img " +
+ "kHeader-preload-back'></div>" +
+ "<div class='kHeader-preload-img " +
+ "kHeader-preload-zoom-in'></div>" +
+ "<div class='kHeader-preload-img " +
+ "kHeader-preload-zoom-out'></div>" +
+ "<div class='kHeader-preload-img " +
+ "kHeader-preload-ole'></div>" +
+ "<div class='kHeader-preload-img " +
+ "kHeader-preload-help'></div>"
+ )
+ .appendTo($kHeader);
+
+ },
+ /** Removes the kHeader widget and all related data from the DOM */
+ destroy : function(){
+ this.element.remove();
+ $.widget.prototype.destroy.apply(this, arguments);
+ }
+
+
+ });
+
+ $.ui.kHeader.getter = [];
+
+ $.ui.kHeader.i18n = {};
+
+ /** Default settings for the kHeader widget
+ * @namespace Default settings for the kHeader widget
+ * @extends $.ui.kHeader
+ */
+ $.ui.kHeader.defaults = {
+ /** title
+ * @type String
+ * @default ""
+ */
+ title: "",
+ /** Turns on zoom buttons
+ * @type boolean
+ * @default false
+ */
+ zoom: false,
+ /** Creates drop-down with link to lesson plan
+ * @type boolean or string file path to lesson plan
+ * @default false
+ */
+ lessonPlan: false,
+ /** Creates drop-down with link to teachersNote
+ * @type boolean or string file path to teachersNote
+ * @default false
+ */
+ teachersNote: false,
+ /** Id of element containing help text
+ * @type String
+ * @default "kHelp"
+ */
+ help: "kHelp"
+ };
+
+ })(jQuery); \ No newline at end of file
diff --git a/i18n/example/ui.kHeader.js~ b/i18n/example/ui.kHeader.js~
new file mode 100755
index 0000000..1360710
--- /dev/null
+++ b/i18n/example/ui.kHeader.js~
@@ -0,0 +1,237 @@
+/**
+* @fileOverview a Header widget
+* @author Bryan Berry <bryan@olenepal.org>
+* uses MIT License
+*/
+
+
+
+(function($){
+
+ // This is a dummy function, just here as placeholder to
+ // to make the jsdoc tool happy
+ /** @name $.ui.kHeader
+ * @namespace kHeader widget
+ * @example
+ */
+ $.ui.kHeader = function(){};
+
+ $.widget('ui.kHeader',
+ /** @lends $.ui.kHeader.prototype */
+ { pgettext : function(context, msg){
+ if($.i18n){
+ return $.i18n.pgettext(context, msg);
+ }
+ return msg;
+ },
+ _n : function(val, loc){
+ if ($.i18n){
+ return $._n(val, loc);
+ }
+ return val;
+ },
+
+ _init : function(){
+ var options = $.extend({}, $.ui.kHeader.defaults, this.options);
+
+ this.element.addClass('ui-widget ui-widget-content');
+
+ var $kHeader = $("<ul></ul>");
+
+ var backLink = "#";
+ var urlParams = window.location.search.slice(1).split('&');
+ if (urlParams){
+ backLink = urlParams[0].split('=')[1];
+ }
+
+ var $backBtn = $("<li class='left'> <a href='" + backLink +
+ "' class='kHeader-btn kHeader-back'></a></li>")
+ .appendTo($kHeader);
+
+ var $lessonTitle = $("<li class='left kHeader-title'>" +
+ "<span>" + options.title +
+ "</span></li>")
+ .appendTo($kHeader);
+
+
+
+ if (options.lessonPlan || options.teacherNote){
+
+ var $dropDownArrow = $("<span class='kHeader-kDoc right'>" +
+ "</span>")
+ .appendTo($lessonTitle);
+
+ var $dropDownArea = $("<div class='drop-down'></div>");
+
+ if (options.lessonPlan){
+ $("<div>" +
+ "<a href='./kDoc.html?back=index.html&doc=lessonPlan'>" +
+ this.pgettext('$.ui.kHeader', "Lesson Plan") +
+ "</a></div>")
+ .appendTo($dropDownArea);
+ }
+
+ if (options.teachersNote){
+ $("<div>" +
+ "<a href='./kDoc.html?back=index.html&doc=teachersNote'>" +
+ this.pgettext('$.ui.kHeader', "Teacher's Note") +
+ "</a></div>")
+ .appendTo($dropDownArea);
+ }
+
+ $dropDownArea.appendTo($dropDownArrow);
+
+ $dropDownArrow.hover(
+ function(){
+ $dropDownArea.show();
+ },
+ function(){
+ $dropDownArea.hide();
+ }
+ );
+
+ }
+
+ if(options.zoom === true){
+
+ var iframeScale = 1.0;
+ var translateY = 0;
+ var getIframeStyle = function(){
+ return window.frames[0].document.body.style;
+ };
+
+ var zoomIn = function(){
+ var iframeStyle = getIframeStyle();
+ iframeScale = iframeScale + 0.1;
+ translateY = translateY + 50;
+ var scale = 'scale(' + iframeScale + ')';
+ var translate = "translate(0px, " + translateY + "px)";
+
+ iframeStyle.MozTransform = scale + ' ' + translate;
+ iframeStyle.WebkitTransform = scale + ' ' + translate;
+ };
+
+ var zoomOut = function(){
+ var iframeStyle = getIframeStyle();
+ iframeScale = iframeScale - 0.1;
+ translateY = translateY - 50;
+
+ var scale = 'scale(' + iframeScale + ')';
+ var translate = "translate(0px, " + translateY + "px)";
+
+
+ iframeStyle.MozTransform = scale + ' ' + translate;
+ iframeStyle.WebkitTransform = scale + ' ' + translate;
+
+ };
+
+ $("<li class='left kHeader-zoomIn kHeader-btn'>" +
+ " </li>")
+ .click(zoomIn)
+ .appendTo($kHeader);
+
+ $("<li class='left kHeader-zoomOut " +
+ "kHeader-btn'> </li>")
+ .click(zoomOut)
+ .appendTo($kHeader);
+ }
+
+
+
+ if($('#' + options.help).length){
+ if($.ui.dialog){
+ var $help = $('#'+ options.help)
+ .dialog({
+ position:[ "right", "top"],
+ modal:'true',autoOpen:false,width:500,
+ height: 400,
+ dialogClass: 'kHeader-help'
+ });
+ } else {
+
+ if(console){
+ console.log("You need to add the jQuery UI dialog" +
+ " widget in order to use Help feature.");
+ }
+ }
+
+ }
+
+ $("<li class='right'> <a href='#'" +
+ "' class='kHeader-btn kHeader-help'></a></li>")
+ .click(function(){
+ if($.ui.dialog && $help){
+ $help.dialog('open');
+ }
+ })
+ .appendTo($kHeader);
+
+
+ $("<li class='right'> <a href='http://olenepal.org'" +
+ "' class='kHeader-btn kHeader-brand'" +
+ "title='साझा शिक्षा ई-पाटी'></a></li>")
+ .appendTo($kHeader);
+
+ this.element.append($kHeader);
+
+ //0-width divs that hold hover imgs for pre-loading
+ var $preloadImgDivs = $("<div class='kHeader-preload-img " +
+ "kHeader-preload-back'></div>" +
+ "<div class='kHeader-preload-img " +
+ "kHeader-preload-zoom-in'></div>" +
+ "<div class='kHeader-preload-img " +
+ "kHeader-preload-zoom-out'></div>" +
+ "<div class='kHeader-preload-img " +
+ "kHeader-preload-ole'></div>" +
+ "<div class='kHeader-preload-img " +
+ "kHeader-preload-help'></div>"
+ )
+ .appendTo($kHeader);
+
+ },
+ /** Removes the kHeader widget and all related data from the DOM */
+ destroy : function(){
+ this.element.remove();
+ $.widget.prototype.destroy.apply(this, arguments);
+ }
+
+
+ });
+
+ $.ui.kHeader.getter = [];
+
+ $.ui.kHeader.i18n = {};
+
+ /** Default settings for the kHeader widget
+ * @namespace Default settings for the kHeader widget
+ * @extends $.ui.kHeader
+ */
+ $.ui.kHeader.defaults = {
+ /** title
+ * @type String
+ * @default ""
+ */
+ title: "",
+ /** Turns on zoom buttons
+ * @type boolean
+ * @default false
+ */
+ zoom: false,
+ /** Creates drop-down with link to lesson plan
+ * @type boolean or string file path to lesson plan
+ * @default false
+ */
+ lessonPlan: false,
+ /** Creates drop-down with link to teachersNote
+ * @type boolean or string file path to teachersNote
+ * @default false
+ */
+ teachersNote: false,
+ /** Id of element containing help text
+ * @type String
+ * @default "kHelp"
+ */
+ help: "kHelp"
+ };
+
+ })(jQuery); \ No newline at end of file