<commit_before>/*jslint nomen: true, undef: true, sloppy: true, white: true, stupid: true, passfail: false, node: true, plusplus: true, indent: 2 */

var should = require("should"),
    i18n = require('../i18n'),
    fs = require('fs');

i18n.configure({
  locales: ['en', 'de'],
  register: global,
  directory: './testlocales',
  extension: '.json',
  debug: false,
  verbose: false
});

describe('Configuration settings:', function () {

  after(function () {
    var stats = fs.lstatSync('./testlocales');
    should.exist(stats);
    if (stats) {
      fs.unlinkSync('./testlocales/de.json');
      fs.unlinkSync('./testlocales/en.json');
      fs.rmdirSync('./testlocales');
    }
  });

  describe('when using a custom directory with a custom extension', function () {

    it('the setLocale and getLocale should still be able to set current locale', function () {
      should.equal('en', i18n.getLocale(), 'should return default setting');
      should.equal('de', i18n.setLocale('de'), 'should return the new setting');
      should.equal('de', i18n.getLocale(), 'should return the new setting');
    });

    it('and some basic translations should still work', function () {
      i18n.setLocale('en');
      should.equal(__('Hello'), 'Hello');
      should.equal(__('Hello %s, how are you today?', 'Marcus'), 'Hello Marcus, how are you today?');
      should.equal(__('Hello %s, how are you today? How was your %s.', 'Marcus', __('weekend')), 'Hello Marcus, how are you today? How was your weekend.');
    });

  });
});<commit_msg>finally travis shows concurrency issues in tests<commit_after>/*jslint nomen: true, undef: true, sloppy: true, white: true, stupid: true, passfail: false, node: true, plusplus: true, indent: 2 */

var should = require("should"),
    i18n = require('../i18n'),
    fs = require('fs');

i18n.configure({
  locales: ['en', 'de'],
  register: global,
  directory: './testlocales',
  extension: '.json',
  debug: false,
  verbose: false
});

describe('Configuration settings:', function () {

  after(function () {
    var stats = fs.lstatSync('./testlocales');
    should.exist(stats);
    if (stats) {
      fs.unlinkSync('./testlocales/de.json');
      fs.unlinkSync('./testlocales/en.json');
      fs.rmdirSync('./testlocales');
    }
  });

  describe('when using a custom directory with a custom extension', function () {

    it('getLocale should return configured default locale', function () {
      should.equal('en', i18n.getLocale(), 'should return default setting');
    });

    it('setting locales should return appropiate locale', function () {
      var my_setLocale = i18n.setLocale('de'),
          my_getLocale = i18n.getLocale();
      should.equal('de', my_setLocale);
      should.equal('de', my_getLocale);
    });

    it('and some basic translations should still work', function () {
      i18n.setLocale('en');
      should.equal(__('Hello'), 'Hello');
      should.equal(__('Hello %s, how are you today?', 'Marcus'), 'Hello Marcus, how are you today?');
      should.equal(__('Hello %s, how are you today? How was your %s.', 'Marcus', __('weekend')), 'Hello Marcus, how are you today? How was your weekend.');
    });

  });
});
{'fraction_non_alphanumeric': 0.17339593114241, 'fraction_numerical': 0.009389671361502348, 'mean_word_length': 3.611832611832612, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7450323', 'n_tokens_mistral': 1007, 'n_tokens_neox': 967, 'n_words': 286}