Merge pull request #1167 from ZogStriP/i18n-helper

I18n helper
This commit is contained in:
Robin Ward 2013-07-09 06:43:48 -07:00
commit f4c3416f1b
86 changed files with 348 additions and 354 deletions

View File

@ -14,7 +14,7 @@ Discourse.AdminCustomizeController = Ember.ArrayController.extend({
@method newCustomization @method newCustomization
**/ **/
newCustomization: function() { newCustomization: function() {
var item = Discourse.SiteCustomization.create({name: Em.String.i18n("admin.customize.new_style")}); var item = Discourse.SiteCustomization.create({name: I18n.t("admin.customize.new_style")});
this.pushObject(item); this.pushObject(item);
this.set('selectedItem', item); this.set('selectedItem', item);
}, },
@ -45,7 +45,7 @@ Discourse.AdminCustomizeController = Ember.ArrayController.extend({
**/ **/
destroy: function() { destroy: function() {
var _this = this; var _this = this;
return bootbox.confirm(Em.String.i18n("admin.customize.delete_confirm"), Em.String.i18n("no_value"), Em.String.i18n("yes_value"), function(result) { return bootbox.confirm(I18n.t("admin.customize.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), function(result) {
var selected; var selected;
if (result) { if (result) {
selected = _this.get('selectedItem'); selected = _this.get('selectedItem');

View File

@ -19,7 +19,7 @@ Discourse.AdminFlagsController = Ember.ArrayController.extend({
item.disagreeFlags().then((function() { item.disagreeFlags().then((function() {
adminFlagsController.removeObject(item); adminFlagsController.removeObject(item);
}), function() { }), function() {
bootbox.alert(Em.String.i18n("admin.flags.error")); bootbox.alert(I18n.t("admin.flags.error"));
}); });
}, },
@ -28,7 +28,7 @@ Discourse.AdminFlagsController = Ember.ArrayController.extend({
item.agreeFlags().then((function() { item.agreeFlags().then((function() {
adminFlagsController.removeObject(item); adminFlagsController.removeObject(item);
}), function() { }), function() {
bootbox.alert(Em.String.i18n("admin.flags.error")); bootbox.alert(I18n.t("admin.flags.error"));
}); });
}, },
@ -37,7 +37,7 @@ Discourse.AdminFlagsController = Ember.ArrayController.extend({
item.deferFlags().then((function() { item.deferFlags().then((function() {
adminFlagsController.removeObject(item); adminFlagsController.removeObject(item);
}), function() { }), function() {
bootbox.alert(Em.String.i18n("admin.flags.error")); bootbox.alert(I18n.t("admin.flags.error"));
}); });
}, },
@ -52,7 +52,7 @@ Discourse.AdminFlagsController = Ember.ArrayController.extend({
item.deletePost().then((function() { item.deletePost().then((function() {
adminFlagsController.removeObject(item); adminFlagsController.removeObject(item);
}), function() { }), function() {
bootbox.alert(Em.String.i18n("admin.flags.error")); bootbox.alert(I18n.t("admin.flags.error"));
}); });
}, },

View File

@ -18,9 +18,9 @@ Discourse.AdminUserController = Discourse.ObjectController.extend({
data: {title: this.get('title')}, data: {title: this.get('title')},
type: 'PUT' type: 'PUT'
}).then(null, function(e){ }).then(null, function(e){
bootbox.alert(Em.String.i18n("generic_error_with_reason", {error: "http: " + e.status + " - " + e.body})); bootbox.alert(I18n.t("generic_error_with_reason", {error: "http: " + e.status + " - " + e.body}));
}); });
this.toggleTitleEdit(); this.toggleTitleEdit();
} }
}); });

View File

@ -49,7 +49,7 @@ Discourse.AdminUsersListController = Ember.ArrayController.extend(Discourse.Pres
@property title @property title
**/ **/
title: function() { title: function() {
return Em.String.i18n('admin.users.titles.' + this.get('query')); return I18n.t('admin.users.titles.' + this.get('query'));
}.property('query'), }.property('query'),
/** /**

View File

@ -14,7 +14,7 @@ Discourse.AdminApi = Discourse.Model.extend({
}, },
regenerateKey: function(){ regenerateKey: function(){
alert(Em.String.i18n('not_implemented')); alert(I18n.t('not_implemented'));
} }
}); });

View File

@ -89,7 +89,7 @@ Discourse.AdminUser = Discourse.User.extend({
window.location.reload(); window.location.reload();
}, function(e) { }, function(e) {
// failure // failure
var error = Em.String.i18n('admin.user.trust_level_change_failed', { error: "http: " + e.status + " - " + e.body }); var error = I18n.t('admin.user.trust_level_change_failed', { error: "http: " + e.status + " - " + e.body });
bootbox.alert(error); bootbox.alert(error);
}); });
}, },
@ -113,7 +113,7 @@ Discourse.AdminUser = Discourse.User.extend({
}).property('banned_till', 'banned_at'), }).property('banned_till', 'banned_at'),
ban: function() { ban: function() {
var duration = parseInt(window.prompt(Em.String.i18n('admin.user.ban_duration')), 10); var duration = parseInt(window.prompt(I18n.t('admin.user.ban_duration')), 10);
if (duration > 0) { if (duration > 0) {
Discourse.ajax("/admin/users/" + this.id + "/ban", { Discourse.ajax("/admin/users/" + this.id + "/ban", {
type: 'PUT', type: 'PUT',
@ -123,7 +123,7 @@ Discourse.AdminUser = Discourse.User.extend({
window.location.reload(); window.location.reload();
}, function(e) { }, function(e) {
// failure // failure
var error = Em.String.i18n('admin.user.ban_failed', { error: "http: " + e.status + " - " + e.body }); var error = I18n.t('admin.user.ban_failed', { error: "http: " + e.status + " - " + e.body });
bootbox.alert(error); bootbox.alert(error);
}); });
} }
@ -137,7 +137,7 @@ Discourse.AdminUser = Discourse.User.extend({
window.location.reload(); window.location.reload();
}, function(e) { }, function(e) {
// failed // failed
var error = Em.String.i18n('admin.user.unban_failed', { error: "http: " + e.status + " - " + e.body }); var error = I18n.t('admin.user.unban_failed', { error: "http: " + e.status + " - " + e.body });
bootbox.alert(error); bootbox.alert(error);
}); });
}, },
@ -152,9 +152,9 @@ Discourse.AdminUser = Discourse.User.extend({
}, function(e) { }, function(e) {
// failed // failed
if (e.status === 404) { if (e.status === 404) {
bootbox.alert(Em.String.i18n('admin.impersonate.not_found')); bootbox.alert(I18n.t('admin.impersonate.not_found'));
} else { } else {
bootbox.alert(Em.String.i18n('admin.impersonate.invalid')); bootbox.alert(I18n.t('admin.impersonate.invalid'));
} }
}); });
}, },
@ -165,7 +165,7 @@ Discourse.AdminUser = Discourse.User.extend({
window.location.reload(); window.location.reload();
}, function(e) { }, function(e) {
// failed // failed
var error = Em.String.i18n('admin.user.activate_failed', { error: "http: " + e.status + " - " + e.body }); var error = I18n.t('admin.user.activate_failed', { error: "http: " + e.status + " - " + e.body });
bootbox.alert(error); bootbox.alert(error);
}); });
}, },
@ -176,7 +176,7 @@ Discourse.AdminUser = Discourse.User.extend({
window.location.reload(); window.location.reload();
}, function(e) { }, function(e) {
// failed // failed
var error = Em.String.i18n('admin.user.deactivate_failed', { error: "http: " + e.status + " - " + e.body }); var error = I18n.t('admin.user.deactivate_failed', { error: "http: " + e.status + " - " + e.body });
bootbox.alert(error); bootbox.alert(error);
}); });
}, },
@ -187,7 +187,7 @@ Discourse.AdminUser = Discourse.User.extend({
window.location.reload(); window.location.reload();
}, function(e) { }, function(e) {
// failed // failed
var error = Em.String.i18n('admin.user.unblock_failed', { error: "http: " + e.status + " - " + e.body }); var error = I18n.t('admin.user.unblock_failed', { error: "http: " + e.status + " - " + e.body });
bootbox.alert(error); bootbox.alert(error);
}); });
}, },
@ -198,7 +198,7 @@ Discourse.AdminUser = Discourse.User.extend({
window.location.reload(); window.location.reload();
}, function(e) { }, function(e) {
// failed // failed
var error = Em.String.i18n('admin.user.block_failed', { error: "http: " + e.status + " - " + e.body }); var error = I18n.t('admin.user.block_failed', { error: "http: " + e.status + " - " + e.body });
bootbox.alert(error); bootbox.alert(error);
}); });
}, },
@ -206,10 +206,10 @@ Discourse.AdminUser = Discourse.User.extend({
sendActivationEmail: function() { sendActivationEmail: function() {
Discourse.ajax('/users/' + this.get('username') + '/send_activation_email', {type: 'POST'}).then(function() { Discourse.ajax('/users/' + this.get('username') + '/send_activation_email', {type: 'POST'}).then(function() {
// succeeded // succeeded
bootbox.alert( Em.String.i18n('admin.user.activation_email_sent') ); bootbox.alert( I18n.t('admin.user.activation_email_sent') );
}, function(e) { }, function(e) {
// failed // failed
var error = Em.String.i18n('admin.user.send_activation_email_failed', { error: "http: " + e.status + " - " + e.body }); var error = I18n.t('admin.user.send_activation_email_failed', { error: "http: " + e.status + " - " + e.body });
bootbox.alert(error); bootbox.alert(error);
}); });
}, },
@ -220,7 +220,7 @@ Discourse.AdminUser = Discourse.User.extend({
deleteButtonTitle: function() { deleteButtonTitle: function() {
if (this.get('deleteForbidden')) { if (this.get('deleteForbidden')) {
return Em.String.i18n('admin.user.delete_forbidden'); return I18n.t('admin.user.delete_forbidden');
} else { } else {
return null; return null;
} }
@ -228,22 +228,22 @@ Discourse.AdminUser = Discourse.User.extend({
destroy: function() { destroy: function() {
var user = this; var user = this;
bootbox.confirm(Em.String.i18n("admin.user.delete_confirm"), Em.String.i18n("no_value"), Em.String.i18n("yes_value"), function(result) { bootbox.confirm(I18n.t("admin.user.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), function(result) {
if(result) { if(result) {
Discourse.ajax("/admin/users/" + user.get('id') + '.json', { type: 'DELETE' }).then(function(data) { Discourse.ajax("/admin/users/" + user.get('id') + '.json', { type: 'DELETE' }).then(function(data) {
if (data.deleted) { if (data.deleted) {
bootbox.alert(Em.String.i18n("admin.user.deleted"), function() { bootbox.alert(I18n.t("admin.user.deleted"), function() {
document.location = "/admin/users/list/active"; document.location = "/admin/users/list/active";
}); });
} else { } else {
bootbox.alert(Em.String.i18n("admin.user.delete_failed")); bootbox.alert(I18n.t("admin.user.delete_failed"));
if (data.user) { if (data.user) {
user.mergeAttributes(data.user); user.mergeAttributes(data.user);
} }
} }
}, function(jqXHR, status, error) { }, function(jqXHR, status, error) {
Discourse.AdminUser.find( user.get('username') ).then(function(u){ user.mergeAttributes(u); }); Discourse.AdminUser.find( user.get('username') ).then(function(u){ user.mergeAttributes(u); });
bootbox.alert(Em.String.i18n("admin.user.delete_failed")); bootbox.alert(I18n.t("admin.user.delete_failed"));
}); });
} }
}); });
@ -270,7 +270,7 @@ Discourse.AdminUser.reopenClass({
return user.set('selected', false); return user.set('selected', false);
}); });
bootbox.alert(Em.String.i18n("admin.user.approve_bulk_success")); bootbox.alert(I18n.t("admin.user.approve_bulk_success"));
return Discourse.ajax("/admin/users/approve-bulk", { return Discourse.ajax("/admin/users/approve-bulk", {
type: 'PUT', type: 'PUT',

View File

@ -12,7 +12,7 @@ Discourse.FlaggedPost = Discourse.Post.extend({
return _(this.post_actions) return _(this.post_actions)
.groupBy(function(a){ return a.post_action_type_id; }) .groupBy(function(a){ return a.post_action_type_id; })
.map(function(v,k){ .map(function(v,k){
return Em.String.i18n('admin.flags.summary.action_type_' + k, {count: v.length}); return I18n.t('admin.flags.summary.action_type_' + k, {count: v.length});
}) })
.join(','); .join(',');
}.property(), }.property(),
@ -23,7 +23,7 @@ Discourse.FlaggedPost = Discourse.Post.extend({
r = []; r = [];
_.each(this.post_actions, function(action) { _.each(this.post_actions, function(action) {
var user = _this.userLookup[action.user_id]; var user = _this.userLookup[action.user_id];
var flagType = Em.String.i18n('admin.flags.summary.action_type_' + action.post_action_type_id, {count: 1}); var flagType = I18n.t('admin.flags.summary.action_type_' + action.post_action_type_id, {count: 1});
r.push({user: user, flagType: flagType, flaggedAt: action.created_at}); r.push({user: user, flagType: flagType, flaggedAt: action.created_at});
}); });
return r; return r;

View File

@ -55,7 +55,7 @@ Discourse.SiteCustomization = Discourse.Model.extend({
save: function() { save: function() {
this.set('savingStatus', Em.String.i18n('saving')); this.set('savingStatus', I18n.t('saving'));
this.set('saving',true); this.set('saving',true);
var data = { var data = {
name: this.name, name: this.name,
@ -74,7 +74,7 @@ Discourse.SiteCustomization = Discourse.Model.extend({
siteCustomization.set('id', result.id); siteCustomization.set('id', result.id);
siteCustomization.set('key', result.key); siteCustomization.set('key', result.key);
} }
siteCustomization.set('savingStatus', Em.String.i18n('saved')); siteCustomization.set('savingStatus', I18n.t('saved'));
siteCustomization.set('saving',false); siteCustomization.set('saving',false);
siteCustomization.startTrackingChanges(); siteCustomization.startTrackingChanges();
}); });

View File

@ -137,7 +137,7 @@ Discourse = Ember.Application.createWithMixins({
$('#main').on('click.discourse', '[data-not-implemented=true]', function(e) { $('#main').on('click.discourse', '[data-not-implemented=true]', function(e) {
e.preventDefault(); e.preventDefault();
alert(Em.String.i18n('not_implemented')); alert(I18n.t('not_implemented'));
return false; return false;
}); });

View File

@ -88,7 +88,7 @@ Discourse.Formatter = (function(){
var formatted; var formatted;
var t = function(key,opts){ var t = function(key,opts){
return Ember.String.i18n("dates." + format + "." + key, opts); return I18n.t("dates." + format + "." + key, opts);
}; };
switch(true){ switch(true){
@ -133,7 +133,7 @@ Discourse.Formatter = (function(){
distanceInMinutes = Math.round(distance / 60.0); distanceInMinutes = Math.round(distance / 60.0);
var t = function(key, opts){ var t = function(key, opts){
return Ember.String.i18n("dates.medium" + (leaveAgo?"_with_ago":"") + "." + key, opts); return I18n.t("dates.medium" + (leaveAgo?"_with_ago":"") + "." + key, opts);
}; };
switch(true){ switch(true){
@ -173,7 +173,7 @@ Discourse.Formatter = (function(){
oneMinuteAgo = 60; oneMinuteAgo = 60;
if (distance < oneMinuteAgo) { if (distance < oneMinuteAgo) {
displayDate = Em.String.i18n("now"); displayDate = I18n.t("now");
} else if (distance > fiveDaysAgo) { } else if (distance > fiveDaysAgo) {
if ((new Date()).getFullYear() !== date.getFullYear()) { if ((new Date()).getFullYear() !== date.getFullYear()) {
displayDate = shortDate(date); displayDate = shortDate(date);

View File

@ -45,42 +45,42 @@ Discourse.Markdown = {
var editorOptions = { var editorOptions = {
strings: { strings: {
bold: I18n.t("js.composer.bold_title") + " <strong> Ctrl+B", bold: I18n.t("composer.bold_title") + " <strong> Ctrl+B",
boldexample: I18n.t("js.composer.bold_text"), boldexample: I18n.t("composer.bold_text"),
italic: I18n.t("js.composer.italic_title") + " <em> Ctrl+I", italic: I18n.t("composer.italic_title") + " <em> Ctrl+I",
italicexample: I18n.t("js.composer.italic_text"), italicexample: I18n.t("composer.italic_text"),
link: I18n.t("js.composer.link_title") + " <a> Ctrl+L", link: I18n.t("composer.link_title") + " <a> Ctrl+L",
linkdescription: I18n.t("js.composer.link_description"), linkdescription: I18n.t("composer.link_description"),
linkdialog: "<p><b>" + I18n.t("js.composer.link_dialog_title") + "</b></p><p>http://example.com/ \"" + linkdialog: "<p><b>" + I18n.t("composer.link_dialog_title") + "</b></p><p>http://example.com/ \"" +
I18n.t("js.composer.link_optional_text") + "\"</p>", I18n.t("composer.link_optional_text") + "\"</p>",
quote: I18n.t("js.composer.quote_title") + " <blockquote> Ctrl+Q", quote: I18n.t("composer.quote_title") + " <blockquote> Ctrl+Q",
quoteexample: I18n.t("js.composer.quote_text"), quoteexample: I18n.t("composer.quote_text"),
code: I18n.t("js.composer.code_title") + " <pre><code> Ctrl+K", code: I18n.t("composer.code_title") + " <pre><code> Ctrl+K",
codeexample: I18n.t("js.composer.code_text"), codeexample: I18n.t("composer.code_text"),
image: I18n.t("js.composer.image_title") + " <img> Ctrl+G", image: I18n.t("composer.image_title") + " <img> Ctrl+G",
imagedescription: I18n.t("js.composer.image_description"), imagedescription: I18n.t("composer.image_description"),
imagedialog: "<p><b>" + I18n.t("js.composer.image_dialog_title") + "</b></p><p>http://example.com/images/diagram.jpg \"" + imagedialog: "<p><b>" + I18n.t("composer.image_dialog_title") + "</b></p><p>http://example.com/images/diagram.jpg \"" +
I18n.t("js.composer.image_optional_text") + "\"<br><br>" + I18n.t("js.composer.image_hosting_hint") + "</p>", I18n.t("composer.image_optional_text") + "\"<br><br>" + I18n.t("composer.image_hosting_hint") + "</p>",
olist: I18n.t("js.composer.olist_title") + " <ol> Ctrl+O", olist: I18n.t("composer.olist_title") + " <ol> Ctrl+O",
ulist: I18n.t("js.composer.ulist_title") + " <ul> Ctrl+U", ulist: I18n.t("composer.ulist_title") + " <ul> Ctrl+U",
litem: I18n.t("js.composer.list_item"), litem: I18n.t("composer.list_item"),
heading: I18n.t("js.composer.heading_title") + " <h1>/<h2> Ctrl+H", heading: I18n.t("composer.heading_title") + " <h1>/<h2> Ctrl+H",
headingexample: I18n.t("js.composer.heading_text"), headingexample: I18n.t("composer.heading_text"),
hr: I18n.t("js.composer.hr_title") + " <hr> Ctrl+R", hr: I18n.t("composer.hr_title") + " <hr> Ctrl+R",
undo: I18n.t("js.composer.undo_title") + " - Ctrl+Z", undo: I18n.t("composer.undo_title") + " - Ctrl+Z",
redo: I18n.t("js.composer.redo_title") + " - Ctrl+Y", redo: I18n.t("composer.redo_title") + " - Ctrl+Y",
redomac: I18n.t("js.composer.redo_title") + " - Ctrl+Shift+Z", redomac: I18n.t("composer.redo_title") + " - Ctrl+Shift+Z",
help: I18n.t("js.composer.help") help: I18n.t("composer.help")
} }
}; };

View File

@ -168,13 +168,13 @@ Discourse.Utilities = {
if (files) { if (files) {
// can only upload one file at a time // can only upload one file at a time
if (files.length > 1) { if (files.length > 1) {
bootbox.alert(Em.String.i18n('post.errors.too_many_uploads')); bootbox.alert(I18n.t('post.errors.too_many_uploads'));
return false; return false;
} else if (files.length > 0) { } else if (files.length > 0) {
var upload = files[0]; var upload = files[0];
// ensures that new users can upload image // ensures that new users can upload image
if (Discourse.User.current('trust_level') === 0 && Discourse.SiteSettings.newuser_max_images === 0) { if (Discourse.User.current('trust_level') === 0 && Discourse.SiteSettings.newuser_max_images === 0) {
bootbox.alert(Em.String.i18n('post.errors.upload_not_allowed_for_new_user')); bootbox.alert(I18n.t('post.errors.upload_not_allowed_for_new_user'));
return false; return false;
} }
// if the image was pasted, sets its name to a default one // if the image was pasted, sets its name to a default one
@ -182,14 +182,14 @@ Discourse.Utilities = {
// check that the uploaded file is authorized // check that the uploaded file is authorized
if (!Discourse.Utilities.isAuthorizedUpload(upload)) { if (!Discourse.Utilities.isAuthorizedUpload(upload)) {
var extensions = Discourse.SiteSettings.authorized_extensions.replace(/\|/g, ", "); var extensions = Discourse.SiteSettings.authorized_extensions.replace(/\|/g, ", ");
bootbox.alert(Em.String.i18n('post.errors.upload_not_authorized', { authorized_extensions: extensions })); bootbox.alert(I18n.t('post.errors.upload_not_authorized', { authorized_extensions: extensions }));
return false; return false;
} }
// check file size // check file size
if (upload.size && upload.size > 0) { if (upload.size && upload.size > 0) {
var fileSizeInKB = upload.size / 1024; var fileSizeInKB = upload.size / 1024;
if (fileSizeInKB > Discourse.SiteSettings.max_upload_size_kb) { if (fileSizeInKB > Discourse.SiteSettings.max_upload_size_kb) {
bootbox.alert(Em.String.i18n('post.errors.upload_too_large', { max_size_kb: Discourse.SiteSettings.max_upload_size_kb })); bootbox.alert(I18n.t('post.errors.upload_too_large', { max_size_kb: Discourse.SiteSettings.max_upload_size_kb }));
return false; return false;
} }
// everything is fine // everything is fine

View File

@ -55,17 +55,17 @@ Discourse.ComposerController = Discourse.Controller.extend({
topic = this.get('topic'); topic = this.get('topic');
if (!topic || topic.get('id') !== composer.get('topic.id')) if (!topic || topic.get('id') !== composer.get('topic.id'))
{ {
message = Em.String.i18n("composer.posting_not_on_topic", {title: this.get('model.topic.title')}); message = I18n.t("composer.posting_not_on_topic", {title: this.get('model.topic.title')});
buttons = [{ buttons = [{
"label": Em.String.i18n("composer.cancel"), "label": I18n.t("composer.cancel"),
"class": "cancel", "class": "cancel",
"link": true "link": true
}]; }];
if(topic) { if(topic) {
buttons.push({ buttons.push({
"label": Em.String.i18n("composer.reply_here") + "<br/><div class='topic-title'>" + topic.get('title') + "</div>", "label": I18n.t("composer.reply_here") + "<br/><div class='topic-title'>" + topic.get('title') + "</div>",
"class": "btn btn-reply-here", "class": "btn btn-reply-here",
"callback": function(){ "callback": function(){
composer.set('topic', topic); composer.set('topic', topic);
@ -76,7 +76,7 @@ Discourse.ComposerController = Discourse.Controller.extend({
} }
buttons.push({ buttons.push({
"label": Em.String.i18n("composer.reply_original") + "<br/><div class='topic-title'>" + this.get('model.topic.title') + "</div>", "label": I18n.t("composer.reply_original") + "<br/><div class='topic-title'>" + this.get('model.topic.title') + "</div>",
"class": "btn-primary btn-reply-on-original", "class": "btn-primary btn-reply-on-original",
"callback": function(){ "callback": function(){
_this.save(true); _this.save(true);
@ -301,7 +301,7 @@ Discourse.ComposerController = Discourse.Controller.extend({
return Ember.Deferred.promise(function (promise) { return Ember.Deferred.promise(function (promise) {
if (composerController.get('model.hasMetaData') || composerController.get('model.replyDirty')) { if (composerController.get('model.hasMetaData') || composerController.get('model.replyDirty')) {
bootbox.confirm(Em.String.i18n("post.abandon"), Em.String.i18n("no_value"), Em.String.i18n("yes_value"), function(result) { bootbox.confirm(I18n.t("post.abandon"), I18n.t("no_value"), I18n.t("yes_value"), function(result) {
if (result) { if (result) {
composerController.destroyDraft(); composerController.destroyDraft();
composerController.get('model').clearState(); composerController.get('model').clearState();

View File

@ -42,14 +42,14 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
if (this.get('accountName').length < 3) { if (this.get('accountName').length < 3) {
return Discourse.InputValidation.create({ return Discourse.InputValidation.create({
failed: true, failed: true,
reason: Em.String.i18n('user.name.too_short') reason: I18n.t('user.name.too_short')
}); });
} }
// Looks good! // Looks good!
return Discourse.InputValidation.create({ return Discourse.InputValidation.create({
ok: true, ok: true,
reason: Em.String.i18n('user.name.ok') reason: I18n.t('user.name.ok')
}); });
}.property('accountName'), }.property('accountName'),
@ -67,7 +67,7 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
if ((this.get('authOptions.email') === email) && this.get('authOptions.email_valid')) { if ((this.get('authOptions.email') === email) && this.get('authOptions.email_valid')) {
return Discourse.InputValidation.create({ return Discourse.InputValidation.create({
ok: true, ok: true,
reason: Em.String.i18n('user.email.authenticated', { reason: I18n.t('user.email.authenticated', {
provider: this.get('authOptions.auth_provider') provider: this.get('authOptions.auth_provider')
}) })
}); });
@ -76,13 +76,13 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
if (Discourse.Utilities.emailValid(email)) { if (Discourse.Utilities.emailValid(email)) {
return Discourse.InputValidation.create({ return Discourse.InputValidation.create({
ok: true, ok: true,
reason: Em.String.i18n('user.email.ok') reason: I18n.t('user.email.ok')
}); });
} }
return Discourse.InputValidation.create({ return Discourse.InputValidation.create({
failed: true, failed: true,
reason: Em.String.i18n('user.email.invalid') reason: I18n.t('user.email.invalid')
}); });
}.property('accountEmail'), }.property('accountEmail'),
@ -92,7 +92,7 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
if (this.shouldCheckUsernameMatch()) { if (this.shouldCheckUsernameMatch()) {
return this.set('uniqueUsernameValidation', Discourse.InputValidation.create({ return this.set('uniqueUsernameValidation', Discourse.InputValidation.create({
failed: true, failed: true,
reason: Em.String.i18n('user.username.enter_email') reason: I18n.t('user.username.enter_email')
})); }));
} else { } else {
return this.set('uniqueUsernameValidation', Discourse.InputValidation.create({ failed: true })); return this.set('uniqueUsernameValidation', Discourse.InputValidation.create({ failed: true }));
@ -100,7 +100,7 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
} else if (this.shouldCheckUsernameMatch()) { } else if (this.shouldCheckUsernameMatch()) {
this.set('uniqueUsernameValidation', Discourse.InputValidation.create({ this.set('uniqueUsernameValidation', Discourse.InputValidation.create({
failed: true, failed: true,
reason: Em.String.i18n('user.username.checking') reason: I18n.t('user.username.checking')
})); }));
return this.checkUsernameAvailability(); return this.checkUsernameAvailability();
} }
@ -121,7 +121,7 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
if (this.get('accountUsername').length < 3) { if (this.get('accountUsername').length < 3) {
return Discourse.InputValidation.create({ return Discourse.InputValidation.create({
failed: true, failed: true,
reason: Em.String.i18n('user.username.too_short') reason: I18n.t('user.username.too_short')
}); });
} }
@ -129,7 +129,7 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
if (this.get('accountUsername').length > 15) { if (this.get('accountUsername').length > 15) {
return Discourse.InputValidation.create({ return Discourse.InputValidation.create({
failed: true, failed: true,
reason: Em.String.i18n('user.username.too_long') reason: I18n.t('user.username.too_long')
}); });
} }
@ -137,7 +137,7 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
// Let's check it out asynchronously // Let's check it out asynchronously
return Discourse.InputValidation.create({ return Discourse.InputValidation.create({
failed: true, failed: true,
reason: Em.String.i18n('user.username.checking') reason: I18n.t('user.username.checking')
}); });
}.property('accountUsername'), }.property('accountUsername'),
@ -155,12 +155,12 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
_this.set('globalNicknameExists', true); _this.set('globalNicknameExists', true);
return _this.set('uniqueUsernameValidation', Discourse.InputValidation.create({ return _this.set('uniqueUsernameValidation', Discourse.InputValidation.create({
ok: true, ok: true,
reason: Em.String.i18n('user.username.global_match') reason: I18n.t('user.username.global_match')
})); }));
} else { } else {
return _this.set('uniqueUsernameValidation', Discourse.InputValidation.create({ return _this.set('uniqueUsernameValidation', Discourse.InputValidation.create({
ok: true, ok: true,
reason: Em.String.i18n('user.username.available') reason: I18n.t('user.username.available')
})); }));
} }
} else { } else {
@ -169,12 +169,12 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
_this.set('globalNicknameExists', true); _this.set('globalNicknameExists', true);
return _this.set('uniqueUsernameValidation', Discourse.InputValidation.create({ return _this.set('uniqueUsernameValidation', Discourse.InputValidation.create({
failed: true, failed: true,
reason: Em.String.i18n('user.username.global_mismatch', result) reason: I18n.t('user.username.global_mismatch', result)
})); }));
} else { } else {
return _this.set('uniqueUsernameValidation', Discourse.InputValidation.create({ return _this.set('uniqueUsernameValidation', Discourse.InputValidation.create({
failed: true, failed: true,
reason: Em.String.i18n('user.username.not_available', result) reason: I18n.t('user.username.not_available', result)
})); }));
} }
} else if (result.errors) { } else if (result.errors) {
@ -186,7 +186,7 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
_this.set('globalNicknameExists', true); _this.set('globalNicknameExists', true);
return _this.set('uniqueUsernameValidation', Discourse.InputValidation.create({ return _this.set('uniqueUsernameValidation', Discourse.InputValidation.create({
failed: true, failed: true,
reason: Em.String.i18n('user.username.enter_email') reason: I18n.t('user.username.enter_email')
})); }));
} }
} }
@ -228,14 +228,14 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
if (password.length < 6) { if (password.length < 6) {
return Discourse.InputValidation.create({ return Discourse.InputValidation.create({
failed: true, failed: true,
reason: Em.String.i18n('user.password.too_short') reason: I18n.t('user.password.too_short')
}); });
} }
// Looks good! // Looks good!
return Discourse.InputValidation.create({ return Discourse.InputValidation.create({
ok: true, ok: true,
reason: Em.String.i18n('user.password.ok') reason: I18n.t('user.password.ok')
}); });
}.property('accountPassword'), }.property('accountPassword'),
@ -261,7 +261,7 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
createAccountController.flash(result.message); createAccountController.flash(result.message);
createAccountController.set('complete', true); createAccountController.set('complete', true);
} else { } else {
createAccountController.flash(result.message || Em.String.i18n('create_account.failed'), 'error'); createAccountController.flash(result.message || I18n.t('create_account.failed'), 'error');
createAccountController.set('formSubmitted', false); createAccountController.set('formSubmitted', false);
} }
if (result.active) { if (result.active) {
@ -269,8 +269,8 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
} }
}, function() { }, function() {
createAccountController.set('formSubmitted', false); createAccountController.set('formSubmitted', false);
return createAccountController.flash(Em.String.i18n('create_account.failed'), 'error'); return createAccountController.flash(I18n.t('create_account.failed'), 'error');
}); });
} }
}); });

View File

@ -22,9 +22,9 @@ Discourse.EditCategoryController = Discourse.ObjectController.extend(Discourse.M
}.observes('description'), }.observes('description'),
title: function() { title: function() {
if (this.get('id')) return Em.String.i18n("category.edit_long"); if (this.get('id')) return I18n.t("category.edit_long");
if (this.get('isUncategorized')) return Em.String.i18n("category.edit_uncategorized"); if (this.get('isUncategorized')) return I18n.t("category.edit_uncategorized");
return Em.String.i18n("category.create"); return I18n.t("category.create");
}.property('id'), }.property('id'),
titleChanged: function() { titleChanged: function() {
@ -82,17 +82,17 @@ Discourse.EditCategoryController = Discourse.ObjectController.extend(Discourse.M
categoryName: function() { categoryName: function() {
var name = this.get('name') || ""; var name = this.get('name') || "";
return name.trim().length > 0 ? name : Em.String.i18n("preview"); return name.trim().length > 0 ? name : I18n.t("preview");
}.property('name'), }.property('name'),
buttonTitle: function() { buttonTitle: function() {
if (this.get('saving')) return Em.String.i18n("saving"); if (this.get('saving')) return I18n.t("saving");
if (this.get('isUncategorized')) return Em.String.i18n("save"); if (this.get('isUncategorized')) return I18n.t("save");
return (this.get('id') ? Em.String.i18n("category.save") : Em.String.i18n("category.create")); return (this.get('id') ? I18n.t("category.save") : I18n.t("category.create"));
}.property('saving', 'id'), }.property('saving', 'id'),
deleteButtonTitle: function() { deleteButtonTitle: function() {
return Em.String.i18n('category.delete'); return I18n.t('category.delete');
}.property(), }.property(),
showCategoryTopic: function() { showCategoryTopic: function() {
@ -129,7 +129,7 @@ Discourse.EditCategoryController = Discourse.ObjectController.extend(Discourse.M
Discourse.URL.redirectTo("/categories"); Discourse.URL.redirectTo("/categories");
}, function(errors) { }, function(errors) {
// errors // errors
if(errors.length === 0) errors.push(Em.String.i18n("category.save_error")); if(errors.length === 0) errors.push(I18n.t("category.save_error"));
categoryController.displayErrors(errors); categoryController.displayErrors(errors);
categoryController.set('saving', false); categoryController.set('saving', false);
}); });
@ -140,7 +140,7 @@ Discourse.EditCategoryController = Discourse.ObjectController.extend(Discourse.M
Discourse.URL.redirectTo("/category/" + Discourse.Category.slugFor(result.category)); Discourse.URL.redirectTo("/category/" + Discourse.Category.slugFor(result.category));
}, function(errors) { }, function(errors) {
// errors // errors
if(errors.length === 0) errors.push(Em.String.i18n("category.creation_error")); if(errors.length === 0) errors.push(I18n.t("category.creation_error"));
categoryController.displayErrors(errors); categoryController.displayErrors(errors);
categoryController.set('saving', false); categoryController.set('saving', false);
}); });
@ -152,7 +152,7 @@ Discourse.EditCategoryController = Discourse.ObjectController.extend(Discourse.M
this.set('deleting', true); this.set('deleting', true);
$('#discourse-modal').modal('hide'); $('#discourse-modal').modal('hide');
bootbox.confirm(Em.String.i18n("category.delete_confirm"), Em.String.i18n("no_value"), Em.String.i18n("yes_value"), function(result) { bootbox.confirm(I18n.t("category.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), function(result) {
if (result) { if (result) {
categoryController.get('model').destroy().then(function(){ categoryController.get('model').destroy().then(function(){
// success // success
@ -161,7 +161,7 @@ Discourse.EditCategoryController = Discourse.ObjectController.extend(Discourse.M
}, function(jqXHR){ }, function(jqXHR){
// error // error
$('#discourse-modal').modal('show'); $('#discourse-modal').modal('show');
categoryController.displayErrors([Em.String.i18n("category.delete_error")]); categoryController.displayErrors([I18n.t("category.delete_error")]);
categoryController.set('deleting', false); categoryController.set('deleting', false);
}); });
} else { } else {
@ -172,4 +172,4 @@ Discourse.EditCategoryController = Discourse.ObjectController.extend(Discourse.M
} }
}); });

View File

@ -38,7 +38,7 @@ Discourse.EditTopicAutoCloseController = Discourse.ObjectController.extend(Disco
}).then(function(){ }).then(function(){
editTopicAutoCloseController.set('details.auto_close_at', moment().add('days', days).format()); editTopicAutoCloseController.set('details.auto_close_at', moment().add('days', days).format());
}, function (error) { }, function (error) {
bootbox.alert(Em.String.i18n('generic_error')); bootbox.alert(I18n.t('generic_error'));
}); });
} }

View File

@ -12,7 +12,7 @@ Discourse.FlagActionTypeController = Discourse.ObjectController.extend({
message: Em.computed.alias('controllers.flag.message'), message: Em.computed.alias('controllers.flag.message'),
customPlaceholder: function(){ customPlaceholder: function(){
return Em.String.i18n("flagging.custom_placeholder_" + this.get('name_key')); return I18n.t("flagging.custom_placeholder_" + this.get('name_key'));
}.property('name_key'), }.property('name_key'),
formattedName: function(){ formattedName: function(){
@ -34,11 +34,11 @@ Discourse.FlagActionTypeController = Discourse.ObjectController.extend({
var len = this.get('message.length') || 0; var len = this.get('message.length') || 0;
var minLen = Discourse.SiteSettings.min_private_message_post_length; var minLen = Discourse.SiteSettings.min_private_message_post_length;
if (len === 0) { if (len === 0) {
return Em.String.i18n("flagging.custom_message.at_least", { n: minLen }); return I18n.t("flagging.custom_message.at_least", { n: minLen });
} else if (len < minLen) { } else if (len < minLen) {
return Em.String.i18n("flagging.custom_message.more", { n: minLen - len }); return I18n.t("flagging.custom_message.more", { n: minLen - len });
} else { } else {
return Em.String.i18n("flagging.custom_message.left", { return I18n.t("flagging.custom_message.left", {
n: Discourse.PostActionType.MAX_MESSAGE_LENGTH - len n: Discourse.PostActionType.MAX_MESSAGE_LENGTH - len
}); });
} }

View File

@ -36,9 +36,9 @@ Discourse.FlagController = Discourse.ObjectController.extend(Discourse.ModalFunc
submitText: function(){ submitText: function(){
if (this.get('selected.is_custom_flag')) { if (this.get('selected.is_custom_flag')) {
return Em.String.i18n("flagging.notify_action"); return I18n.t("flagging.notify_action");
} else { } else {
return Em.String.i18n("flagging.action"); return I18n.t("flagging.action");
} }
}.property('selected.is_custom_flag'), }.property('selected.is_custom_flag'),

View File

@ -22,8 +22,8 @@ Discourse.ForgotPasswordController = Discourse.Controller.extend(Discourse.Modal
}); });
// don't tell people what happened, this keeps it more secure (ensure same on server) // don't tell people what happened, this keeps it more secure (ensure same on server)
this.flash(Em.String.i18n('forgot_password.complete')); this.flash(I18n.t('forgot_password.complete'));
return false; return false;
} }
}); });

View File

@ -72,7 +72,7 @@ Discourse.HistoryController = Discourse.ObjectController.extend(Discourse.ModalF
leaveAgo: true, leaveAgo: true,
wrapInSpan: false}); wrapInSpan: false});
item.description = "v" + item.number + " - " + age + " - " + Em.String.i18n("changed_by", { author: item.display_username }); item.description = "v" + item.number + " - " + age + " - " + I18n.t("changed_by", { author: item.display_username });
}); });
historyController.setProperties({ historyController.setProperties({

View File

@ -17,12 +17,12 @@ Discourse.InviteController = Discourse.ObjectController.extend(Discourse.ModalFu
}.property('email', 'saving'), }.property('email', 'saving'),
buttonTitle: function() { buttonTitle: function() {
if (this.get('saving')) return Em.String.i18n('topic.inviting'); if (this.get('saving')) return I18n.t('topic.inviting');
return Em.String.i18n('topic.invite_reply.action'); return I18n.t('topic.invite_reply.action');
}.property('saving'), }.property('saving'),
successMessage: function() { successMessage: function() {
return Em.String.i18n('topic.invite_reply.success', { email: this.get('email') }); return I18n.t('topic.invite_reply.success', { email: this.get('email') });
}.property('email'), }.property('email'),
createInvite: function() { createInvite: function() {
@ -43,4 +43,4 @@ Discourse.InviteController = Discourse.ObjectController.extend(Discourse.ModalFu
return false; return false;
} }
}); });

View File

@ -22,8 +22,8 @@ Discourse.InvitePrivateController = Discourse.ObjectController.extend(Discourse.
}.property('emailOrUsername', 'saving'), }.property('emailOrUsername', 'saving'),
buttonTitle: function() { buttonTitle: function() {
if (this.get('saving')) return Em.String.i18n('topic.inviting'); if (this.get('saving')) return I18n.t('topic.inviting');
return Em.String.i18n('topic.invite_private.action'); return I18n.t('topic.invite_private.action');
}.property('saving'), }.property('saving'),
invite: function() { invite: function() {

View File

@ -92,12 +92,12 @@ Discourse.ListController = Discourse.Controller.extend({
// Put in the appropriate page title based on our view // Put in the appropriate page title based on our view
updateTitle: function() { updateTitle: function() {
if (this.get('filterMode') === 'categories') { if (this.get('filterMode') === 'categories') {
return Discourse.set('title', Em.String.i18n('categories_list')); return Discourse.set('title', I18n.t('categories_list'));
} else { } else {
if (this.present('category')) { if (this.present('category')) {
return Discourse.set('title', this.get('category.name').capitalize() + " " + Em.String.i18n('topic.list')); return Discourse.set('title', this.get('category.name').capitalize() + " " + I18n.t('topic.list'));
} else { } else {
return Discourse.set('title', Em.String.i18n('topic.list')); return Discourse.set('title', I18n.t('topic.list'));
} }
} }
}.observes('filterMode', 'category'), }.observes('filterMode', 'category'),

View File

@ -65,15 +65,15 @@ Discourse.ListTopicsController = Discourse.ObjectController.extend({
if (!this.get('allLoaded')) return; if (!this.get('allLoaded')) return;
var category = this.get('category'); var category = this.get('category');
if( category ) { if( category ) {
return Em.String.i18n('topics.bottom.category', {category: category.get('name')}); return I18n.t('topics.bottom.category', {category: category.get('name')});
} else { } else {
var split = this.get('filter').split('/'); var split = this.get('filter').split('/');
if (this.get('topics.length') === 0) { if (this.get('topics.length') === 0) {
return Em.String.i18n("topics.none." + split[0], { return I18n.t("topics.none." + split[0], {
category: split[1] category: split[1]
}); });
} else { } else {
return Em.String.i18n("topics.bottom." + split[0], { return I18n.t("topics.bottom." + split[0], {
category: split[1] category: split[1]
}); });
} }

View File

@ -31,7 +31,7 @@ Discourse.LoginController = Discourse.Controller.extend(Discourse.ModalFunctiona
}.property(), }.property(),
loginButtonText: function() { loginButtonText: function() {
return this.get('loggingIn') ? Em.String.i18n('login.logging_in') : Em.String.i18n('login.title'); return this.get('loggingIn') ? I18n.t('login.logging_in') : I18n.t('login.title');
}.property('loggingIn'), }.property('loggingIn'),
loginDisabled: function() { loginDisabled: function() {
@ -69,7 +69,7 @@ Discourse.LoginController = Discourse.Controller.extend(Discourse.ModalFunctiona
}, function(result) { }, function(result) {
// Failed to login // Failed to login
loginController.flash(Em.String.i18n('login.error'), 'error'); loginController.flash(I18n.t('login.error'), 'error');
loginController.set('loggingIn', false); loginController.set('loggingIn', false);
}); });
@ -78,7 +78,7 @@ Discourse.LoginController = Discourse.Controller.extend(Discourse.ModalFunctiona
authMessage: (function() { authMessage: (function() {
if (this.blank('authenticate')) return ""; if (this.blank('authenticate')) return "";
return Em.String.i18n("login." + (this.get('authenticate')) + ".message"); return I18n.t("login." + (this.get('authenticate')) + ".message");
}).property('authenticate'), }).property('authenticate'),
twitterLogin: function() { twitterLogin: function() {
@ -128,12 +128,12 @@ Discourse.LoginController = Discourse.Controller.extend(Discourse.ModalFunctiona
authenticationComplete: function(options) { authenticationComplete: function(options) {
if (options.awaiting_approval) { if (options.awaiting_approval) {
this.flash(Em.String.i18n('login.awaiting_approval'), 'success'); this.flash(I18n.t('login.awaiting_approval'), 'success');
this.set('authenticate', null); this.set('authenticate', null);
return; return;
} }
if (options.awaiting_activation) { if (options.awaiting_activation) {
this.flash(Em.String.i18n('login.awaiting_confirmation'), 'success'); this.flash(I18n.t('login.awaiting_confirmation'), 'success');
this.set('authenticate', null); this.set('authenticate', null);
return; return;
} }
@ -157,4 +157,4 @@ Discourse.LoginController = Discourse.Controller.extend(Discourse.ModalFunctiona
this.send('showCreateAccount'); this.send('showCreateAccount');
} }
}); });

View File

@ -20,8 +20,8 @@ Discourse.MergeTopicController = Discourse.ObjectController.extend(Discourse.Sel
}.property('selectedTopicId', 'saving'), }.property('selectedTopicId', 'saving'),
buttonTitle: function() { buttonTitle: function() {
if (this.get('saving')) return Em.String.i18n('saving'); if (this.get('saving')) return I18n.t('saving');
return Em.String.i18n('topic.merge_topic.title'); return I18n.t('topic.merge_topic.title');
}.property('saving'), }.property('saving'),
movePostsToExistingTopic: function() { movePostsToExistingTopic: function() {
@ -46,10 +46,10 @@ Discourse.MergeTopicController = Discourse.ObjectController.extend(Discourse.Sel
Em.run.next(function() { Discourse.URL.routeTo(result.url); }); Em.run.next(function() { Discourse.URL.routeTo(result.url); });
}, function() { }, function() {
// Error moving posts // Error moving posts
mergeTopicController.flash(Em.String.i18n('topic.merge_topic.error')); mergeTopicController.flash(I18n.t('topic.merge_topic.error'));
mergeTopicController.set('saving', false); mergeTopicController.set('saving', false);
}); });
return false; return false;
} }
}); });

View File

@ -20,35 +20,35 @@ Discourse.PreferencesController = Discourse.ObjectController.extend({
digestFrequencies: (function() { digestFrequencies: (function() {
var freqs; var freqs;
freqs = Em.A(); freqs = Em.A();
freqs.addObject({ name: Em.String.i18n('user.email_digests.daily'), value: 1 }); freqs.addObject({ name: I18n.t('user.email_digests.daily'), value: 1 });
freqs.addObject({ name: Em.String.i18n('user.email_digests.weekly'), value: 7 }); freqs.addObject({ name: I18n.t('user.email_digests.weekly'), value: 7 });
freqs.addObject({ name: Em.String.i18n('user.email_digests.bi_weekly'), value: 14 }); freqs.addObject({ name: I18n.t('user.email_digests.bi_weekly'), value: 14 });
return freqs; return freqs;
}).property(), }).property(),
autoTrackDurations: (function() { autoTrackDurations: (function() {
var freqs; var freqs;
freqs = Em.A(); freqs = Em.A();
freqs.addObject({ name: Em.String.i18n('user.auto_track_options.never'), value: -1 }); freqs.addObject({ name: I18n.t('user.auto_track_options.never'), value: -1 });
freqs.addObject({ name: Em.String.i18n('user.auto_track_options.always'), value: 0 }); freqs.addObject({ name: I18n.t('user.auto_track_options.always'), value: 0 });
freqs.addObject({ name: Em.String.i18n('user.auto_track_options.after_n_seconds', { count: 30 }), value: 30000 }); freqs.addObject({ name: I18n.t('user.auto_track_options.after_n_seconds', { count: 30 }), value: 30000 });
freqs.addObject({ name: Em.String.i18n('user.auto_track_options.after_n_minutes', { count: 1 }), value: 60000 }); freqs.addObject({ name: I18n.t('user.auto_track_options.after_n_minutes', { count: 1 }), value: 60000 });
freqs.addObject({ name: Em.String.i18n('user.auto_track_options.after_n_minutes', { count: 2 }), value: 120000 }); freqs.addObject({ name: I18n.t('user.auto_track_options.after_n_minutes', { count: 2 }), value: 120000 });
freqs.addObject({ name: Em.String.i18n('user.auto_track_options.after_n_minutes', { count: 3 }), value: 180000 }); freqs.addObject({ name: I18n.t('user.auto_track_options.after_n_minutes', { count: 3 }), value: 180000 });
freqs.addObject({ name: Em.String.i18n('user.auto_track_options.after_n_minutes', { count: 4 }), value: 240000 }); freqs.addObject({ name: I18n.t('user.auto_track_options.after_n_minutes', { count: 4 }), value: 240000 });
freqs.addObject({ name: Em.String.i18n('user.auto_track_options.after_n_minutes', { count: 5 }), value: 300000 }); freqs.addObject({ name: I18n.t('user.auto_track_options.after_n_minutes', { count: 5 }), value: 300000 });
freqs.addObject({ name: Em.String.i18n('user.auto_track_options.after_n_minutes', { count: 10 }), value: 600000 }); freqs.addObject({ name: I18n.t('user.auto_track_options.after_n_minutes', { count: 10 }), value: 600000 });
return freqs; return freqs;
}).property(), }).property(),
considerNewTopicOptions: (function() { considerNewTopicOptions: (function() {
var opts; var opts;
opts = Em.A(); opts = Em.A();
opts.addObject({ name: Em.String.i18n('user.new_topic_duration.not_viewed'), value: -1 }); opts.addObject({ name: I18n.t('user.new_topic_duration.not_viewed'), value: -1 });
opts.addObject({ name: Em.String.i18n('user.new_topic_duration.after_n_days', { count: 1 }), value: 60 * 24 }); opts.addObject({ name: I18n.t('user.new_topic_duration.after_n_days', { count: 1 }), value: 60 * 24 });
opts.addObject({ name: Em.String.i18n('user.new_topic_duration.after_n_days', { count: 2 }), value: 60 * 48 }); opts.addObject({ name: I18n.t('user.new_topic_duration.after_n_days', { count: 2 }), value: 60 * 48 });
opts.addObject({ name: Em.String.i18n('user.new_topic_duration.after_n_weeks', { count: 1 }), value: 7 * 60 * 24 }); opts.addObject({ name: I18n.t('user.new_topic_duration.after_n_weeks', { count: 1 }), value: 7 * 60 * 24 });
opts.addObject({ name: Em.String.i18n('user.new_topic_duration.last_here'), value: -2 }); opts.addObject({ name: I18n.t('user.new_topic_duration.last_here'), value: -2 });
return opts; return opts;
}).property(), }).property(),
@ -72,30 +72,30 @@ Discourse.PreferencesController = Discourse.ObjectController.extend({
}, function() { }, function() {
// model failed to save // model failed to save
preferencesController.set('saving', false); preferencesController.set('saving', false);
alert(Em.String.i18n('generic_error')); alert(I18n.t('generic_error'));
}); });
}, },
saveButtonText: (function() { saveButtonText: (function() {
if (this.get('saving')) return Em.String.i18n('saving'); if (this.get('saving')) return I18n.t('saving');
return Em.String.i18n('save'); return I18n.t('save');
}).property('saving'), }).property('saving'),
changePassword: function() { changePassword: function() {
var preferencesController = this; var preferencesController = this;
if (!this.get('passwordProgress')) { if (!this.get('passwordProgress')) {
this.set('passwordProgress', Em.String.i18n("user.change_password.in_progress")); this.set('passwordProgress', I18n.t("user.change_password.in_progress"));
return this.get('content').changePassword().then(function() { return this.get('content').changePassword().then(function() {
// password changed // password changed
preferencesController.setProperties({ preferencesController.setProperties({
changePasswordProgress: false, changePasswordProgress: false,
passwordProgress: Em.String.i18n("user.change_password.success") passwordProgress: I18n.t("user.change_password.success")
}); });
}, function() { }, function() {
// password failed to change // password failed to change
preferencesController.setProperties({ preferencesController.setProperties({
changePasswordProgress: false, changePasswordProgress: false,
passwordProgress: Em.String.i18n("user.change_password.error") passwordProgress: I18n.t("user.change_password.error")
}); });
}); });
} }

View File

@ -29,8 +29,8 @@ Discourse.PreferencesEmailController = Discourse.ObjectController.extend({
}).observes('content.email'), }).observes('content.email'),
saveButtonText: (function() { saveButtonText: (function() {
if (this.get('saving')) return Em.String.i18n("saving"); if (this.get('saving')) return I18n.t("saving");
return Em.String.i18n("user.change_email.action"); return I18n.t("user.change_email.action");
}).property('saving'), }).property('saving'),
changeEmail: function() { changeEmail: function() {

View File

@ -28,7 +28,7 @@ Discourse.PreferencesUsernameController = Discourse.ObjectController.extend({
checkTaken: function() { checkTaken: function() {
if( this.get('newUsername') && this.get('newUsername').length < 3 ) { if( this.get('newUsername') && this.get('newUsername').length < 3 ) {
this.set('errorMessage', Em.String.i18n('user.name.too_short')); this.set('errorMessage', I18n.t('user.name.too_short'));
} else { } else {
var preferencesUsernameController = this; var preferencesUsernameController = this;
this.set('taken', false); this.set('taken', false);
@ -46,13 +46,13 @@ Discourse.PreferencesUsernameController = Discourse.ObjectController.extend({
}.observes('newUsername'), }.observes('newUsername'),
saveButtonText: function() { saveButtonText: function() {
if (this.get('saving')) return Em.String.i18n("saving"); if (this.get('saving')) return I18n.t("saving");
return Em.String.i18n("user.change_username.action"); return I18n.t("user.change_username.action");
}.property('saving'), }.property('saving'),
changeUsername: function() { changeUsername: function() {
var preferencesUsernameController = this; var preferencesUsernameController = this;
return bootbox.confirm(Em.String.i18n("user.change_username.confirm"), Em.String.i18n("no_value"), Em.String.i18n("yes_value"), function(result) { return bootbox.confirm(I18n.t("user.change_username.confirm"), I18n.t("no_value"), I18n.t("yes_value"), function(result) {
if (result) { if (result) {
preferencesUsernameController.set('saving', true); preferencesUsernameController.set('saving', true);
preferencesUsernameController.get('content').changeUsername(preferencesUsernameController.get('newUsername')).then(function() { preferencesUsernameController.get('content').changeUsername(preferencesUsernameController.get('newUsername')).then(function() {

View File

@ -20,8 +20,8 @@ Discourse.SplitTopicController = Discourse.ObjectController.extend(Discourse.Sel
}.property('saving', 'topicName'), }.property('saving', 'topicName'),
buttonTitle: function() { buttonTitle: function() {
if (this.get('saving')) return Em.String.i18n('saving'); if (this.get('saving')) return I18n.t('saving');
return Em.String.i18n('topic.split_topic.action'); return I18n.t('topic.split_topic.action');
}.property('saving'), }.property('saving'),
movePostsToNewTopic: function() { movePostsToNewTopic: function() {
@ -40,10 +40,10 @@ Discourse.SplitTopicController = Discourse.ObjectController.extend(Discourse.Sel
Em.run.next(function() { Discourse.URL.routeTo(result.url); }); Em.run.next(function() { Discourse.URL.routeTo(result.url); });
}, function() { }, function() {
// Error moving posts // Error moving posts
splitTopicController.flash(Em.String.i18n('topic.split_topic.error')); splitTopicController.flash(I18n.t('topic.split_topic.error'));
splitTopicController.set('saving', false); splitTopicController.set('saving', false);
}); });
return false; return false;
} }
}); });

View File

@ -161,7 +161,7 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
if (error && error.responseText) { if (error && error.responseText) {
bootbox.alert($.parseJSON(error.responseText).errors[0]); bootbox.alert($.parseJSON(error.responseText).errors[0]);
} else { } else {
bootbox.alert(Em.String.i18n('generic_error')); bootbox.alert(I18n.t('generic_error'));
} }
}); });
@ -172,7 +172,7 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
deleteSelected: function() { deleteSelected: function() {
var topicController = this; var topicController = this;
bootbox.confirm(Em.String.i18n("post.delete.confirm", { count: this.get('selectedPostsCount')}), function(result) { bootbox.confirm(I18n.t("post.delete.confirm", { count: this.get('selectedPostsCount')}), function(result) {
if (result) { if (result) {
// If all posts are selected, it's the same thing as deleting the topic // If all posts are selected, it's the same thing as deleting the topic
@ -210,7 +210,7 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
promise.then(function() { promise.then(function() {
Discourse.Post.loadQuote(post.get('id')).then(function(q) { Discourse.Post.loadQuote(post.get('id')).then(function(q) {
composerController.appendText("" + (Em.String.i18n("post.continue_discussion", { composerController.appendText("" + (I18n.t("post.continue_discussion", {
postLink: postLink postLink: postLink
})) + "\n\n" + q); })) + "\n\n" + q);
}); });
@ -251,7 +251,7 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
var topicController = this; var topicController = this;
this.unsubscribe(); this.unsubscribe();
this.get('content').destroy().then(function() { this.get('content').destroy().then(function() {
topicController.set('message', Em.String.i18n('topic.deleted')); topicController.set('message', I18n.t('topic.deleted'));
topicController.set('loaded', false); topicController.set('loaded', false);
}); });
}, },
@ -356,7 +356,7 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
toggleBookmark: function(post) { toggleBookmark: function(post) {
if (!Discourse.User.current()) { if (!Discourse.User.current()) {
alert(Em.String.i18n("bookmarks.not_bookmarked")); alert(I18n.t("bookmarks.not_bookmarked"));
return; return;
} }
post.toggleProperty('bookmarked'); post.toggleProperty('bookmarked');
@ -382,7 +382,7 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
if (Discourse.User.current('staff')) { if (Discourse.User.current('staff')) {
post.set('deleted_at', new Date()); post.set('deleted_at', new Date());
} else { } else {
post.set('cooked', Discourse.Markdown.cook(Em.String.i18n("post.deleted_by_author"))); post.set('cooked', Discourse.Markdown.cook(I18n.t("post.deleted_by_author")));
post.set('can_delete', false); post.set('can_delete', false);
post.set('version', post.get('version') + 1); post.set('version', post.get('version') + 1);
} }

View File

@ -66,7 +66,7 @@ Ember.Handlebars.registerBoundHelper('boundCategoryLink', function(category) {
Handlebars.registerHelper('titledLinkTo', function(name, object) { Handlebars.registerHelper('titledLinkTo', function(name, object) {
var options = [].slice.call(arguments, -1)[0]; var options = [].slice.call(arguments, -1)[0];
if (options.hash.titleKey) { if (options.hash.titleKey) {
options.hash.title = Em.String.i18n(options.hash.titleKey); options.hash.title = I18n.t(options.hash.titleKey);
} }
if (arguments.length === 3) { if (arguments.length === 3) {
return Ember.Handlebars.helpers.linkTo.call(this, name, object, options); return Ember.Handlebars.helpers.linkTo.call(this, name, object, options);
@ -254,7 +254,7 @@ Handlebars.registerHelper('number', function(property, options) {
} }
title = orig; title = orig;
if (options.hash.numberKey) { if (options.hash.numberKey) {
title = Em.String.i18n(options.hash.numberKey, { title = I18n.t(options.hash.numberKey, {
number: orig number: orig
}); });
} }
@ -307,7 +307,7 @@ Handlebars.registerHelper('date', function(property, options) {
Handlebars.registerHelper('faqLink', function(property, options) { Handlebars.registerHelper('faqLink', function(property, options) {
return new Handlebars.SafeString( return new Handlebars.SafeString(
"<a href='" + "<a href='" +
(Discourse.SiteSettings.faq_url.length > 0 ? Discourse.SiteSettings.faq_url : Discourse.getURL('/faq')) + (Discourse.SiteSettings.faq_url.length > 0 ? Discourse.SiteSettings.faq_url : Discourse.getURL('/faq')) +
"'>" + Em.String.i18n('faq') + "</a>" "'>" + I18n.t('faq') + "</a>"
); );
}); });

View File

@ -1,3 +1,16 @@
/**
We always prefix with "js." to select exactly what we want passed
through to the front end.
**/
var oldI18nlookup = I18n.lookup;
I18n.lookup = function() {
// jshint doesn't like when we change the arguments directly...
var args = arguments;
if (args.length > 0) { args[0] = "js." + args[0]; }
return oldI18nlookup.apply(this, args);
};
/** /**
Look up a translation for an i18n key in our dictionary. Look up a translation for an i18n key in our dictionary.
@ -12,22 +25,9 @@ Ember.Handlebars.registerHelper('i18n', function(property, options) {
_.each(params, function(value, key) { _.each(params, function(value, key) {
params[key] = Em.Handlebars.get(_this, value, options); params[key] = Em.Handlebars.get(_this, value, options);
}); });
return Ember.String.i18n(property, params); return I18n.t(property, params);
}); });
/* We always prefix with .js to select exactly what we want passed through to the front end.
*/
/**
Look up a translation for an i18n key in our dictionary.
@method i18n
@for Ember.String
**/
Ember.String.i18n = function(scope, options) {
return I18n.translate("js." + scope, options);
};
/** /**
Set up an i18n binding that will update as a count changes, complete with pluralization. Set up an i18n binding that will update as a count changes, complete with pluralization.
@ -39,9 +39,7 @@ Ember.Handlebars.registerHelper('countI18n', function(key, options) {
tagName: 'span', tagName: 'span',
render: function(buffer) { render: function(buffer) {
buffer.push(Ember.String.i18n(key, { buffer.push(I18n.t(key, { count: this.get('count') }));
count: this.get('count')
}));
}, },
countChanged: function() { countChanged: function() {
@ -54,8 +52,6 @@ Ember.Handlebars.registerHelper('countI18n', function(key, options) {
if (Ember.EXTEND_PROTOTYPES) { if (Ember.EXTEND_PROTOTYPES) {
String.prototype.i18n = function(options) { String.prototype.i18n = function(options) {
return Ember.String.i18n(String(this), options); return I18n.t(String(this), options);
}; };
} }

View File

@ -13,12 +13,12 @@ Discourse.ActionSummary = Discourse.Model.extend({
var action = this.get('actionType.name_key'); var action = this.get('actionType.name_key');
if (this.get('acted')) { if (this.get('acted')) {
if (this.get('count') <= 1) { if (this.get('count') <= 1) {
return Em.String.i18n('post.actions.by_you.' + action); return I18n.t('post.actions.by_you.' + action);
} else { } else {
return Em.String.i18n('post.actions.by_you_and_others.' + action, { count: this.get('count') - 1 }); return I18n.t('post.actions.by_you_and_others.' + action, { count: this.get('count') - 1 });
} }
} else { } else {
return Em.String.i18n('post.actions.by_others.' + action, { count: this.get('count') }); return I18n.t('post.actions.by_others.' + action, { count: this.get('count') });
} }
}.property('count', 'acted', 'actionType'), }.property('count', 'acted', 'actionType'),

View File

@ -60,7 +60,7 @@ Discourse.Composer = Discourse.Model.extend({
if (topic) { if (topic) {
var postNumber = this.get('post.post_number'); var postNumber = this.get('post.post_number');
postLink = "<a href='" + (topic.get('url')) + "/" + postNumber + "'>" + postLink = "<a href='" + (topic.get('url')) + "/" + postNumber + "'>" +
Em.String.i18n("post.post_number", { number: postNumber }) + "</a>"; I18n.t("post.post_number", { number: postNumber }) + "</a>";
topicLink = "<a href='" + (topic.get('url')) + "'> " + (Handlebars.Utils.escapeExpression(topic.get('title'))) + "</a>"; topicLink = "<a href='" + (topic.get('url')) + "'> " + (Handlebars.Utils.escapeExpression(topic.get('title'))) + "</a>";
} }
@ -68,7 +68,7 @@ Discourse.Composer = Discourse.Model.extend({
post = this.get('post'); post = this.get('post');
if (post) { if (post) {
postDescription = Em.String.i18n('post.' + this.get('action'), { postDescription = I18n.t('post.' + this.get('action'), {
link: postLink, link: postLink,
replyAvatar: Discourse.Utilities.tinyAvatar(post.get('username')), replyAvatar: Discourse.Utilities.tinyAvatar(post.get('username')),
username: this.get('post.username') username: this.get('post.username')
@ -76,24 +76,24 @@ Discourse.Composer = Discourse.Model.extend({
var replyUsername = post.get('reply_to_user.username'); var replyUsername = post.get('reply_to_user.username');
if (replyUsername && this.get('action') === EDIT) { if (replyUsername && this.get('action') === EDIT) {
postDescription += " " + Em.String.i18n("post.in_reply_to") + " " + postDescription += " " + I18n.t("post.in_reply_to") + " " +
Discourse.Utilities.tinyAvatar(replyUsername) + " " + replyUsername; Discourse.Utilities.tinyAvatar(replyUsername) + " " + replyUsername;
} }
} }
switch (this.get('action')) { switch (this.get('action')) {
case PRIVATE_MESSAGE: return Em.String.i18n('topic.private_message'); case PRIVATE_MESSAGE: return I18n.t('topic.private_message');
case CREATE_TOPIC: return Em.String.i18n('topic.create_long'); case CREATE_TOPIC: return I18n.t('topic.create_long');
case REPLY: case REPLY:
case EDIT: case EDIT:
if (postDescription) return postDescription; if (postDescription) return postDescription;
if (topic) return Em.String.i18n('post.reply_topic', { link: topicLink }); if (topic) return I18n.t('post.reply_topic', { link: topicLink });
} }
}.property('action', 'post', 'topic', 'topic.title'), }.property('action', 'post', 'topic', 'topic.title'),
toggleText: function() { toggleText: function() {
return this.get('showPreview') ? Em.String.i18n('composer.hide_preview') : Em.String.i18n('composer.show_preview'); return this.get('showPreview') ? I18n.t('composer.hide_preview') : I18n.t('composer.show_preview');
}.property('showPreview'), }.property('showPreview'),
hidePreview: Em.computed.not('showPreview'), hidePreview: Em.computed.not('showPreview'),
@ -139,10 +139,10 @@ Discourse.Composer = Discourse.Model.extend({
// The text for the save button // The text for the save button
saveText: function() { saveText: function() {
switch (this.get('action')) { switch (this.get('action')) {
case EDIT: return Em.String.i18n('composer.save_edit'); case EDIT: return I18n.t('composer.save_edit');
case REPLY: return Em.String.i18n('composer.reply'); case REPLY: return I18n.t('composer.reply');
case CREATE_TOPIC: return Em.String.i18n('composer.create_topic'); case CREATE_TOPIC: return I18n.t('composer.create_topic');
case PRIVATE_MESSAGE: return Em.String.i18n('composer.create_pm'); case PRIVATE_MESSAGE: return I18n.t('composer.create_pm');
} }
}.property('action'), }.property('action'),
@ -235,13 +235,13 @@ Discourse.Composer = Discourse.Model.extend({
var titleDiff = this.get('missingTitleCharacters'); var titleDiff = this.get('missingTitleCharacters');
if (titleDiff > 0) { if (titleDiff > 0) {
this.flashDraftStatusForNewUser(); this.flashDraftStatusForNewUser();
return this.set('draftStatus', Em.String.i18n('composer.min_length.need_more_for_title', { n: titleDiff })); return this.set('draftStatus', I18n.t('composer.min_length.need_more_for_title', { n: titleDiff }));
} }
// 'reply' is focused // 'reply' is focused
} else if ($reply.is(':focus')) { } else if ($reply.is(':focus')) {
var replyDiff = this.get('missingReplyCharacters'); var replyDiff = this.get('missingReplyCharacters');
if (replyDiff > 0) { if (replyDiff > 0) {
return this.set('draftStatus', Em.String.i18n('composer.min_length.need_more_for_reply', { n: replyDiff })); return this.set('draftStatus', I18n.t('composer.min_length.need_more_for_reply', { n: replyDiff }));
} }
} }
@ -415,7 +415,7 @@ Discourse.Composer = Discourse.Model.extend({
if (response && response.errors) { if (response && response.errors) {
promise.reject(response.errors[0]); promise.reject(response.errors[0]);
} else { } else {
promise.reject(Em.String.i18n('generic_error')); promise.reject(I18n.t('generic_error'));
} }
post.set('cooked', oldCooked); post.set('cooked', oldCooked);
composer.set('composeState', OPEN); composer.set('composeState', OPEN);
@ -525,16 +525,16 @@ Discourse.Composer = Discourse.Model.extend({
usernames: this.get('targetUsernames') usernames: this.get('targetUsernames')
}; };
this.set('draftStatus', Em.String.i18n('composer.saving_draft_tip')); this.set('draftStatus', I18n.t('composer.saving_draft_tip'));
var composer = this; var composer = this;
// try to save the draft // try to save the draft
return Discourse.Draft.save(this.get('draftKey'), this.get('draftSequence'), data) return Discourse.Draft.save(this.get('draftKey'), this.get('draftSequence'), data)
.then(function() { .then(function() {
composer.set('draftStatus', Em.String.i18n('composer.saved_draft_tip')); composer.set('draftStatus', I18n.t('composer.saved_draft_tip'));
}, function() { }, function() {
composer.set('draftStatus', Em.String.i18n('composer.drafts_offline')); composer.set('draftStatus', I18n.t('composer.drafts_offline'));
}); });
}, },

View File

@ -20,7 +20,7 @@ Discourse.Notification = Discourse.Model.extend({
rendered: function() { rendered: function() {
var notificationName = Discourse.Site.instance().get('notificationLookup')[this.notification_type]; var notificationName = Discourse.Site.instance().get('notificationLookup')[this.notification_type];
return Em.String.i18n("notifications." + notificationName, { return I18n.t("notifications." + notificationName, {
username: this.data.display_username, username: this.data.display_username,
link: "<a href='" + (this.get('url')) + "'>" + this.data.topic_title + "</a>" link: "<a href='" + (this.get('url')) + "'>" + this.data.topic_title + "</a>"
}); });

View File

@ -62,14 +62,14 @@ Discourse.Post = Discourse.Model.extend({
// Custom tooltips for the bookmark icons // Custom tooltips for the bookmark icons
bookmarkTooltip: function() { bookmarkTooltip: function() {
if (this.get('bookmarked')) return Em.String.i18n('bookmarks.created'); if (this.get('bookmarked')) return I18n.t('bookmarks.created');
if (!this.get('read')) return ""; if (!this.get('read')) return "";
var topic = this.get('topic'); var topic = this.get('topic');
if (topic && topic.get('last_read_post_number') === this.get('post_number')) { if (topic && topic.get('last_read_post_number') === this.get('post_number')) {
return Em.String.i18n('bookmarks.last_read'); return I18n.t('bookmarks.last_read');
} }
return Em.String.i18n('bookmarks.not_bookmarked'); return I18n.t('bookmarks.not_bookmarked');
}.property('read', 'topic.last_read_post_number', 'bookmarked'), }.property('read', 'topic.last_read_post_number', 'bookmarked'),
bookmarkedChanged: function() { bookmarkedChanged: function() {
@ -83,7 +83,7 @@ Discourse.Post = Discourse.Model.extend({
if (error && error.responseText) { if (error && error.responseText) {
bootbox.alert($.parseJSON(error.responseText).errors[0]); bootbox.alert($.parseJSON(error.responseText).errors[0]);
} else { } else {
bootbox.alert(Em.String.i18n('generic_error')); bootbox.alert(I18n.t('generic_error'));
} }
}); });

View File

@ -118,14 +118,14 @@ Discourse.PostStream = Em.Object.extend({
var streamFilters = this.get('streamFilters'); var streamFilters = this.get('streamFilters');
if (streamFilters.filter && streamFilters.filter === "best_of") { if (streamFilters.filter && streamFilters.filter === "best_of") {
return Em.String.i18n("topic.filters.best_of", { return I18n.t("topic.filters.best_of", {
n_best_posts: Em.String.i18n("topic.filters.n_best_posts", { count: this.get('filteredPostsCount') }), n_best_posts: I18n.t("topic.filters.n_best_posts", { count: this.get('filteredPostsCount') }),
of_n_posts: Em.String.i18n("topic.filters.of_n_posts", { count: this.get('topic.posts_count') }) of_n_posts: I18n.t("topic.filters.of_n_posts", { count: this.get('topic.posts_count') })
}); });
} else if (streamFilters.username_filters) { } else if (streamFilters.username_filters) {
return Em.String.i18n("topic.filters.user", { return I18n.t("topic.filters.user", {
n_posts: Em.String.i18n("topic.filters.n_posts", { count: this.get('filteredPostsCount') }), n_posts: I18n.t("topic.filters.n_posts", { count: this.get('filteredPostsCount') }),
by_n_users: Em.String.i18n("topic.filters.by_n_users", { count: streamFilters.username_filters.length }) by_n_users: I18n.t("topic.filters.by_n_users", { count: streamFilters.username_filters.length })
}); });
} }
return ""; return "";
@ -614,21 +614,21 @@ Discourse.PostStream = Em.Object.extend({
// If the result was 404 the post is not found // If the result was 404 the post is not found
if (status === 404) { if (status === 404) {
topic.set('errorTitle', Em.String.i18n('topic.not_found.title')); topic.set('errorTitle', I18n.t('topic.not_found.title'));
topic.set('message', Em.String.i18n('topic.not_found.description')); topic.set('message', I18n.t('topic.not_found.description'));
return; return;
} }
// If the result is 403 it means invalid access // If the result is 403 it means invalid access
if (status === 403) { if (status === 403) {
topic.set('errorTitle', Em.String.i18n('topic.invalid_access.title')); topic.set('errorTitle', I18n.t('topic.invalid_access.title'));
topic.set('message', Em.String.i18n('topic.invalid_access.description')); topic.set('message', I18n.t('topic.invalid_access.description'));
return; return;
} }
// Otherwise supply a generic error message // Otherwise supply a generic error message
topic.set('errorTitle', Em.String.i18n('topic.server_error.title')); topic.set('errorTitle', I18n.t('topic.server_error.title'));
topic.set('message', Em.String.i18n('topic.server_error.description')); topic.set('message', I18n.t('topic.server_error.description'));
} }
}); });

View File

@ -14,7 +14,7 @@ Discourse.ShareLink = Discourse.Model.extend({
}.property('target', 'link', 'topicTitle'), }.property('target', 'link', 'topicTitle'),
title: function() { title: function() {
return Em.String.i18n("share." + this.get('target')); return I18n.t("share." + this.get('target'));
}.property('target'), }.property('target'),
iconClass: function() { iconClass: function() {
@ -76,4 +76,4 @@ Discourse.ShareLink.reopenClass({
popupHeight: function(target) { popupHeight: function(target) {
return (this.popupHeights[target] || 315); return (this.popupHeights[target] || 315);
} }
}); });

View File

@ -147,7 +147,7 @@ Discourse.Topic = Discourse.Model.extend({
}).property('starred'), }).property('starred'),
favoriteTooltip: (function() { favoriteTooltip: (function() {
return Em.String.i18n(this.get('favoriteTooltipKey')); return I18n.t(this.get('favoriteTooltipKey'));
}).property('favoriteTooltipKey'), }).property('favoriteTooltipKey'),
toggleStar: function() { toggleStar: function() {
@ -163,7 +163,7 @@ Discourse.Topic = Discourse.Model.extend({
if (error && error.responseText) { if (error && error.responseText) {
bootbox.alert($.parseJSON(error.responseText).errors); bootbox.alert($.parseJSON(error.responseText).errors);
} else { } else {
bootbox.alert(Em.String.i18n('generic_error')); bootbox.alert(I18n.t('generic_error'));
} }
}); });
}, },

View File

@ -40,7 +40,7 @@ Discourse.TopicDetails = Discourse.Model.extend({
if (typeof this.get('notifications_reason_id') === 'number') { if (typeof this.get('notifications_reason_id') === 'number') {
locale_string += "_" + this.get('notifications_reason_id'); locale_string += "_" + this.get('notifications_reason_id');
} }
return Em.String.i18n(locale_string, { username: Discourse.User.current('username_lower') }); return I18n.t(locale_string, { username: Discourse.User.current('username_lower') });
}.property('notification_level', 'notifications_reason_id'), }.property('notification_level', 'notifications_reason_id'),
@ -53,4 +53,4 @@ Discourse.TopicDetails = Discourse.Model.extend({
}); });
} }
}); });

View File

@ -49,11 +49,11 @@ Discourse.User = Discourse.Model.extend({
statusIcon: function() { statusIcon: function() {
var desc; var desc;
if(this.get('admin')) { if(this.get('admin')) {
desc = Em.String.i18n('user.admin', {user: this.get("name")}); desc = I18n.t('user.admin', {user: this.get("name")});
return '<i class="icon icon-trophy" title="' + desc + '" alt="' + desc + '"></i>'; return '<i class="icon icon-trophy" title="' + desc + '" alt="' + desc + '"></i>';
} }
if(this.get('moderator')){ if(this.get('moderator')){
desc = Em.String.i18n('user.moderator', {user: this.get("name")}); desc = I18n.t('user.moderator', {user: this.get("name")});
return '<i class="icon icon-magic" title="' + desc + '" alt="' + desc + '"></i>'; return '<i class="icon icon-magic" title="' + desc + '" alt="' + desc + '"></i>';
} }
return null; return null;

View File

@ -20,51 +20,51 @@ Discourse.UserAction = Discourse.Model.extend({
if (this.get('isPM')) { if (this.get('isPM')) {
icon = '<i class="icon icon-envelope-alt" title="{{i18n user.stream.private_message}}"></i>'; icon = '<i class="icon icon-envelope-alt" title="{{i18n user.stream.private_message}}"></i>';
if (sameUser) { if (sameUser) {
sentence = Em.String.i18n('user_action.sent_by_you', { userUrl: this.get('userUrl') }); sentence = I18n.t('user_action.sent_by_you', { userUrl: this.get('userUrl') });
} else { } else {
sentence = Em.String.i18n('user_action.sent_by_user', { user: this.get('name'), userUrl: this.get('userUrl') }); sentence = I18n.t('user_action.sent_by_user', { user: this.get('name'), userUrl: this.get('userUrl') });
} }
} else { } else {
if (sameUser) { if (sameUser) {
sentence = Em.String.i18n('user_action.posted_by_you', { userUrl: this.get('userUrl') }); sentence = I18n.t('user_action.posted_by_you', { userUrl: this.get('userUrl') });
} else { } else {
sentence = Em.String.i18n('user_action.posted_by_user', { user: this.get('name'), userUrl: this.get('userUrl') }); sentence = I18n.t('user_action.posted_by_user', { user: this.get('name'), userUrl: this.get('userUrl') });
} }
} }
} else if (action === ua.NEW_TOPIC) { } else if (action === ua.NEW_TOPIC) {
if (sameUser) { if (sameUser) {
sentence = Em.String.i18n('user_action.you_posted_topic', { userUrl: this.get('userUrl'), topicUrl: this.get('replyUrl') }); sentence = I18n.t('user_action.you_posted_topic', { userUrl: this.get('userUrl'), topicUrl: this.get('replyUrl') });
} else { } else {
sentence = Em.String.i18n('user_action.user_posted_topic', { user: this.get('name'), userUrl: this.get('userUrl'), topicUrl: this.get('replyUrl') }); sentence = I18n.t('user_action.user_posted_topic', { user: this.get('name'), userUrl: this.get('userUrl'), topicUrl: this.get('replyUrl') });
} }
} else if (action === ua.POST || action === ua.RESPONSE) { } else if (action === ua.POST || action === ua.RESPONSE) {
if (this.get('reply_to_post_number')) { if (this.get('reply_to_post_number')) {
if (sameUser) { if (sameUser) {
sentence = Em.String.i18n('user_action.you_replied_to_post', { post_number: '#' + this.get('reply_to_post_number'), sentence = I18n.t('user_action.you_replied_to_post', { post_number: '#' + this.get('reply_to_post_number'),
userUrl: this.get('userUrl'), postUrl: this.get('postUrl') }); userUrl: this.get('userUrl'), postUrl: this.get('postUrl') });
} else { } else {
sentence = Em.String.i18n('user_action.user_replied_to_post', { user: this.get('name'), sentence = I18n.t('user_action.user_replied_to_post', { user: this.get('name'),
post_number: '#' + this.get('reply_to_post_number'), userUrl: this.get('userUrl'), postUrl: this.get('postUrl') }); post_number: '#' + this.get('reply_to_post_number'), userUrl: this.get('userUrl'), postUrl: this.get('postUrl') });
} }
} else { } else {
if (sameUser) { if (sameUser) {
sentence = Em.String.i18n('user_action.you_replied_to_topic', { userUrl: this.get('userUrl'), sentence = I18n.t('user_action.you_replied_to_topic', { userUrl: this.get('userUrl'),
topicUrl: this.get('replyUrl') }); topicUrl: this.get('replyUrl') });
} else { } else {
sentence = Em.String.i18n('user_action.user_replied_to_topic', { user: this.get('name'), sentence = I18n.t('user_action.user_replied_to_topic', { user: this.get('name'),
userUrl: this.get('userUrl'), topicUrl: this.get('replyUrl') }); userUrl: this.get('userUrl'), topicUrl: this.get('replyUrl') });
} }
} }
} else if (action === ua.MENTION) { } else if (action === ua.MENTION) {
if (sameUser) { if (sameUser) {
sentence = Em.String.i18n('user_action.you_mentioned_user', { user: this.get('target_name'), sentence = I18n.t('user_action.you_mentioned_user', { user: this.get('target_name'),
user1Url: this.get('userUrl'), user2Url: this.get('targetUserUrl') }); user1Url: this.get('userUrl'), user2Url: this.get('targetUserUrl') });
} else { } else {
if (this.get('target_username') === Discourse.User.current('username')) { if (this.get('target_username') === Discourse.User.current('username')) {
sentence = Em.String.i18n('user_action.user_mentioned_you', { user: this.get('name'), sentence = I18n.t('user_action.user_mentioned_you', { user: this.get('name'),
user1Url: this.get('userUrl'), user2Url: this.get('targetUserUrl') }); user1Url: this.get('userUrl'), user2Url: this.get('targetUserUrl') });
} else { } else {
sentence = Em.String.i18n('user_action.user_mentioned_user', { user: this.get('name'), sentence = I18n.t('user_action.user_mentioned_user', { user: this.get('name'),
another_user: this.get('target_name'), user1Url: this.get('userUrl'), user2Url: this.get('targetUserUrl') }); another_user: this.get('target_name'), user1Url: this.get('userUrl'), user2Url: this.get('targetUserUrl') });
} }
} }

View File

@ -15,7 +15,7 @@ Discourse.UserActionStat = Discourse.Model.extend({
}.property('action_type'), }.property('action_type'),
description: function() { description: function() {
return Em.String.i18n('user_action_groups.' + this.get('action_type')); return I18n.t('user_action_groups.' + this.get('action_type'));
}.property('description'), }.property('description'),
isResponse: function() { isResponse: function() {

View File

@ -49,23 +49,23 @@ Discourse.ActionsHistoryView = Discourse.View.extend({
if(postUrl) { if(postUrl) {
key = key + "_with_url"; key = key + "_with_url";
} }
buffer.push(" " + Em.String.i18n(key, { icons: iconsHtml, postUrl: postUrl}) + "."); buffer.push(" " + I18n.t(key, { icons: iconsHtml, postUrl: postUrl}) + ".");
} else { } else {
buffer.push("<a href='#' data-who-acted='" + (c.get('id')) + "'>" + (c.get('description')) + "</a>."); buffer.push("<a href='#' data-who-acted='" + (c.get('id')) + "'>" + (c.get('description')) + "</a>.");
} }
if (c.get('can_act') && !c.get('actionType.is_custom_flag')) { if (c.get('can_act') && !c.get('actionType.is_custom_flag')) {
actionString = Em.String.i18n("post.actions.it_too." + c.get('actionType.name_key')); actionString = I18n.t("post.actions.it_too." + c.get('actionType.name_key'));
buffer.push(" <a href='#' data-act='" + (c.get('id')) + "'>" + actionString + "</a>."); buffer.push(" <a href='#' data-act='" + (c.get('id')) + "'>" + actionString + "</a>.");
} }
if (c.get('can_undo')) { if (c.get('can_undo')) {
actionString = Em.String.i18n("post.actions.undo." + c.get('actionType.name_key') ); actionString = I18n.t("post.actions.undo." + c.get('actionType.name_key') );
buffer.push(" <a href='#' data-undo='" + (c.get('id')) + "'>" + actionString + "</a>."); buffer.push(" <a href='#' data-undo='" + (c.get('id')) + "'>" + actionString + "</a>.");
} }
if (c.get('can_clear_flags')) { if (c.get('can_clear_flags')) {
buffer.push(" <a href='#' data-clear-flags='" + (c.get('id')) + "'>" + (Em.String.i18n("post.actions.clear_flags", { count: c.count })) + "</a>."); buffer.push(" <a href='#' data-clear-flags='" + (c.get('id')) + "'>" + (I18n.t("post.actions.clear_flags", { count: c.count })) + "</a>.");
} }
buffer.push("</div>"); buffer.push("</div>");

View File

@ -10,7 +10,7 @@ Discourse.AutoCloseFormView = Ember.View.extend({
templateName: 'auto_close_form', templateName: 'auto_close_form',
label: function() { label: function() {
return Em.String.i18n( this.get('labelKey') || 'composer.auto_close_label' ); return I18n.t( this.get('labelKey') || 'composer.auto_close_label' );
}.property('labelKey'), }.property('labelKey'),
autoCloseChanged: function() { autoCloseChanged: function() {
@ -20,4 +20,4 @@ Discourse.AutoCloseFormView = Ember.View.extend({
}.observes('autoCloseDays') }.observes('autoCloseDays')
}); });
Discourse.View.registerHelper('autoCloseForm', Discourse.AutoCloseFormView); Discourse.View.registerHelper('autoCloseForm', Discourse.AutoCloseFormView);

View File

@ -12,11 +12,11 @@ Discourse.ButtonView = Discourse.View.extend({
attributeBindings: ['data-not-implemented', 'title', 'data-toggle', 'data-share-url'], attributeBindings: ['data-not-implemented', 'title', 'data-toggle', 'data-share-url'],
title: function() { title: function() {
return Em.String.i18n(this.get('helpKey') || this.get('textKey')); return I18n.t(this.get('helpKey') || this.get('textKey'));
}.property('helpKey'), }.property('helpKey'),
text: function() { text: function() {
return Em.String.i18n(this.get('textKey')); return I18n.t(this.get('textKey'));
}.property('textKey'), }.property('textKey'),
render: function(buffer) { render: function(buffer) {

View File

@ -40,8 +40,8 @@ Discourse.DropdownButtonView = Discourse.View.extend({
_.each(this.get('dropDownContent'), function(row) { _.each(this.get('dropDownContent'), function(row) {
var id = row[0], var id = row[0],
textKey = row[1], textKey = row[1],
title = Em.String.i18n(textKey + ".title"), title = I18n.t(textKey + ".title"),
description = Em.String.i18n(textKey + ".description"); description = I18n.t(textKey + ".description");
buffer.push("<li data-id=\"" + id + "\"><a href='#'>"); buffer.push("<li data-id=\"" + id + "\"><a href='#'>");
buffer.push("<span class='title'>" + title + "</span>"); buffer.push("<span class='title'>" + title + "</span>");

View File

@ -7,7 +7,7 @@
@module Discourse @module Discourse
**/ **/
Discourse.NotificationsButton = Discourse.DropdownButtonView.extend({ Discourse.NotificationsButton = Discourse.DropdownButtonView.extend({
title: Em.String.i18n('topic.notifications.title'), title: I18n.t('topic.notifications.title'),
longDescriptionBinding: 'topic.details.notificationReasonText', longDescriptionBinding: 'topic.details.notificationReasonText',
dropDownContent: [ dropDownContent: [
@ -35,7 +35,7 @@ Discourse.NotificationsButton = Discourse.DropdownButtonView.extend({
case 'muted': return '<i class="icon-remove-sign"></i>&nbsp;'; case 'muted': return '<i class="icon-remove-sign"></i>&nbsp;';
} }
})(); })();
return icon + (Ember.String.i18n("topic.notifications." + key + ".title")) + "<span class='caret'></span>"; return icon + (I18n.t("topic.notifications." + key + ".title")) + "<span class='caret'></span>";
}.property('topic.details.notification_level'), }.property('topic.details.notification_level'),
clicked: function(id) { clicked: function(id) {

View File

@ -17,7 +17,7 @@ Discourse.ReplyButton = Discourse.ButtonView.extend({
var customTitle = this.get("parentView.replyButtonText" + archetypeCapitalized); var customTitle = this.get("parentView.replyButtonText" + archetypeCapitalized);
if (customTitle) { return customTitle; } if (customTitle) { return customTitle; }
return Em.String.i18n("topic.reply.title"); return I18n.t("topic.reply.title");
}.property(), }.property(),
renderIcon: function(buffer) { renderIcon: function(buffer) {

View File

@ -15,7 +15,7 @@ Discourse.ComboboxView = Discourse.View.extend({
// Add none option if required // Add none option if required
if (this.get('none')) { if (this.get('none')) {
buffer.push('<option value="">' + (Ember.String.i18n(this.get('none'))) + "</option>"); buffer.push('<option value="">' + (I18n.t(this.get('none'))) + "</option>");
} }
var selected = this.get('value'); var selected = this.get('value');

View File

@ -302,12 +302,12 @@ Discourse.ComposerView = Discourse.View.extend({
case 0: return; case 0: return;
// 413 == entity too large, returned usually from nginx // 413 == entity too large, returned usually from nginx
case 413: case 413:
bootbox.alert(Em.String.i18n('post.errors.upload_too_large', {max_size_kb: Discourse.SiteSettings.max_upload_size_kb})); bootbox.alert(I18n.t('post.errors.upload_too_large', {max_size_kb: Discourse.SiteSettings.max_upload_size_kb}));
return; return;
// 415 == media type not authorized // 415 == media type not authorized
case 415: case 415:
var extensions = Discourse.SiteSettings.authorized_extensions.replace(/\|/g, ", "); var extensions = Discourse.SiteSettings.authorized_extensions.replace(/\|/g, ", ");
bootbox.alert(Em.String.i18n('post.errors.upload_not_authorized', { authorized_extensions: extensions })); bootbox.alert(I18n.t('post.errors.upload_not_authorized', { authorized_extensions: extensions }));
return; return;
// 422 == there has been an error on the server (mostly due to FastImage) // 422 == there has been an error on the server (mostly due to FastImage)
case 422: case 422:
@ -316,7 +316,7 @@ Discourse.ComposerView = Discourse.View.extend({
} }
} }
// otherwise, display a generic error message // otherwise, display a generic error message
bootbox.alert(Em.String.i18n('post.errors.upload')); bootbox.alert(I18n.t('post.errors.upload'));
}); });
// I hate to use Em.run.later, but I don't think there's a way of waiting for a CSS transition // I hate to use Em.run.later, but I don't think there's a way of waiting for a CSS transition
@ -378,11 +378,11 @@ Discourse.ComposerView = Discourse.View.extend({
missingChars = this.get('model.missingTitleCharacters'), missingChars = this.get('model.missingTitleCharacters'),
reason; reason;
if( titleLength < 1 ){ if( titleLength < 1 ){
reason = Em.String.i18n('composer.error.title_missing'); reason = I18n.t('composer.error.title_missing');
} else if( missingChars > 0 ) { } else if( missingChars > 0 ) {
reason = Em.String.i18n('composer.error.title_too_short', {min: this.get('model.minimumTitleLength')}); reason = I18n.t('composer.error.title_too_short', {min: this.get('model.minimumTitleLength')});
} else if( titleLength > Discourse.SiteSettings.max_topic_title_length ) { } else if( titleLength > Discourse.SiteSettings.max_topic_title_length ) {
reason = Em.String.i18n('composer.error.title_too_long', {max: Discourse.SiteSettings.max_topic_title_length}); reason = I18n.t('composer.error.title_too_long', {max: Discourse.SiteSettings.max_topic_title_length});
} }
if( reason ) { if( reason ) {
@ -392,7 +392,7 @@ Discourse.ComposerView = Discourse.View.extend({
categoryValidation: function() { categoryValidation: function() {
if( !Discourse.SiteSettings.allow_uncategorized_topics && !this.get('model.categoryName')) { if( !Discourse.SiteSettings.allow_uncategorized_topics && !this.get('model.categoryName')) {
return Discourse.InputValidation.create({ failed: true, reason: Em.String.i18n('composer.error.category_missing') }); return Discourse.InputValidation.create({ failed: true, reason: I18n.t('composer.error.category_missing') });
} }
}.property('model.categoryName'), }.property('model.categoryName'),
@ -401,9 +401,9 @@ Discourse.ComposerView = Discourse.View.extend({
missingChars = this.get('model.missingReplyCharacters'), missingChars = this.get('model.missingReplyCharacters'),
reason; reason;
if( replyLength < 1 ){ if( replyLength < 1 ){
reason = Em.String.i18n('composer.error.post_missing'); reason = I18n.t('composer.error.post_missing');
} else if( missingChars > 0 ) { } else if( missingChars > 0 ) {
reason = Em.String.i18n('composer.error.post_length', {min: this.get('model.minimumPostLength')}); reason = I18n.t('composer.error.post_length', {min: this.get('model.minimumPostLength')});
} }
if( reason ) { if( reason ) {
@ -415,7 +415,7 @@ Discourse.ComposerView = Discourse.View.extend({
// not sure if this is the right way, keeping here for now, we could use a mixin perhaps // not sure if this is the right way, keeping here for now, we could use a mixin perhaps
Discourse.NotifyingTextArea = Ember.TextArea.extend({ Discourse.NotifyingTextArea = Ember.TextArea.extend({
placeholder: function() { placeholder: function() {
return Em.String.i18n(this.get('placeholderKey')); return I18n.t(this.get('placeholderKey'));
}.property('placeholderKey'), }.property('placeholderKey'),
didInsertElement: function() { didInsertElement: function() {

View File

@ -11,7 +11,7 @@ Discourse.TextField = Ember.TextField.extend({
placeholder: function() { placeholder: function() {
if( this.get('placeholderKey') ) { if( this.get('placeholderKey') ) {
return Em.String.i18n(this.get('placeholderKey')); return I18n.t(this.get('placeholderKey'));
} else { } else {
return ''; return '';
} }
@ -19,4 +19,4 @@ Discourse.TextField = Ember.TextField.extend({
}); });
Discourse.View.registerHelper('textField', Discourse.TextField); Discourse.View.registerHelper('textField', Discourse.TextField);

View File

@ -19,11 +19,11 @@ Discourse.ListView = Discourse.View.extend({
createTopicText: function() { createTopicText: function() {
if (this.get('controller.category.name')) { if (this.get('controller.category.name')) {
return Em.String.i18n("topic.create_in", { return I18n.t("topic.create_in", {
categoryName: this.get('controller.category.name') categoryName: this.get('controller.category.name')
}); });
} else { } else {
return Em.String.i18n("topic.create"); return I18n.t("topic.create");
} }
}.property('controller.category.name') }.property('controller.category.name')

View File

@ -8,7 +8,7 @@
**/ **/
Discourse.ArchetypeOptionsModalView = Discourse.ModalBodyView.extend({ Discourse.ArchetypeOptionsModalView = Discourse.ModalBodyView.extend({
templateName: 'modal/archetype_options', templateName: 'modal/archetype_options',
title: Em.String.i18n('topic.options') title: I18n.t('topic.options')
}); });

View File

@ -29,7 +29,7 @@ Discourse.ColorPickerView = Discourse.ContainerView.extend({
attributeBindings: ['style', 'title'], attributeBindings: ['style', 'title'],
classNames: ['colorpicker'].concat( isUsed ? ['used-color'] : ['unused-color'] ), classNames: ['colorpicker'].concat( isUsed ? ['used-color'] : ['unused-color'] ),
style: 'background-color: #' + color + ';', style: 'background-color: #' + color + ';',
title: isUsed ? I18n.t("js.category.already_used") : null, title: isUsed ? I18n.t("category.already_used") : null,
click: function() { click: function() {
colorPickerView.set("value", color); colorPickerView.set("value", color);
return false; return false;
@ -40,4 +40,4 @@ Discourse.ColorPickerView = Discourse.ContainerView.extend({
} }
}); });
Discourse.View.registerHelper('colorPicker', Discourse.ColorPickerView); Discourse.View.registerHelper('colorPicker', Discourse.ColorPickerView);

View File

@ -8,7 +8,7 @@
**/ **/
Discourse.CreateAccountView = Discourse.ModalBodyView.extend({ Discourse.CreateAccountView = Discourse.ModalBodyView.extend({
templateName: 'modal/create_account', templateName: 'modal/create_account',
title: Em.String.i18n('create_account.title'), title: I18n.t('create_account.title'),
didInsertElement: function(e) { didInsertElement: function(e) {

View File

@ -8,5 +8,5 @@
**/ **/
Discourse.EditTopicAutoCloseView = Discourse.ModalBodyView.extend({ Discourse.EditTopicAutoCloseView = Discourse.ModalBodyView.extend({
templateName: 'modal/auto_close', templateName: 'modal/auto_close',
title: Em.String.i18n('topic.auto_close_title') title: I18n.t('topic.auto_close_title')
}); });

View File

@ -8,7 +8,7 @@
**/ **/
Discourse.FlagView = Discourse.ModalBodyView.extend({ Discourse.FlagView = Discourse.ModalBodyView.extend({
templateName: 'modal/flag', templateName: 'modal/flag',
title: Em.String.i18n('flagging.title'), title: I18n.t('flagging.title'),
selectedChanged: function() { selectedChanged: function() {
var nameKey = this.get('controller.selected.name_key'); var nameKey = this.get('controller.selected.name_key');

View File

@ -8,7 +8,7 @@
**/ **/
Discourse.ForgotPasswordView = Discourse.ModalBodyView.extend({ Discourse.ForgotPasswordView = Discourse.ModalBodyView.extend({
templateName: 'modal/forgot_password', templateName: 'modal/forgot_password',
title: Em.String.i18n('forgot_password.title') title: I18n.t('forgot_password.title')
}); });

View File

@ -8,5 +8,5 @@
**/ **/
Discourse.HistoryView = Discourse.ModalBodyView.extend({ Discourse.HistoryView = Discourse.ModalBodyView.extend({
templateName: 'modal/history', templateName: 'modal/history',
title: Em.String.i18n('history') title: I18n.t('history')
}); });

View File

@ -9,7 +9,7 @@
Discourse.ImageSelectorView = Discourse.ModalBodyView.extend({ Discourse.ImageSelectorView = Discourse.ModalBodyView.extend({
templateName: 'modal/image_selector', templateName: 'modal/image_selector',
classNames: ['image-selector'], classNames: ['image-selector'],
title: Em.String.i18n('image_selector.title'), title: I18n.t('image_selector.title'),
upload: function() { upload: function() {
$('#reply-control').fileupload('add', { fileInput: $('#filename-input') }); $('#reply-control').fileupload('add', { fileInput: $('#filename-input') });

View File

@ -8,5 +8,5 @@
**/ **/
Discourse.InvitePrivateView = Discourse.ModalBodyView.extend({ Discourse.InvitePrivateView = Discourse.ModalBodyView.extend({
templateName: 'modal/invite_private', templateName: 'modal/invite_private',
title: Em.String.i18n('topic.invite_private.title') title: I18n.t('topic.invite_private.title')
}); });

View File

@ -8,7 +8,7 @@
**/ **/
Discourse.InviteView = Discourse.ModalBodyView.extend({ Discourse.InviteView = Discourse.ModalBodyView.extend({
templateName: 'modal/invite', templateName: 'modal/invite',
title: Em.String.i18n('topic.invite_reply.title'), title: I18n.t('topic.invite_reply.title'),
keyUp: function(e) { keyUp: function(e) {

View File

@ -8,7 +8,7 @@
**/ **/
Discourse.LoginView = Discourse.ModalBodyView.extend({ Discourse.LoginView = Discourse.ModalBodyView.extend({
templateName: 'modal/login', templateName: 'modal/login',
title: Em.String.i18n('login.title'), title: I18n.t('login.title'),
mouseMove: function(e) { mouseMove: function(e) {

View File

@ -8,7 +8,7 @@
**/ **/
Discourse.MergeTopicView = Discourse.ModalBodyView.extend({ Discourse.MergeTopicView = Discourse.ModalBodyView.extend({
templateName: 'modal/merge_topic', templateName: 'modal/merge_topic',
title: Em.String.i18n('topic.merge_topic.title') title: I18n.t('topic.merge_topic.title')
}); });

View File

@ -8,5 +8,5 @@
**/ **/
Discourse.NotActivatedView = Discourse.ModalBodyView.extend({ Discourse.NotActivatedView = Discourse.ModalBodyView.extend({
templateName: 'modal/not_activated', templateName: 'modal/not_activated',
title: Em.String.i18n('log_in') title: I18n.t('log_in')
}); });

View File

@ -8,7 +8,7 @@
**/ **/
Discourse.SplitTopicView = Discourse.ModalBodyView.extend(Discourse.SelectedPostsCount, { Discourse.SplitTopicView = Discourse.ModalBodyView.extend(Discourse.SelectedPostsCount, {
templateName: 'modal/split_topic', templateName: 'modal/split_topic',
title: Em.String.i18n('topic.split_topic.title') title: I18n.t('topic.split_topic.title')
}); });

View File

@ -20,7 +20,7 @@ Discourse.NavItemView = Discourse.View.extend({
extra = { categoryName: categoryName }; extra = { categoryName: categoryName };
name = "category"; name = "category";
} }
return Ember.String.i18n("filters." + name + ".help", extra); return I18n.t("filters." + name + ".help", extra);
}.property("content.filter"), }.property("content.filter"),
isActive: function() { isActive: function() {
@ -45,7 +45,7 @@ Discourse.NavItemView = Discourse.View.extend({
name = 'category'; name = 'category';
extra.categoryName = Discourse.Formatter.toTitleCase(categoryName); extra.categoryName = Discourse.Formatter.toTitleCase(categoryName);
} }
return I18n.t("js.filters." + name + ".title", extra); return I18n.t("filters." + name + ".title", extra);
}.property('count'), }.property('count'),
render: function(buffer) { render: function(buffer) {

View File

@ -48,7 +48,7 @@ Discourse.PostMenuView = Discourse.View.extend({
var reply_count = post.get('reply_count'); var reply_count = post.get('reply_count');
buffer.push("<button class='show-replies' data-action='replies'>"); buffer.push("<button class='show-replies' data-action='replies'>");
buffer.push("<span class='badge-posts'>" + reply_count + "</span>"); buffer.push("<span class='badge-posts'>" + reply_count + "</span>");
buffer.push(Em.String.i18n("post.has_replies", { count: reply_count })); buffer.push(I18n.t("post.has_replies", { count: reply_count }));
var icon = this.get('postView.repliesShown') ? 'icon-chevron-up' : 'icon-chevron-down'; var icon = this.get('postView.repliesShown') ? 'icon-chevron-up' : 'icon-chevron-down';
return buffer.push("<i class='icon " + icon + "'></i></button>"); return buffer.push("<i class='icon " + icon + "'></i></button>");
@ -62,7 +62,7 @@ Discourse.PostMenuView = Discourse.View.extend({
renderDelete: function(post, buffer) { renderDelete: function(post, buffer) {
if (post.get('post_number') === 1 && this.get('controller.model.details.can_delete')) { if (post.get('post_number') === 1 && this.get('controller.model.details.can_delete')) {
buffer.push("<button title=\"" + buffer.push("<button title=\"" +
(Em.String.i18n("topic.actions.delete")) + (I18n.t("topic.actions.delete")) +
"\" data-action=\"deleteTopic\" class='delete'><i class=\"icon-trash\"></i></button>"); "\" data-action=\"deleteTopic\" class='delete'><i class=\"icon-trash\"></i></button>");
return; return;
} }
@ -70,12 +70,12 @@ Discourse.PostMenuView = Discourse.View.extend({
if (post.get('deleted_at')) { if (post.get('deleted_at')) {
if (post.get('can_recover')) { if (post.get('can_recover')) {
buffer.push("<button title=\"" + buffer.push("<button title=\"" +
(Em.String.i18n("post.controls.undelete")) + (I18n.t("post.controls.undelete")) +
"\" data-action=\"recover\" class=\"delete\"><i class=\"icon-undo\"></i></button>"); "\" data-action=\"recover\" class=\"delete\"><i class=\"icon-undo\"></i></button>");
} }
} else if (post.get('can_delete')) { } else if (post.get('can_delete')) {
buffer.push("<button title=\"" + buffer.push("<button title=\"" +
(Em.String.i18n("post.controls.delete")) + (I18n.t("post.controls.delete")) +
"\" data-action=\"delete\" class=\"delete\"><i class=\"icon-trash\"></i></button>"); "\" data-action=\"delete\" class=\"delete\"><i class=\"icon-trash\"></i></button>");
} }
}, },
@ -96,7 +96,7 @@ Discourse.PostMenuView = Discourse.View.extend({
renderLike: function(post, buffer) { renderLike: function(post, buffer) {
if (!post.get('actionByName.like.can_act')) return; if (!post.get('actionByName.like.can_act')) return;
buffer.push("<button title=\"" + buffer.push("<button title=\"" +
(Em.String.i18n("post.controls.like")) + (I18n.t("post.controls.like")) +
"\" data-action=\"like\" class='like'><i class=\"icon-heart\"></i></button>"); "\" data-action=\"like\" class='like'><i class=\"icon-heart\"></i></button>");
}, },
@ -109,7 +109,7 @@ Discourse.PostMenuView = Discourse.View.extend({
renderFlag: function(post, buffer) { renderFlag: function(post, buffer) {
if (!this.present('post.flagsAvailable')) return; if (!this.present('post.flagsAvailable')) return;
buffer.push("<button title=\"" + buffer.push("<button title=\"" +
(Em.String.i18n("post.controls.flag")) + (I18n.t("post.controls.flag")) +
"\" data-action=\"flag\" class='flag'><i class=\"icon-flag\"></i></button>"); "\" data-action=\"flag\" class='flag'><i class=\"icon-flag\"></i></button>");
}, },
@ -121,7 +121,7 @@ Discourse.PostMenuView = Discourse.View.extend({
renderEdit: function(post, buffer) { renderEdit: function(post, buffer) {
if (!post.get('can_edit')) return; if (!post.get('can_edit')) return;
buffer.push("<button title=\"" + buffer.push("<button title=\"" +
(Em.String.i18n("post.controls.edit")) + (I18n.t("post.controls.edit")) +
"\" data-action=\"edit\" class='edit'><i class=\"icon-pencil\"></i></button>"); "\" data-action=\"edit\" class='edit'><i class=\"icon-pencil\"></i></button>");
}, },
@ -132,7 +132,7 @@ Discourse.PostMenuView = Discourse.View.extend({
// Share button // Share button
renderShare: function(post, buffer) { renderShare: function(post, buffer) {
buffer.push("<button title=\"" + buffer.push("<button title=\"" +
(Em.String.i18n("post.controls.share")) + (I18n.t("post.controls.share")) +
"\" data-share-url=\"" + (post.get('shareUrl')) + "\" class='share'><i class=\"icon-link\"></i></button>"); "\" data-share-url=\"" + (post.get('shareUrl')) + "\" class='share'><i class=\"icon-link\"></i></button>");
}, },
@ -140,9 +140,9 @@ Discourse.PostMenuView = Discourse.View.extend({
renderReply: function(post, buffer) { renderReply: function(post, buffer) {
if (!this.get('controller.model.details.can_create_post')) return; if (!this.get('controller.model.details.can_create_post')) return;
buffer.push("<button title=\"" + buffer.push("<button title=\"" +
(Em.String.i18n("post.controls.reply")) + (I18n.t("post.controls.reply")) +
"\" class='create' data-action=\"reply\"><i class='icon-reply'></i>" + "\" class='create' data-action=\"reply\"><i class='icon-reply'></i>" +
(Em.String.i18n("topic.reply.title")) + "</button>"); (I18n.t("topic.reply.title")) + "</button>");
}, },
clickReply: function() { clickReply: function() {

View File

@ -46,7 +46,7 @@ Discourse.PostView = Discourse.View.extend({
}.property('controller.selectedPostsCount'), }.property('controller.selectedPostsCount'),
selectText: function() { selectText: function() {
return this.get('selected') ? Em.String.i18n('topic.multi_select.selected', { count: this.get('controller.selectedPostsCount') }) : Em.String.i18n('topic.multi_select.select'); return this.get('selected') ? I18n.t('topic.multi_select.selected', { count: this.get('controller.selectedPostsCount') }) : I18n.t('topic.multi_select.select');
}.property('selected', 'controller.selectedPostsCount'), }.property('selected', 'controller.selectedPostsCount'),
repliesHidden: function() { repliesHidden: function() {
@ -104,7 +104,7 @@ Discourse.PostView = Discourse.View.extend({
updateQuoteElements: function($aside, desc) { updateQuoteElements: function($aside, desc) {
var navLink = ""; var navLink = "";
var quoteTitle = Em.String.i18n("post.follow_quote"); var quoteTitle = I18n.t("post.follow_quote");
var postNumber = $aside.data('post'); var postNumber = $aside.data('post');
if (postNumber) { if (postNumber) {
@ -130,7 +130,7 @@ Discourse.PostView = Discourse.View.extend({
// Only add the expand/contract control if it's not a full post // Only add the expand/contract control if it's not a full post
var expandContract = ""; var expandContract = "";
if (!$aside.data('full')) { if (!$aside.data('full')) {
expandContract = "<i class='icon-" + desc + "' title='" + Em.String.i18n("post.expand_collapse") + "'></i>"; expandContract = "<i class='icon-" + desc + "' title='" + I18n.t("post.expand_collapse") + "'></i>";
$aside.css('cursor', 'pointer'); $aside.css('cursor', 'pointer');
} }
$('.quote-controls', $aside).html("" + expandContract + navLink); $('.quote-controls', $aside).html("" + expandContract + navLink);
@ -145,7 +145,7 @@ Discourse.PostView = Discourse.View.extend({
$aside.data('original-contents',$blockQuote.html()); $aside.data('original-contents',$blockQuote.html());
var originalText = $blockQuote.text().trim(); var originalText = $blockQuote.text().trim();
$blockQuote.html(Em.String.i18n("loading")); $blockQuote.html(I18n.t("loading"));
var topic_id = this.get('post.topic_id'); var topic_id = this.get('post.topic_id');
if ($aside.data('topic')) { if ($aside.data('topic')) {
topic_id = $aside.data('topic'); topic_id = $aside.data('topic');
@ -179,7 +179,7 @@ Discourse.PostView = Discourse.View.extend({
if (link.closest('.badge-category').length === 0) { if (link.closest('.badge-category').length === 0) {
// nor in oneboxes (except when we force it) // nor in oneboxes (except when we force it)
if (link.closest(".onebox-result").length === 0 || link.hasClass("track-link")) { if (link.closest(".onebox-result").length === 0 || link.hasClass("track-link")) {
link.append("<span class='badge badge-notification clicks' title='" + Em.String.i18n("topic_summary.clicks") + "'>" + lc.clicks + "</span>"); link.append("<span class='badge badge-notification clicks' title='" + I18n.t("topic_summary.clicks") + "'>" + lc.clicks + "</span>");
} }
} }
} }

View File

@ -27,7 +27,7 @@ Discourse.QuoteButtonView = Discourse.View.extend({
**/ **/
render: function(buffer) { render: function(buffer) {
buffer.push('<i class="icon-quote-right"></i>&nbsp;&nbsp;'); buffer.push('<i class="icon-quote-right"></i>&nbsp;&nbsp;');
buffer.push(Em.String.i18n("post.quote_reply")); buffer.push(I18n.t("post.quote_reply"));
}, },
/** /**

View File

@ -19,13 +19,13 @@ Discourse.SearchTextField = Discourse.TextField.extend({
if (ctx) { if (ctx) {
switch(Em.get(ctx, 'type')) { switch(Em.get(ctx, 'type')) {
case 'user': case 'user':
return Em.String.i18n('search.prefer.user', {username: Em.get(ctx, 'user.username')}); return I18n.t('search.prefer.user', {username: Em.get(ctx, 'user.username')});
case 'category': case 'category':
return Em.String.i18n('search.prefer.category', {category: Em.get(ctx, 'category.name')}); return I18n.t('search.prefer.category', {category: Em.get(ctx, 'category.name')});
} }
} }
return Em.String.i18n('search.placeholder'); return I18n.t('search.placeholder');
}.property('searchContext') }.property('searchContext')
}); });

View File

@ -12,8 +12,8 @@ Discourse.ShareView = Discourse.View.extend({
classNameBindings: ['hasLink'], classNameBindings: ['hasLink'],
title: function() { title: function() {
if (this.get('controller.type') === 'topic') return Em.String.i18n('share.topic'); if (this.get('controller.type') === 'topic') return I18n.t('share.topic');
return Em.String.i18n('share.post'); return I18n.t('share.post');
}.property('controller.type'), }.property('controller.type'),
hasLink: function() { hasLink: function() {

View File

@ -27,25 +27,25 @@ Discourse.TopicClosingView = Discourse.View.extend({
var timeLeftString, rerenderDelay, minutesLeft = duration.asMinutes(); var timeLeftString, rerenderDelay, minutesLeft = duration.asMinutes();
if (minutesLeft > 1410) { if (minutesLeft > 1410) {
timeLeftString = Em.String.i18n('in_n_days', {count: Math.round(duration.asDays())}); timeLeftString = I18n.t('in_n_days', {count: Math.round(duration.asDays())});
if( minutesLeft > 2160 ) { if( minutesLeft > 2160 ) {
rerenderDelay = 12 * 60 * 60000; rerenderDelay = 12 * 60 * 60000;
} else { } else {
rerenderDelay = 60 * 60000; rerenderDelay = 60 * 60000;
} }
} else if (minutesLeft > 90) { } else if (minutesLeft > 90) {
timeLeftString = Em.String.i18n('in_n_hours', {count: Math.round(duration.asHours())}); timeLeftString = I18n.t('in_n_hours', {count: Math.round(duration.asHours())});
rerenderDelay = 30 * 60000; rerenderDelay = 30 * 60000;
} else if (minutesLeft > 2) { } else if (minutesLeft > 2) {
timeLeftString = Em.String.i18n('in_n_minutes', {count: Math.round(duration.asMinutes())}); timeLeftString = I18n.t('in_n_minutes', {count: Math.round(duration.asMinutes())});
rerenderDelay = 60000; rerenderDelay = 60000;
} else { } else {
timeLeftString = Em.String.i18n('in_n_seconds', {count: Math.round(duration.asSeconds())}); timeLeftString = I18n.t('in_n_seconds', {count: Math.round(duration.asSeconds())});
rerenderDelay = 1000; rerenderDelay = 1000;
} }
buffer.push('<h3><i class="icon icon-time"></i> '); buffer.push('<h3><i class="icon icon-time"></i> ');
buffer.push( Em.String.i18n('topic.auto_close_notice', {timeLeft: timeLeftString}) ); buffer.push( I18n.t('topic.auto_close_notice', {timeLeft: timeLeftString}) );
buffer.push('</h3>'); buffer.push('</h3>');
// TODO Sam: concerned this can cause a heavy rerender loop // TODO Sam: concerned this can cause a heavy rerender loop

View File

@ -22,7 +22,7 @@ Discourse.TopicStatusView = Discourse.View.extend({
}.observes('topic.closed', 'topic.pinned', 'topic.visible'), }.observes('topic.closed', 'topic.pinned', 'topic.visible'),
renderIcon: function(buffer, name, key) { renderIcon: function(buffer, name, key) {
var title = Em.String.i18n("topic_statuses." + key + ".help"); var title = I18n.t("topic_statuses." + key + ".help");
return buffer.push("<span title='" + title + "' class='topic-status'><i class='icon icon-" + name + "'></i></span>"); return buffer.push("<span title='" + title + "' class='topic-status'><i class='icon icon-" + name + "'></i></span>");
}, },
@ -48,4 +48,4 @@ Discourse.TopicStatusView = Discourse.View.extend({
}); });
Discourse.View.registerHelper('topicStatus', Discourse.TopicStatusView); Discourse.View.registerHelper('topicStatus', Discourse.TopicStatusView);

View File

@ -146,7 +146,7 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
var topicView = this; var topicView = this;
this.get('topic').resetRead().then(function() { this.get('topic').resetRead().then(function() {
topicView.set('controller.message', Em.String.i18n("topic.read_position_reset")); topicView.set('controller.message', I18n.t("topic.read_position_reset"));
topicView.set('controller.loaded', false); topicView.set('controller.loaded', false);
}); });
}, },
@ -305,7 +305,7 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
browseMoreMessage: function() { browseMoreMessage: function() {
var opts = { var opts = {
latestLink: "<a href=\"/\">" + (Em.String.i18n("topic.view_latest_topics")) + "</a>" latestLink: "<a href=\"/\">" + (I18n.t("topic.view_latest_topics")) + "</a>"
}; };
@ -313,7 +313,7 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
if (category) { if (category) {
opts.catLink = Discourse.Utilities.categoryLink(category); opts.catLink = Discourse.Utilities.categoryLink(category);
} else { } else {
opts.catLink = "<a href=\"" + Discourse.getURL("/categories") + "\">" + (Em.String.i18n("topic.browse_all_categories")) + "</a>"; opts.catLink = "<a href=\"" + Discourse.getURL("/categories") + "\">" + (I18n.t("topic.browse_all_categories")) + "</a>";
} }
var tracking = this.get('topicTrackingState'); var tracking = this.get('topicTrackingState');
@ -334,9 +334,9 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
}); });
} }
else if (category) { else if (category) {
return Ember.String.i18n("topic.read_more_in_category", opts); return I18n.t("topic.read_more_in_category", opts);
} else { } else {
return Ember.String.i18n("topic.read_more", opts); return I18n.t("topic.read_more", opts);
} }
}.property('topicTrackingState.messageCount') }.property('topicTrackingState.messageCount')

View File

@ -34,7 +34,7 @@ Discourse.ActivityFilterView = Discourse.View.extend({
description = Em.get(content, 'description'); description = Em.get(content, 'description');
} else { } else {
count = this.get('count'); count = this.get('count');
description = Em.String.i18n("user.filters.all"); description = I18n.t("user.filters.all");
} }
buffer.push("<a href='#'>" + description + buffer.push("<a href='#'>" + description +
@ -47,4 +47,4 @@ Discourse.ActivityFilterView = Discourse.View.extend({
} }
}); });
Discourse.View.registerHelper('activityFilter', Discourse.ActivityFilterView); Discourse.View.registerHelper('activityFilter', Discourse.ActivityFilterView);

View File

@ -14,7 +14,7 @@ Discourse.UserView = Discourse.View.extend({
var username; var username;
username = this.get('user.username'); username = this.get('user.username');
if (username) { if (username) {
return Discourse.set('title', "" + (Em.String.i18n("user.profile")) + " - " + username); return Discourse.set('title', "" + (I18n.t("user.profile")) + " - " + username);
} }
}.observes('user.loaded', 'user.username') }.observes('user.loaded', 'user.username')

View File

@ -399,7 +399,6 @@ var bootbox = window.bootbox || (function(document, $) {
div.find(".modal-body").html(str); div.find(".modal-body").html(str);
function onCancel(source) { function onCancel(source) {
console.log('onCancel');
// for now source is unused, but it will be in future // for now source is unused, but it will be in future
var hideModal = null; var hideModal = null;
if (typeof options.onEscape === 'function') { if (typeof options.onEscape === 'function') {
@ -414,7 +413,6 @@ var bootbox = window.bootbox || (function(document, $) {
// hook into the modal's keyup trigger to check for the escape key // hook into the modal's keyup trigger to check for the escape key
div.on('keyup.dismiss.modal', function(e) { div.on('keyup.dismiss.modal', function(e) {
console.log('keyup.dismiss.modal');
// any truthy value passed to onEscape will dismiss the dialog // any truthy value passed to onEscape will dismiss the dialog
// as long as the onEscape function (if defined) doesn't prevent it // as long as the onEscape function (if defined) doesn't prevent it
if (e.which === 27 && options.onEscape !== false) { if (e.which === 27 && options.onEscape !== false) {

View File

@ -4,7 +4,7 @@ window.PagedownCustom = {
insertButtons: [ insertButtons: [
{ {
id: 'wmd-quote-post', id: 'wmd-quote-post',
description: I18n.t("js.composer.quote_post_title"), description: I18n.t("composer.quote_post_title"),
execute: function() { execute: function() {
// AWFUL but I can't figure out how to call a controller method from outside our app // AWFUL but I can't figure out how to call a controller method from outside our app
return Discourse.__container__.lookup('controller:composer').importQuote(); return Discourse.__container__.lookup('controller:composer').importQuote();

View File

@ -20,7 +20,7 @@ test("uploading one file", function() {
this.stub(bootbox, "alert"); this.stub(bootbox, "alert");
ok(!validUpload([1, 2])); ok(!validUpload([1, 2]));
ok(bootbox.alert.calledWith(Em.String.i18n('post.errors.too_many_uploads'))); ok(bootbox.alert.calledWith(I18n.t('post.errors.too_many_uploads')));
}); });
test("new user", function() { test("new user", function() {
@ -29,7 +29,7 @@ test("new user", function() {
this.stub(bootbox, "alert"); this.stub(bootbox, "alert");
ok(!validUpload([1])); ok(!validUpload([1]));
ok(bootbox.alert.calledWith(Em.String.i18n('post.errors.upload_not_allowed_for_new_user'))); ok(bootbox.alert.calledWith(I18n.t('post.errors.upload_not_allowed_for_new_user')));
}); });
test("ensures an authorized upload", function() { test("ensures an authorized upload", function() {
@ -38,7 +38,7 @@ test("ensures an authorized upload", function() {
this.stub(bootbox, "alert"); this.stub(bootbox, "alert");
ok(!validUpload([html])); ok(!validUpload([html]));
ok(bootbox.alert.calledWith(Em.String.i18n('post.errors.upload_not_authorized', { authorized_extensions: extensions }))); ok(bootbox.alert.calledWith(I18n.t('post.errors.upload_not_authorized', { authorized_extensions: extensions })));
}); });
test("prevents files that are too big from being uploaded", function() { test("prevents files that are too big from being uploaded", function() {
@ -47,7 +47,7 @@ test("prevents files that are too big from being uploaded", function() {
this.stub(bootbox, "alert"); this.stub(bootbox, "alert");
ok(!validUpload([image])); ok(!validUpload([image]));
ok(bootbox.alert.calledWith(Em.String.i18n('post.errors.upload_too_large', { max_size_kb: 5 }))); ok(bootbox.alert.calledWith(I18n.t('post.errors.upload_too_large', { max_size_kb: 5 })));
}); });
var dummyBlob = function() { var dummyBlob = function() {

View File

@ -24,11 +24,11 @@
cantVote: function() { cantVote: function() {
if (!Discourse.get('currentUser')) { if (!Discourse.get('currentUser')) {
bootbox.alert(Em.String.i18n('vote.not_logged_in')); bootbox.alert(I18n.t('vote.not_logged_in'));
return false; return false;
} }
bootbox.alert(Em.String.i18n('vote.cant')); bootbox.alert(I18n.t('vote.cant'));
return false; return false;
}, },

View File

@ -2,7 +2,7 @@
window.Discourse.TopicFooterButtonsView.reopen({ window.Discourse.TopicFooterButtonsView.reopen({
replyButtonTextPoll: function() { replyButtonTextPoll: function() {
return Em.String.i18n("topic.reply.poll"); return I18n.t("topic.reply.poll");
}.property() }.property()
}); });

View File

@ -33,8 +33,8 @@
}.property('post.voteAction.can_act'), }.property('post.voteAction.can_act'),
voteButtonText: function() { voteButtonText: function() {
if (!this.get('post.voteAction.can_act')) return Em.String.i18n("vote.voted"); if (!this.get('post.voteAction.can_act')) return I18n.t("vote.voted");
return Em.String.i18n("vote.title"); return I18n.t("vote.title");
}.property('post.voteAction.can_act') }.property('post.voteAction.can_act')
}) })

View File

@ -21,9 +21,9 @@
text: function () { text: function () {
if (this.get('complete')) { if (this.get('complete')) {
return Em.String.i18n("task.reverse"); return I18n.t("task.reverse");
} else { } else {
return Em.String.i18n("task.complete_action"); return I18n.t("task.complete_action");
} }
}.property('complete'), }.property('complete'),