Merge pull request #627 from kubabrecka/translatable_flags_and_likes
make post actions (likes, flags) translatable as whole sentences
This commit is contained in:
commit
2b9514a311
|
@ -10,16 +10,15 @@ Discourse.ActionSummary = Discourse.Model.extend({
|
||||||
|
|
||||||
// Description for the action
|
// Description for the action
|
||||||
description: (function() {
|
description: (function() {
|
||||||
|
var action = this.get('actionType.name_key');
|
||||||
if (this.get('acted')) {
|
if (this.get('acted')) {
|
||||||
return Em.String.i18n('post.actions.by_you_and_others', {
|
if (this.get('count') <= 1) {
|
||||||
count: this.get('count') - 1,
|
return Em.String.i18n('post.actions.by_you.' + action);
|
||||||
long_form: this.get('actionType.long_form')
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
return Em.String.i18n('post.actions.by_others', {
|
return Em.String.i18n('post.actions.by_you_and_others.' + action, { count: this.get('count') - 1 });
|
||||||
count: this.get('count'),
|
}
|
||||||
long_form: this.get('actionType.long_form')
|
} else {
|
||||||
});
|
return Em.String.i18n('post.actions.by_others.' + action, { count: this.get('count') });
|
||||||
}
|
}
|
||||||
}).property('count', 'acted', 'actionType'),
|
}).property('count', 'acted', 'actionType'),
|
||||||
|
|
||||||
|
@ -113,5 +112,3 @@ Discourse.ActionSummary = Discourse.Model.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,16 +8,4 @@
|
||||||
**/
|
**/
|
||||||
Discourse.PostActionType = Discourse.Model.extend({
|
Discourse.PostActionType = Discourse.Model.extend({
|
||||||
|
|
||||||
alsoName: (function() {
|
|
||||||
if (this.get('is_flag')) return Em.String.i18n('post.actions.flag');
|
|
||||||
return this.get('name');
|
|
||||||
}).property('is_flag', 'name'),
|
|
||||||
|
|
||||||
alsoNameLower: (function() {
|
|
||||||
var _ref;
|
|
||||||
return (_ref = this.get('alsoName')) ? _ref.toLowerCase() : void 0;
|
|
||||||
}).property('alsoName')
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ Discourse.Site.reopenClass({
|
||||||
result.postActionByIdLookup = Em.Object.create();
|
result.postActionByIdLookup = Em.Object.create();
|
||||||
result.post_action_types = result.post_action_types.map(function(p) {
|
result.post_action_types = result.post_action_types.map(function(p) {
|
||||||
var actionType;
|
var actionType;
|
||||||
actionType = Discourse.PostActionType.create(p);
|
actionType = Discourse.Model.create(p);
|
||||||
result.postActionByIdLookup.set("action" + p.id, actionType);
|
result.postActionByIdLookup.set("action" + p.id, actionType);
|
||||||
return actionType;
|
return actionType;
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,32 +24,33 @@ Discourse.ActionsHistoryView = Discourse.View.extend({
|
||||||
|
|
||||||
if (!this.present('content')) return;
|
if (!this.present('content')) return;
|
||||||
return this.get('content').forEach(function(c) {
|
return this.get('content').forEach(function(c) {
|
||||||
var alsoName;
|
var actionString, iconsHtml;
|
||||||
buffer.push("<div class='post-action'>");
|
buffer.push("<div class='post-action'>");
|
||||||
|
|
||||||
if (c.get('users')) {
|
if (c.get('users')) {
|
||||||
|
iconsHtml = "";
|
||||||
c.get('users').forEach(function(u) {
|
c.get('users').forEach(function(u) {
|
||||||
buffer.push("<a href=\"" + Discourse.getURL("/users/") + (u.get('username_lower')) + "\">");
|
iconsHtml += "<a href=\"" + Discourse.getURL("/users/") + (u.get('username_lower')) + "\">";
|
||||||
buffer.push(Discourse.Utilities.avatarImg({
|
iconsHtml += Discourse.Utilities.avatarImg({
|
||||||
size: 'small',
|
size: 'small',
|
||||||
username: u.get('username'),
|
username: u.get('username'),
|
||||||
avatarTemplate: u.get('avatar_template')
|
avatarTemplate: u.get('avatar_template')
|
||||||
}));
|
|
||||||
return buffer.push("</a>");
|
|
||||||
});
|
});
|
||||||
buffer.push(" " + (c.get('actionType.long_form')) + ".");
|
iconsHtml += "</a>";
|
||||||
|
});
|
||||||
|
buffer.push(" " + Em.String.i18n('post.actions.people.' + c.get('actionType.name_key'), { icons: iconsHtml }) + ".");
|
||||||
} 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')) {
|
if (c.get('can_act')) {
|
||||||
alsoName = Em.String.i18n("post.actions.it_too", { alsoName: c.get('actionType.alsoName') });
|
actionString = Em.String.i18n("post.actions.it_too." + c.get('actionType.name_key'));
|
||||||
buffer.push(" <a href='#' data-act='" + (c.get('id')) + "'>" + alsoName + "</a>.");
|
buffer.push(" <a href='#' data-act='" + (c.get('id')) + "'>" + actionString + "</a>.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c.get('can_undo')) {
|
if (c.get('can_undo')) {
|
||||||
alsoName = Em.String.i18n("post.actions.undo", { alsoName: c.get('actionType.alsoNameLower') });
|
actionString = Em.String.i18n("post.actions.undo." + c.get('actionType.name_key') );
|
||||||
buffer.push(" <a href='#' data-undo='" + (c.get('id')) + "'>" + alsoName + "</a>.");
|
buffer.push(" <a href='#' data-undo='" + (c.get('id')) + "'>" + actionString + "</a>.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c.get('can_clear_flags')) {
|
if (c.get('can_clear_flags')) {
|
||||||
|
|
|
@ -590,15 +590,82 @@ en:
|
||||||
clear_flags:
|
clear_flags:
|
||||||
one: "Clear flag"
|
one: "Clear flag"
|
||||||
other: "Clear flags"
|
other: "Clear flags"
|
||||||
it_too: "{{alsoName}} it too"
|
it_too:
|
||||||
undo: "Undo {{alsoName}}"
|
off_topic: "Flag it too"
|
||||||
|
spam: "Flag it too"
|
||||||
|
inappropriate: "Flag it too"
|
||||||
|
custom_flag: "Flag it too"
|
||||||
|
bookmark: "Bookmark it too"
|
||||||
|
like: "Like it too"
|
||||||
|
vote: "Vote for it too"
|
||||||
|
undo:
|
||||||
|
off_topic: "Undo flag"
|
||||||
|
spam: "Undo flag"
|
||||||
|
inappropriate: "Undo flag"
|
||||||
|
custom_flag: "Undo flag"
|
||||||
|
bookmark: "Undo bookmark"
|
||||||
|
like: "Undo like"
|
||||||
|
vote: "Undo vote"
|
||||||
|
people:
|
||||||
|
off_topic: "{{icons}} marked this as off-topic"
|
||||||
|
spam: "{{icons}} marked this as spam"
|
||||||
|
inappropriate: "{{icons}} marked this as inappropriate"
|
||||||
|
custom_flag: "{{icons}} flagged this"
|
||||||
|
bookmark: "{{icons}} bookmarked this"
|
||||||
|
like: "{{icons}} liked this"
|
||||||
|
vote: "{{icons}} voted for this"
|
||||||
|
by_you:
|
||||||
|
off_topic: "You flagged this as off-topic"
|
||||||
|
spam: "You flagged this as spam"
|
||||||
|
inappropriate: "You flagged this as inappropriate"
|
||||||
|
custom_flag: "You flagged this for moderation"
|
||||||
|
bookmark: "You bookmarked this post"
|
||||||
|
like: "You liked this"
|
||||||
|
vote: "You voted for this post"
|
||||||
by_you_and_others:
|
by_you_and_others:
|
||||||
zero: "You {{long_form}}"
|
off_topic:
|
||||||
one: "You and 1 other person {{long_form}}"
|
one: "You and 1 other flagged this as off-topic"
|
||||||
other: "You and {{count}} other people {{long_form}}"
|
other: "You and {{count}} other people flagged this as off-topic"
|
||||||
|
spam:
|
||||||
|
one: "You and 1 other flagged this as spam"
|
||||||
|
other: "You and {{count}} other people flagged this as spam"
|
||||||
|
inappropriate:
|
||||||
|
one: "You and 1 other flagged this as inappropriate"
|
||||||
|
other: "You and {{count}} other people flagged this as inappropriate"
|
||||||
|
custom_flag:
|
||||||
|
one: "You and 1 other flagged this for moderation"
|
||||||
|
other: "You and {{count}} other people flagged this for moderation"
|
||||||
|
bookmark:
|
||||||
|
one: "You and 1 other bookmarked this post"
|
||||||
|
other: "You and {{count}} other people bookmarked this post"
|
||||||
|
like:
|
||||||
|
one: "You and 1 other liked this"
|
||||||
|
other: "You and {{count}} other people liked this"
|
||||||
|
vote:
|
||||||
|
one: "You and 1 other voted for this post"
|
||||||
|
other: "You and {{count}} other people voted for this post"
|
||||||
by_others:
|
by_others:
|
||||||
one: "1 person {{long_form}}"
|
off_topic:
|
||||||
other: "{{count}} people {{long_form}}"
|
one: "1 person flagged this as off-topic"
|
||||||
|
other: "{{count}} people flagged this as off-topic"
|
||||||
|
spam:
|
||||||
|
one: "1 person flagged this as spam"
|
||||||
|
other: "{{count}} people flagged this as spam"
|
||||||
|
inappropriate:
|
||||||
|
one: "1 person flagged this as inappropriate"
|
||||||
|
other: "{{count}} people flagged this as inappropriate"
|
||||||
|
custom_flag:
|
||||||
|
one: "1 person flagged this for moderation"
|
||||||
|
other: "{{count}} people flagged this for moderation"
|
||||||
|
bookmark:
|
||||||
|
one: "1 person bookmarked this post"
|
||||||
|
other: "{{count}} people bookmarked this post"
|
||||||
|
like:
|
||||||
|
one: "1 person liked this"
|
||||||
|
other: "{{count}} people liked this"
|
||||||
|
vote:
|
||||||
|
one: "1 person voted for this post"
|
||||||
|
other: "{{count}} people voted for this post"
|
||||||
|
|
||||||
edits:
|
edits:
|
||||||
one: 1 edit
|
one: 1 edit
|
||||||
|
|
Loading…
Reference in New Issue