Created
August 3, 2011 09:39
-
-
Save osdrv/1122264 to your computer and use it in GitHub Desktop.
tiny JS i18n support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.i18n = (() -> | |
__def_loc = "en_US" | |
{ | |
locale: (loc) -> | |
if loc != undefined | |
__def_loc = loc | |
else | |
__def_loc | |
, bind: (o) -> | |
if o.i18ze == undefined | |
o.i18ze = (loc, opts, merge = false) -> | |
this._i18n_pool = this._i18n_pool || {} | |
opts = $.merge({}, (this._i18n_pool[loc] || {}), opts) if merge | |
this._i18n_pool[loc] = opts | |
if o.i18zed == undefined | |
o.i18zed = (loc) -> | |
this._i18n_pool = this._i18n_pool || {} | |
this._i18n_pool[loc || i18n.locale()] | |
o | |
} | |
)() |
Author
osdrv
commented
Aug 3, 2011
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment