freeze the ctx, build locales and set isReady on them
move Locale to lib/l20n/locale.js
remove mozL10n.init(), use getLocale, fix lint errors
fix a rebase mistake: addAST takes a single argument now, ast
allow context to be re-frozen if it's ready
move iniLoads === 0 check close to the definition of the var
Readd mozL10n.init (requires changes to webapp-optimize)

Here's the diff to webapp-optimize:

diff --git a/build/webapp-optimize.js b/build/webapp-optimize.js
index 18b0d30..ebfb77e 100644
--- a/build/webapp-optimize.js
+++ b/build/webapp-optimize.js
@@ -572,7 +572,10 @@ function optimize_compile(webapp, file, callback) {
       L10N_OPTIMIZATION_BLACKLIST.indexOf(webapp.sourceDirectoryName) < 0) {
     // selecting a language triggers `XMLHttpRequest' and `dispatchEvent' above
     debug('localizing: ' + file.path);
-    mozL10n.language.code = l10nLocales[processedLocales];
+    // reset the l10n context and fetch the *.ini files to set it up anew
+    mozL10n.init(function() {
+      mozL10n.language.code = l10nLocales[processedLocales];
+    });
   } else {
     callback();
   }
use fallback in getDictionary
remove recursion from getFromLocale
remove ctx.currentLocale
remove locale's AST after it's been built, but only in runtime
set lang and direction
reorder functions in webl10n
set lang and dir asap
localize attributes