Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-i18n

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-i18n - npm Package Compare versions

Comparing version 2.2.1 to 2.2.3

dist/i18n.js

2

bower.json
{
"name": "ember-i18n",
"version": "2.2.1",
"version": "2.2.3",
"description": "I18n support for Ember.js",

@@ -5,0 +5,0 @@ "main": [ "lib/i18n.js" ],

@@ -0,1 +1,11 @@

## 2.2.2 2014-09-16
* Use internal UUID generation, since implementations differ
across Ember versions
* Select template compiler on first use so
`Ember.ENV.I18N_COMPILE_WITHOUT_HANDLEBARS` is sure to have
been set properly.
* Fix TranslateableAttributes tests on Ember Canary
* Better messaging during the build process
## 2.2.1 2014-08-17

@@ -2,0 +12,0 @@

## Running the tests
You'll need [npm](https://npmjs.org) and `make`.
You'll need [npm](https://npmjs.org), `make`, and [PhantomJS](http://phantomjs.org/).
The default `make` target will run tests against several combinations of Ember,
Handlebars, and jQuery.
To run tests against a single combination, run `make test` with a set of environment
variables set:
```bash
make test
$ JQUERY_VERSION=2.0.3 EMBER_VERSION=canary HANDLEBARS_VERSION=1.3.0 make test
```

@@ -8,0 +14,0 @@

(function(window) {
var I18n, assert, findTemplate, get, set, isBinding, lookupKey, pluralForm,
PlainHandlebars, EmHandlebars, keyExists,
compileTemplate, compileWithHandlebars;
PlainHandlebars, EmHandlebars, keyExists;

@@ -69,4 +68,31 @@ PlainHandlebars = window.Handlebars;

compileWithHandlebars = (function() {
if (Ember.ENV.I18N_COMPILE_WITHOUT_HANDLEBARS === undefined) {
var escapeExpression = EmHandlebars.Utils.escapeExpression;
var compileImplementation;
function compileTemplate(template) {
if (compileImplementation === undefined) {
compileImplementation = selectCompileImplementation();
}
return compileImplementation(template);
}
function selectCompileImplementation() {
var flag = Ember.ENV.I18N_COMPILE_WITHOUT_HANDLEBARS;
if (flag === true) {
return function compileWithoutHandlebars(template) {
return function (data) {
return template
.replace(/\{\{\{(.*?)\}\}\}/g, function(i, match) {
// tripple curlies -> no-escaping
return get(data, match);
}).replace(/\{\{(.*?)\}\}/g, function(i, match) {
return escapeExpression( get(data, match) );
});
};
};
}
if (flag === undefined) {
warn("Ember.I18n will no longer include Handlebars compilation by default in the future; instead, it will supply its own default compiler. Set Ember.ENV.I18N_COMPILE_WITHOUT_HANDLEBARS to true to opt-in now.");

@@ -84,18 +110,4 @@ }

}
}());
function compileWithoutHandlebars(template) {
return function (data) {
return template.replace(/\{\{(.*?)\}\}/g, function(i, match) {
return data[match];
});
};
}
if (Ember.ENV.I18N_COMPILE_WITHOUT_HANDLEBARS === true) {
compileTemplate = compileWithoutHandlebars;
} else {
compileTemplate = compileWithHandlebars;
}
I18n = Ember.Evented.apply({

@@ -161,4 +173,7 @@ compile: compileTemplate,

// Generate a universally unique id
var _uuid = 0;
function uniqueElementId() {
return ++Ember.uuid;
var i = ++_uuid;
return 'i18n-' + i;
}

@@ -165,0 +180,0 @@

{
"name": "ember-i18n",
"version": "2.2.1",
"version": "2.2.3",
"licence": "APLv2",

@@ -5,0 +5,0 @@ "description": "Internationalization for Ember",

@@ -14,2 +14,3 @@ #!/usr/bin/env node

console.error('Error running specs: ' + error);
process.exit(1);
}

@@ -16,0 +17,0 @@ });

@@ -11,4 +11,7 @@ (function() {

function renderTemplate(template, options) {
var container = new Ember.Container();
container.register('view:toplevel', Ember.View.extend());
if (options == null) options = {};
options.template = Ember.Handlebars.compile(template);
options.container = container;
var view = this._ember_view = Ember.View.create(options);

@@ -25,3 +28,5 @@ Ember.run(view, 'append');

'foo.bar': 'A Foobar',
'foo.bar.named': 'A Foobar named {{name}}',
'foo.bar.named': 'A Foobar named <span>{{name}}</span>',
'foo.bar.named.noEscape': 'A Foobar named <span>{{{link}}}</span>',
'foo.bar.named.structured': 'A Foobar named {{contact.name}}',
'foo.save.disabled': 'Saving Foo...',

@@ -28,0 +33,0 @@ 'foos.zero': 'No Foos',

@@ -8,3 +8,15 @@ describe('Ember.I18n.t', function() {

expect(Ember.I18n.t('foo.bar.named', {
name: 'Sue'
name: '<Sue>'
})).to.equal('A Foobar named <span>&lt;Sue&gt;</span>');
});
it('interpolates escaped', function() {
expect(Ember.I18n.t('foo.bar.named.noEscape', {
link: '<a href="#">Sue</a>'
})).to.equal('A Foobar named <span><a href="#">Sue</a></span>');
});
it('interpolates structures correctly', function() {
expect(Ember.I18n.t('foo.bar.named.structured', {
contact: { name: 'Sue' }
})).to.equal('A Foobar named Sue');

@@ -11,0 +23,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc