Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
version bump to 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
James A. Rosen committed Feb 14, 2012
1 parent 656415d commit 4ee1f35
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 115 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0
1.2.0
102 changes: 0 additions & 102 deletions dist/ember-i18n-1.0.0.js

This file was deleted.

43 changes: 31 additions & 12 deletions dist/ember-i18n-1.1.0.js → dist/ember-i18n-1.2.0.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,47 @@
(function() {
var I18n, getPath, isBinding, isTranslatedAttribute;
var I18n, findTemplate, getPath, isBinding, isTranslatedAttribute, pluralForm;

isTranslatedAttribute = /(.+)Translation$/;

getPath = Ember.Handlebars.getPath || Ember.getPath;

I18n = {
compile: Handlebars.compile,
translations: {},
template: function(key) {
var result;
sc_assert("You must provide a translation key string, not %@".fmt(key), typeof key === 'string');
result = I18n.translations[key];
if (typeof CLDR !== "undefined" && CLDR !== null) pluralForm = CLDR.pluralForm;

if (pluralForm == null) {
Ember.Logger.warn("CLDR.pluralForm not found. Em.I18n will not support count-based inflection.");
}

findTemplate = function(key, setOnMissing) {
var result;
ember_assert("You must provide a translation key string, not %@".fmt(key), typeof key === 'string');
result = I18n.translations[key];
if (setOnMissing) {
if (result == null) {
result = I18n.translations[key] = I18n.compile("Missing translation: " + key);
}
if (!$.isFunction(result)) {
result = I18n.translations[key] = I18n.compile(result);
}
if ((result != null) && !$.isFunction(result)) {
result = I18n.translations[key] = I18n.compile(result);
}
return result;
};

I18n = {
compile: Handlebars.compile,
translations: {},
template: function(key, count) {
var interpolatedKey, result, suffix;
if ((count != null) && (pluralForm != null)) {
suffix = pluralForm(count);
interpolatedKey = "%@.%@".fmt(key, suffix);
result = findTemplate(interpolatedKey, false);
}
return result;
return result != null ? result : result = findTemplate(key, true);
},
t: function(key, context) {
var template;
template = I18n.template(key);
if (context == null) context = {};
template = I18n.template(key, context.count);
return template(context);
},
TranslateableAttributes: Em.Mixin.create({
Expand Down

0 comments on commit 4ee1f35

Please sign in to comment.