o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1340996346.2810721: @value"•a{I" class:EFI"BundledAsset;FI"logical_path;FI"i18n/translations.js;FI" pathname;FI"q/Users/paul/.rvm/gems/ruby-1.9.3-p194/gems/i18n-js-3.0.0.rc2/app/assets/javascripts/i18n/translations.js.erb;FI"content_type;FI"application/javascript;FI" mtime;FI"2012-06-29T14:52:23-04:00;FI" length;FiŸ_I" digest;F"%319a5a2d2a45a987700a5b2069def5f1I" source;FI"Ÿ_// I18n.js // ======= // // This small library provides the Rails I18n API on the Javascript. // You don't actually have to use Rails (or even Ruby) to use I18n.js. // Just make sure you export all translations in an object like this: // // I18n.translations.en = { // hello: "Hello World" // }; // // See tests for specific formatting like numbers and dates. // ;(function(I18n){ "use strict"; I18n.reset = function() { // Set default locale. This locale will be used when fallback is enabled and // the translation doesn't exist in a particular locale. this.defaultLocale = "en"; // Set the current locale to `en`. this.locale = "en"; // Set the translation key separator. this.defaultSeparator = "."; // Set the placeholder format. Accepts `{{placeholder}}` and `%{placeholder}`. this.placeholder = /(?:\{\{|%\{)(.*?)(?:\}\}?)/gm; // Set if engine should fallback to the default locale when a translation // is missing. this.fallbacks = false; // Set the default translation object. this.translations = {}; }; // Return a list of all locales that must be tried before returning the // missing translation message. By default, this will consider the inline option, // current locale and fallback locale. // // I18n.locales.get("de-DE"); // // ["de-DE", "de", "en"] // // You can define custom rules for any locale. Just make sure you return a array // containing all locales. // // // Default the Wookie locale to English. // I18n.locales["wk"] = function(locale) { // return ["en"]; // }; // I18n.locales = {}; // Retrieve locales based on inline locale, current locale or default to // I18n's detection. I18n.locales.get = function(locale) { var result = this[locale] || this[I18n.locale] || this["default"]; if (typeof(result) === "function") { result = result(locale); } if (result instanceof Array === false) { result = [result]; } return result; }; // The default locale list. I18n.locales["default"] = function(locale) { var locales = [] , list = [] , countryCode , count ; // Handle the inline locale option that can be provided to // the `I18n.t` options. if (locale) { locales.push(locale); } // Add the current locale to the list. if (!locale && I18n.locale) { locales.push(I18n.locale); } // Add the default locale if fallback strategy is enabled. if (I18n.fallbacks && I18n.defaultLocale) { locales.push(I18n.defaultLocale); } // Compute each locale with its country code. // So this will return an array containing both // `de-DE` and `de` locales. locales.forEach(function(locale){ countryCode = locale.split("-")[0]; if (!~list.indexOf(locale)) { list.push(locale); } if (I18n.fallbacks && countryCode && countryCode !== locale && !~list.indexOf(countryCode)) { list.push(countryCode); } }); // No locales set? English it is. if (!locales.length) { locales.push("en"); } return list; }; // // I18n.pluralization = {}; // Return the pluralizer for a specific locale. // If no specify locale is found, then I18n's default will be used. I18n.pluralization.get = function(locale) { return this[locale] || this[I18n.locale] || this["default"]; }; // The default pluralizer rule. // It detects the `zero`, `one`, and `other` scopes. I18n.pluralization["default"] = function(count) { switch (count) { case 0: return ["zero", "other"]; case 1: return ["one"]; default: return ["other"]; } }; // Reset all default attributes. This is specially useful // while running tests. I18n.reset(); // Return current locale. If no locale has been set, then // the current locale will be the default locale. I18n.currentLocale = function() { return this.locale || this.defaultLocale; }; // Check if value is different than undefined and null; I18n.isSet = function(value) { return value !== undefined && value !== null; }; // Find and process the translation using the provided scope and options. // This is used internally by some functions and should not be used as an // public API. I18n.lookup = function(scope, options) { options = this.prepareOptions(options); var locales = this.locales.get(options.locale) , requestedLocale = locales[0] , locale , scopes , translations ; while (locales.length) { locale = locales.shift(); scopes = scope.split(this.defaultSeparator); translations = this.translations[locale]; if (!translations) { continue; } while (scopes.length) { translations = translations[scopes.shift()]; if (!translations) { break; } } if (translations) { return translations; } } if (this.isSet(options.defaultValue)) { return options.defaultValue; } }; // Merge serveral hash options, checking if value is set before // overwriting any value. The precedence is from left to right. // // I18n.prepareOptions({name: "John Doe"}, {name: "Mary Doe", role: "user"}); // #=> {name: "John Doe", role: "user"} // I18n.prepareOptions = function() { var args = Array.prototype.slice.call(arguments) , options = {} ; for (var i = 0, count = args.length; i < count; i++) { var o = args.shift(); if (typeof(o) != "object") { continue; } for (var attr in o) { if (!o.hasOwnProperty(attr)) { continue; } if (this.isSet(options[attr])) { continue; } options[attr] = o[attr]; } } return options; }; // Translate the given scope with the provided options. I18n.translate = function(scope, options) { options = this.prepareOptions(options); var translation = this.lookup(scope, options); if (!translation) { return this.missingTranslation(scope); } if (typeof(translation) === "string") { translation = this.interpolate(translation, options); } else if (translation instanceof Object && this.isSet(options.count)) { translation = this.pluralize(options.count, translation, options); } return translation; }; // This function interpolates the all variables in the given message. I18n.interpolate = function(message, options) { options = this.prepareOptions(options); var matches = message.match(this.placeholder) , placeholder , value , name , regex ; if (!matches) { return message; } while (matches.length) { placeholder = matches.shift(); name = placeholder.replace(this.placeholder, "$1"); value = options[name]; if (!this.isSet(options[name])) { value = "[missing " + placeholder + " value]"; } regex = new RegExp(placeholder.replace(/\{/gm, "\\{").replace(/\}/gm, "\\}")); message = message.replace(regex, value); } return message; }; // Pluralize the given scope using the `count` value. // The pluralized translation may have other placeholders, // which will be retrieved from `options`. I18n.pluralize = function(count, scope, options) { options = this.prepareOptions(options); var translations, pluralizer, keys, key, message; if (scope instanceof Object) { translations = scope; } else { translations = this.lookup(scope, options); } if (!translations) { return this.missingTranslation(scope); } pluralizer = this.pluralization.get(options.locale); keys = pluralizer(Math.abs(count)); while (keys.length) { key = keys.shift(); if (this.isSet(translations[key])) { message = translations[key]; break; } } options.count = String(count); return this.interpolate(message, options); }; // Return a missing translation message for the given parameters. I18n.missingTranslation = function(scope) { var message = '[missing "' + this.currentLocale(); for (var i = 0; i < arguments.length; i++) { message += "." + arguments[i]; } message += '" translation]'; return message; }; // Format number using localization rules. // The options will be retrieved from the `number.format` scope. // If this isn't present, then the following options will be used: // // - `precision`: `3` // - `separator`: `"."` // - `delimiter`: `","` // - `strip_insignificant_zeros`: `false` // // You can also override these options by providing the `options` argument. // I18n.toNumber = function(number, options) { options = this.prepareOptions( options, this.lookup("number.format"), {precision: 3, separator: ".", delimiter: ",", strip_insignificant_zeros: false} ); var negative = number < 0 , string = Math.abs(number).toFixed(options.precision).toString() , parts = string.split(".") , precision , buffer = [] , formattedNumber ; number = parts[0]; precision = parts[1]; while (number.length > 0) { buffer.unshift(number.substr(Math.max(0, number.length - 3), 3)); number = number.substr(0, number.length -3); } formattedNumber = buffer.join(options.delimiter); if (options.precision > 0) { formattedNumber += options.separator + parts[1]; } if (negative) { formattedNumber = "-" + formattedNumber; } if (options.strip_insignificant_zeros) { var regex = { separator: new RegExp(options.separator.replace(/\./, "\\.") + "$") , zeros: /0+$/ }; formattedNumber = formattedNumber .replace(regex.zeros, "") .replace(regex.separator, "") ; } return formattedNumber; }; // Format currency with localization rules. // The options will be retrieved from the `number.currency.format` and // `number.format` scopes, in that order. // // Any missing option will be retrieved from the `I18n.toNumber` defaults and // the following options: // // - `unit`: `"$"` // - `precision`: `2` // - `format`: `"%u%n"` // - `delimiter`: `","` // - `separator`: `"."` // // You can also override these options by providing the `options` argument. // I18n.toCurrency = function(number, options) { options = this.prepareOptions( options, this.lookup("number.currency.format"), this.lookup("number.format"), {unit: "$", precision: 2, format: "%u%n", delimiter: ",", separator: "."} ); number = this.toNumber(number, options); number = options.format .replace("%u", options.unit) .replace("%n", number) ; return number; }; // Localize several values. // You can provide the following scopes: `currency`, `number`, or `percentage`. // If you provide a scope that matches the `/^(date|time)/` regular expression // then the `value` will be converted by using the `I18n.toTime` function. // // It will default to the value's `toString` function. // I18n.localize = function(scope, value) { switch (scope) { case "currency": return this.toCurrency(value); case "number": scope = this.lookup("number.format"); return this.toNumber(value, scope); case "percentage": return this.toPercentage(value); default: if (scope.match(/^(date|time)/)) { return this.toTime(scope, value); } else { return value.toString(); } } }; // Parse a given `date` string into a JavaScript Date object. // This function is time zone aware. // // The following string formats are recognized: // // yyyy-mm-dd // yyyy-mm-dd[ T]hh:mm::ss // yyyy-mm-dd[ T]hh:mm::ss // yyyy-mm-dd[ T]hh:mm::ssZ // yyyy-mm-dd[ T]hh:mm::ss+0000 // I18n.parseDate = function(date) { var matches, convertedDate; // we have a date, so just return it. if (typeof(date) == "object") { return date; }; matches = date.toString().match(/(\d{4})-(\d{2})-(\d{2})(?:[ T](\d{2}):(\d{2}):(\d{2}))?(Z|\+0000)?/); if (matches) { for (var i = 1; i <= 6; i++) { matches[i] = parseInt(matches[i], 10) || 0; } // month starts on 0 matches[2] -= 1; if (matches[7]) { convertedDate = new Date(Date.UTC(matches[1], matches[2], matches[3], matches[4], matches[5], matches[6])); } else { convertedDate = new Date(matches[1], matches[2], matches[3], matches[4], matches[5], matches[6]); } } else if (typeof(date) == "number") { // UNIX timestamp convertedDate = new Date(); convertedDate.setTime(date); } else if (date.match(/\d+ \d+:\d+:\d+ [+-]\d+ \d+/)) { // a valid javascript format with timezone info convertedDate = new Date(); convertedDate.setTime(Date.parse(date)) } else { // an arbitrary javascript string convertedDate = new Date(); convertedDate.setTime(Date.parse(date)); } return convertedDate; }; // Formats time according to the directives in the given format string. // The directives begins with a percent (%) character. Any text not listed as a // directive will be passed through to the output string. // // The accepted formats are: // // %a - The abbreviated weekday name (Sun) // %A - The full weekday name (Sunday) // %b - The abbreviated month name (Jan) // %B - The full month name (January) // %c - The preferred local date and time representation // %d - Day of the month (01..31) // %-d - Day of the month (1..31) // %H - Hour of the day, 24-hour clock (00..23) // %-H - Hour of the day, 24-hour clock (0..23) // %I - Hour of the day, 12-hour clock (01..12) // %-I - Hour of the day, 12-hour clock (1..12) // %m - Month of the year (01..12) // %-m - Month of the year (1..12) // %M - Minute of the hour (00..59) // %-M - Minute of the hour (0..59) // %p - Meridian indicator (AM or PM) // %S - Second of the minute (00..60) // %-S - Second of the minute (0..60) // %w - Day of the week (Sunday is 0, 0..6) // %y - Year without a century (00..99) // %-y - Year without a century (0..99) // %Y - Year with century // %z - Timezone offset (+0545) // I18n.strftime = function(date, format) { var options = this.lookup("date"); if (!options) { options = { day_names: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] , abbr_day_names: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] , month_names: [null, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] , abbr_month_names: [null, "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] } } if (!options.meridian) { options.meridian = ["AM", "PM"]; } var weekDay = date.getDay() , day = date.getDate() , year = date.getFullYear() , month = date.getMonth() + 1 , hour = date.getHours() , hour12 = hour , meridian = hour > 11 ? 1 : 0 , secs = date.getSeconds() , mins = date.getMinutes() , offset = date.getTimezoneOffset() , absOffsetHours = Math.floor(Math.abs(offset / 60)) , absOffsetMinutes = Math.abs(offset) - (absOffsetHours * 60) , timezoneoffset = (offset > 0 ? "-" : "+") + (absOffsetHours.toString().length < 2 ? "0" + absOffsetHours : absOffsetHours) + (absOffsetMinutes.toString().length < 2 ? "0" + absOffsetMinutes : absOffsetMinutes) ; if (hour12 > 12) { hour12 = hour12 - 12; } else if (hour12 === 0) { hour12 = 12; } var padding = function(n) { var s = "0" + n.toString(); return s.substr(s.length - 2); }; format = format.replace("%a", options.abbr_day_names[weekDay]); format = format.replace("%A", options.day_names[weekDay]); format = format.replace("%b", options.abbr_month_names[month]); format = format.replace("%B", options.month_names[month]); format = format.replace("%d", padding(day)); format = format.replace("%e", day); format = format.replace("%-d", day); format = format.replace("%H", padding(hour)); format = format.replace("%-H", hour); format = format.replace("%I", padding(hour12)); format = format.replace("%-I", hour12); format = format.replace("%m", padding(month)); format = format.replace("%-m", month); format = format.replace("%M", padding(mins)); format = format.replace("%-M", mins); format = format.replace("%p", options.meridian[meridian]); format = format.replace("%S", padding(secs)); format = format.replace("%-S", secs); format = format.replace("%w", weekDay); format = format.replace("%y", padding(year)); format = format.replace("%-y", padding(year).replace(/^0+/, "")); format = format.replace("%Y", year); format = format.replace("%z", timezoneoffset); return format; }; // // I18n.toTime = function(scope, d) { var date = this.parseDate(d) , format = this.lookup(scope) ; if (date.toString().match(/invalid/i)) { return date.toString(); } if (!format) { return date.toString(); } return this.strftime(date, format); }; // // I18n.toPercentage = function(number, options) { options = this.prepareOptions( options, this.lookup("number.percentage.format"), this.lookup("number.format"), {precision: 3, separator: ".", delimiter: ""} ); number = this.toNumber(number, options); return number + "%"; }; // // I18n.toHumanSize = function(number, options) { var kb = 1024 , size = number , iterations = 0 , unit , precision ; while (size >= kb && iterations < 4) { size = size / kb; iterations += 1; } if (iterations === 0) { unit = this.t("number.human.storage_units.units.byte", {count: size}); precision = 0; } else { unit = this.t("number.human.storage_units.units." + [null, "kb", "mb", "gb", "tb"][iterations]); precision = (size - Math.floor(size) === 0) ? 0 : 1; } options = this.prepareOptions( options, {precision: precision, format: "%n%u", delimiter: ""} ); number = this.toNumber(size, options); number = options.format .replace("%u", unit) .replace("%n", number) ; return number; }; // Set aliases, so we can save some typing. I18n.t = I18n.translate; I18n.l = I18n.localize; I18n.p = I18n.pluralize; })(typeof(exports) === "undefined" ? this["I18n"] = {} : exports); // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(searchElement /*, fromIndex */) { "use strict"; if (this === void 0 || this === null) throw new TypeError(); var t = Object(this); var len = t.length >>> 0; if (len === 0) return -1; var n = 0; if (arguments.length > 0) { n = Number(arguments[1]); if (n !== n) // shortcut for verifying if it's NaN n = 0; else if (n !== 0 && n !== (Infinity) && n !== -(Infinity)) n = (n > 0 || -1) * Math.floor(Math.abs(n)); } if (n >= len) return -1; var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); for (; k < len; k++) { if (k in t && t[k] === searchElement) return k; } return -1; }; } ; ;I18n.translations = {"en":{"date":{"formats":{"default":"%b %d %Y","short":"%b %d","long":"%B %d, %Y"},"day_names":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"abbr_day_names":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"month_names":[null,"January","February","March","April","May","June","July","August","September","October","November","December"],"abbr_month_names":[null,"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"order":["year","month","day"]},"time":{"formats":{"default":"%a, %d %b %Y %H:%M:%S %z","short":"%d %b %H:%M","long":"%B %d, %Y %H:%M"},"am":"am","pm":"pm"},"support":{"array":{"words_connector":", ","two_words_connector":" and ","last_word_connector":", and "}},"errors":{"format":"%{attribute} %{message}","messages":{"inclusion":"is not included in the list","exclusion":"is reserved","invalid":"is invalid","confirmation":"doesn't match confirmation","accepted":"must be accepted","empty":"can't be empty","blank":"can't be blank","too_long":"is too long (maximum is %{count} characters)","too_short":"is too short (minimum is %{count} characters)","wrong_length":"is the wrong length (should be %{count} characters)","not_a_number":"is not a number","not_an_integer":"must be an integer","greater_than":"must be greater than %{count}","greater_than_or_equal_to":"must be greater than or equal to %{count}","equal_to":"must be equal to %{count}","less_than":"must be less than %{count}","less_than_or_equal_to":"must be less than or equal to %{count}","odd":"must be odd","even":"must be even"}},"number":{"format":{"separator":".","delimiter":",","precision":3,"significant":false,"strip_insignificant_zeros":false},"currency":{"format":{"format":"%u%n","unit":"$","separator":".","delimiter":",","precision":2,"significant":false,"strip_insignificant_zeros":false}},"percentage":{"format":{"delimiter":""}},"precision":{"format":{"delimiter":""}},"human":{"format":{"delimiter":"","precision":3,"significant":true,"strip_insignificant_zeros":true},"storage_units":{"format":"%n %u","units":{"byte":{"one":"Byte","other":"Bytes"},"kb":"KB","mb":"MB","gb":"GB","tb":"TB"}},"decimal_units":{"format":"%n %u","units":{"unit":"","thousand":"Thousand","million":"Million","billion":"Billion","trillion":"Trillion","quadrillion":"Quadrillion"}}}},"datetime":{"distance_in_words":{"half_a_minute":"half a minute","less_than_x_seconds":{"one":"less than 1 second","other":"less than %{count} seconds"},"x_seconds":{"one":"1 second","other":"%{count} seconds"},"less_than_x_minutes":{"one":"less than a minute","other":"less than %{count} minutes"},"x_minutes":{"one":"1 minute","other":"%{count} minutes"},"about_x_hours":{"one":"about 1 hour","other":"about %{count} hours"},"x_days":{"one":"1 day","other":"%{count} days"},"about_x_months":{"one":"about 1 month","other":"about %{count} months"},"x_months":{"one":"1 month","other":"%{count} months"},"about_x_years":{"one":"about 1 year","other":"about %{count} years"},"over_x_years":{"one":"over 1 year","other":"over %{count} years"},"almost_x_years":{"one":"almost 1 year","other":"almost %{count} years"}},"prompts":{"year":"Year","month":"Month","day":"Day","hour":"Hour","minute":"Minute","second":"Seconds"}},"helpers":{"select":{"prompt":"Please select"},"submit":{"create":"Create %{model}","update":"Update %{model}","submit":"Save %{model}"},"button":{"create":"Create %{model}","update":"Update %{model}","submit":"Save %{model}"}},"woople_theme":{"company":{"name":"Woople","url":"http://woople.com"},"content_item_header":{"time_left":"Time Left","popularity":"Popularity","points":"Points"},"outline":{"name":"Name","duration":"Duration","assessment":"Assessment","assessment_questions":{"one":"1 question","other":"%{count} questions"},"assessment_requirement":"%{percent}% required"},"profile":{"search":"Search..."},"video_modal":{"like":"Like","dislike":"Dislike"},"assessment":{"start":"Start Assessment","history":"History","duration":{"one":"1 minute","other":"%{count} minutes"},"fail_html":"You failed! Please watch the Require Relearning before attempting the assessment again.","required_relearning":"Required Relearning","name":"Assessment","assessment_history":"Assessment History","date_title":"Date","score_title":"Score","result_title":"Result","pass":"Pass","fail":"Fail"},"assessment_form":{"unanswered_questions":{"one":"1 unanswered question","other":"%{count} unanswered questions"}},"search_results_more":"See All >"},"hello":"Hello world"}}; ;FI"required_assets_digest;F"%c8462641c48dd63ed8f267c3e054575eI" _version;F"%9f3b95dd7ea3030dc35985c0a8020862