Skip to content
Browse files

Source documentation.

  • Loading branch information...
1 parent edc0e59 commit 2d157b036d0966f531420fbfb60482c33fb3a570 @akoenig committed Oct 22, 2011
Showing with 15 additions and 10 deletions.
  1. +4 −3 lib/lingua.js
  2. +11 −7 lib/trainee.js
View
7 lib/lingua.js
@@ -16,7 +16,7 @@ module.exports = function(app, options) {
var _name = 'lingua';
//
- // DOCME
+ // The lingua configuration object.
//
var configuration = {
storage: {
@@ -58,11 +58,12 @@ module.exports = function(app, options) {
}
//
- // DOCME
+ // Creating the mighty guru object which knows everything.
//
var guru = new Guru(configuration);
+
//
- // DOCME
+ // Creating the trainee object which is like a helper for the guru.
//
var trainee = new Trainee(configuration);
View
18 lib/trainee.js
@@ -18,10 +18,11 @@ module.exports = function() {
//
// summary:
- // DOCME
+ // The trainee object.
//
// description:
- // DOCME
+ // The trainee is a helper which provides methods for determining
+ // the locales from a given HTTP request header, a cookie and an url query.
//
var Trainee = function(configuration) {
var that = this;
@@ -34,10 +35,13 @@ module.exports = function() {
//
// summary:
- // DOCME
+ // Helper function for extracting the locaes the out of an header.
//
// description:
- // DOCME
+ // Here we parse the HTTP request headers and extract all language
+ // tags with the given quality value.
+ //
+ // See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4
//
this._extractLocales = function(headers) {
var locales = [];
@@ -111,7 +115,7 @@ module.exports = function() {
var cookie = cookies.get(this.configuration.storage.key);
//
- // DOCME
+ // The determined locales which the user has configured.
//
var locales = [];
@@ -128,10 +132,10 @@ module.exports = function() {
//
// summary:
- // DOCME
+ // Persists the given locale.
//
// description:
- // DOCME
+ // Creates a cookie and persists the given locale in it.
//
Trainee.prototype.persistCookie = function(req, res, locale) {
var cookies = new Cookies(req, res);

0 comments on commit 2d157b0

Please sign in to comment.
Something went wrong with that request. Please try again.