Skip to content

Instantly share code, notes, and snippets.

View cwtuan's full-sized avatar

cwtuan

  • Alibaba Group & Member of W3C
View GitHub Profile
/**
* Locale.js 1.0 is a client side Javascript Localization library.
* Author: Chia-Wei Tuan (linkedin.com/in/cwtuan)
* Github: https://github.com/cwtuan/Locale.js
* Demo: http://opensource.tonytuan.org/locale.js/
* License: Apache License
* Build: Mon, 22 Sep 2014 12:07:30 GMT
*/
var Locale=function(){"use strict";function n(n){this.langUrls=n}function t(n){var t,e;if(this.map[n]){if(t=[],1==arguments.length)return this.map[n];for(e=1;e<arguments.length;e++)t.push(arguments[e]);return this.map[n].replace(/\{(\d+)\}/g,function(n,e){return t[e]})}return n+".UNDEFINED"}function e(n){this.currentLang=n}function r(){var n=this.currentLang||d(location.search,"lang")||c("lang")||f();return p(n)}function a(n){l("lang",n)}function o(n){return null!==this.map[n]}function i(){s.call(this,!1)}function u(n){s.call(this,!0,n)}function s(n,t){var e,a,o,i,u,s,l,c,g,f=this;for(this.map={},this.langUrls||console.error("You should call setLanguageUrls() before loading lagnuage file."),e=window.XMLHttpRequest?new XMLHt
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[add your bin description]" />
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
</body>