<commit_before>describe('strong-api', function(){
  var StrongAPI = require('../lib/strong-api');
  var api;
  
  beforeEach(function () {
    api = new StrongAPI();
  });

  it('should translate in the default default locale', function() {
    expect(api.translate('everything')).toEqual('I am a translated string for locale: en');
  });

  it('should translate in the recently set default locale', function() {
    api.default_locale = 'de';
    expect(api.translate('everything')).toEqual('I am a translated string for locale: de');
  });

  it('should translate in the current locale', function() {
    api.default_locale = 'de';
    api.locale = 'en';
    expect(api.translate('everything')).toEqual('I am a translated string for locale: en');
  });

  it('should translate in the option-specified locale', function() {
    api.default_locale = 'de';
    api.locale = 'en';
    expect(api.translate('everything', { locale: 'es' })).toEqual('I am a translated string for locale: es');
  });

});<commit_msg>Write a failing test to show variable substitution<commit_after>describe('strong-api', function(){
  var StrongAPI = require('../lib/strong-api');
  var api;
  
  beforeEach(function () {
    api = new StrongAPI();
  });

  it('should translate in the default default locale', function() {
    expect(api.translate('everything')).toEqual('I am a translated string for locale: en');
  });

  it('should translate in the recently set default locale', function() {
    api.default_locale = 'de';
    expect(api.translate('everything')).toEqual('I am a translated string for locale: de');
  });

  it('should translate in the current locale', function() {
    api.default_locale = 'de';
    api.locale = 'en';
    expect(api.translate('everything')).toEqual('I am a translated string for locale: en');
  });

  it('should translate in the option-specified locale', function() {
    api.default_locale = 'de';
    api.locale = 'en';
    expect(api.translate('everything', { locale: 'es' })).toEqual('I am a translated string for locale: es');
  });

  // Interpolation
  it('should use named arguments as substitutions', function() {
    // Setup the test case, assuming you have this string
    var fake_back = { 'en': { '.hello': 'Hello, %(name)' } };

    // Make sure you can toss variables at it
    var user = {'name': 'Johnny'};
    var result = api.translate( '.hello', user );
    expect(result).toEqual( 'Hello, Johnny' );
  });

});
{'fraction_non_alphanumeric': 0.16047366271947733, 'fraction_numerical': 0.0, 'mean_word_length': 3.8707753479125246, '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': '5489364', 'n_tokens_mistral': 704, 'n_tokens_neox': 694, 'n_words': 224}