test('requiring a directory imports the directory returns the results', function() {
  var result = requireDirectory('ember-locales', 'utils');
  equal(result.length, 1);
  var module = result[0];
  equal(module.name, "require-directory");
  equal(module.fullName, "ember-locales/utils/require-directory");
  ok(module.contents);
});
Ejemplo n.º 2
0
  initialize: function () {
    registerHelper('l',    makeBoundHelper(l));
    registerHelper('join', makeBoundHelper(join));
    registerHelper('t',    makeBoundHelper(t));

    // Pull all locales from the project
    I18n.defaultLocale = config.LOCALE;

    var translations = I18n.translations = {};
    var locales = requireDirectory(config.modulePrefix, 'locale');
    var defaultLocale = locales.findProperty('name', I18n.defaultLocale);

    // Promote the default locale
    locales.removeObject(defaultLocale);
    locales.unshiftObject(defaultLocale);

    locales.forEach(function (module) {
      Ember.assert(`${module.fullName} must export a translation table.`, module.contents != null);
      var table = module.contents.default;
      translations[module.name] = table;
    });
  }