@@ -239,6 +239,18 @@ BT.AppBuilder = SC.Object.extend({
239
239
return require ( 'path' ) . basename ( this . get ( 'path' ) ) ;
240
240
} . property ( 'path' ) ,
241
241
242
+ lprojDirNames : function ( ) {
243
+ var language = this . get ( 'language' ) ,
244
+ ret = [ ] ;
245
+
246
+ BT . LANGUAGE_MAP [ language ] . forEach ( function ( lang ) {
247
+ ret . push ( lang + '.lproj' ) ;
248
+ } , this ) ;
249
+ ret . push ( language + '.lproj' ) ;
250
+
251
+ return ret ;
252
+ } . property ( 'language' ) . cacheable ( ) ,
253
+
242
254
bootstrap : function ( ) {
243
255
var ret = [ ] ;
244
256
@@ -264,7 +276,40 @@ BT.AppBuilder = SC.Object.extend({
264
276
265
277
contentForBody : "" , // empty for now...
266
278
267
- contentForLoading : '<p class="loading">Loading...</p>' ,
279
+ contentForLoading : function ( ) {
280
+ // return an ejs generated template, never ever cache this
281
+ var ejs = require ( 'ejs' ) ,
282
+ pathlib = require ( 'path' ) ,
283
+ fslib = require ( 'fs' ) ,
284
+ lprojDirNames = this . get ( 'lprojDirNames' ) ,
285
+ locPath , templatePath ;
286
+
287
+ for ( var i = 0 , len = lprojDirNames . get ( 'length' ) ; i < len ; i ++ ) {
288
+ var lprojDirName = lprojDirNames . objectAt ( i ) ;
289
+ locPath = pathlib . join ( BT . projectPath , 'apps' , this . get ( 'name' ) , lprojDirName , "loading.ejs" ) ;
290
+ if ( fslib . statSync ( locPath ) . isFile ( ) ) {
291
+ templatePath = locPath ;
292
+ break ;
293
+ }
294
+ }
295
+ if ( ! templatePath ) {
296
+ locPath = pathlib . join ( BT . projectPath , 'apps' , this . get ( 'name' ) , "loading.ejs" ) ;
297
+ if ( fslib . statSync ( locPath ) . isFile ( ) ) templatePath = locPath ;
298
+ }
299
+ if ( ! templatePath ) templatePath = pathlib . join ( BT . btPath , "templates" , "loading.ejs" ) ;
300
+
301
+ var template = fslib . readFileSync ( templatePath ) ,
302
+ ret ;
303
+
304
+ try {
305
+ ret = ejs . render ( template . toString ( ) ) ;
306
+ }
307
+ catch ( er ) {
308
+ SC . Logger . log ( "Problem compiling the Html template: " + require ( 'util' ) . inspect ( er ) ) ;
309
+ SC . Logger . log ( "ret: " + require ( 'util' ) . inspect ( ret ) ) ;
310
+ }
311
+ return ret ;
312
+ } . property ( 'language' ) . cacheable ( ) ,
268
313
269
314
contentForResources : "" , // empty for now
270
315
0 commit comments