Merge pull request #12 from dcsjapan/key-reorganization

Reorganize key names
This commit is contained in:
Toby Zerner 2015-10-23 16:14:59 +10:30
commit 61d8e8714d
6 changed files with 14 additions and 11 deletions

View File

@ -108,7 +108,7 @@ export default function addComposerAutocomplete() {
const user = post.user(); const user = post.user();
suggestions.push( suggestions.push(
makeSuggestion(user, '@' + user.username() + '#' + post.id(), [ makeSuggestion(user, '@' + user.username() + '#' + post.id(), [
app.translator.trans('flarum-mentions.forum.reply_to_post', {number: post.number()}), ' — ', app.translator.trans('flarum-mentions.forum.composer.reply_to_post_text', {number: post.number()}), ' — ',
truncate(post.contentPlain(), 200) truncate(post.contentPlain(), 200)
], 'MentionsDropdown-post') ], 'MentionsDropdown-post')
); );

View File

@ -70,6 +70,8 @@ export default function addMentionedByList() {
}); });
}; };
// NEEDS TO BE FIXED: The next two blocks of code. See https://github.com/flarum/core/issues/597 for details.
// Create a list of unique users who have replied. So even if a user has // Create a list of unique users who have replied. So even if a user has
// replied twice, they will only be in this array once. // replied twice, they will only be in this array once.
const used = []; const used = [];
@ -91,7 +93,7 @@ export default function addMentionedByList() {
config={m.route} config={m.route}
onclick={hidePreview} onclick={hidePreview}
data-number={reply.number()}> data-number={reply.number()}>
{app.session.user === user ? app.translator.trans('flarum-mentions.forum.you') : username(user)} {app.session.user === user ? app.translator.trans('flarum-mentions.forum.post.you_text') : username(user)}
</a> </a>
); );
}); });
@ -100,7 +102,8 @@ export default function addMentionedByList() {
<div className="Post-mentionedBy" config={config}> <div className="Post-mentionedBy" config={config}>
<span className="Post-mentionedBy-summary"> <span className="Post-mentionedBy-summary">
{icon('reply')} {icon('reply')}
{app.translator.trans('flarum-mentions.forum.post_mentioned_by', { // PLEASE CHECK: Using the syntax from "addLikesList.js" with "repliers[0]" in place of "likes[0]".
{app.translator.transChoice('flarum-mentions.forum.post.mentioned_by' + (repliers[0] === app.session.user ? '_self' : '') + '_text', names.length, {
count: names.length, count: names.length,
users: punctuateSeries(names) users: punctuateSeries(names)
})} })}

View File

@ -31,7 +31,7 @@ export default function() {
items.add('reply', items.add('reply',
Button.component({ Button.component({
className: 'Button Button--link', className: 'Button Button--link',
children: app.translator.trans('flarum-mentions.forum.reply_link'), children: app.translator.trans('flarum-mentions.forum.post.reply_link'),
onclick: () => { onclick: () => {
const quote = window.getSelection().toString(); const quote = window.getSelection().toString();

View File

@ -1,6 +1,6 @@
import Notification from 'flarum/components/Notification'; import Notification from 'flarum/components/Notification';
import username from 'flarum/helpers/username'; import username from 'flarum/helpers/username';
import punctuate from 'flarum/helpers/punctuate'; import punctuateSeries from 'flarum/helpers/punctuateSeries';
export default class PostMentionedNotification extends Notification { export default class PostMentionedNotification extends Notification {
icon() { icon() {
@ -21,11 +21,11 @@ export default class PostMentionedNotification extends Notification {
const auc = notification.additionalUnreadCount(); const auc = notification.additionalUnreadCount();
const user = notification.sender(); const user = notification.sender();
return app.translator.trans('flarum-mentions.forum.post_mentioned_notification', { return app.translator.trans('flarum-mentions.forum.notifications.post_mentioned_text', {
user, user,
username: auc ? punctuate([ username: auc ? punctuateSeries([
username(user), username(user),
app.translator.trans('flarum-mentions.forum.others', {count: auc}) app.translator.trans('flarum-mentions.forum.notifications.others_text', {count: auc})
]) : undefined ]) : undefined
}); });
} }

View File

@ -14,7 +14,7 @@ export default class UserMentionedNotification extends Notification {
content() { content() {
const user = this.props.notification.sender(); const user = this.props.notification.sender();
return app.translator.trans('flarum-mentions.forum.user_mentioned_notification', {user}); return app.translator.trans('flarum-mentions.forum.notifications.user_mentioned_text', {user});
} }
excerpt() { excerpt() {

View File

@ -35,13 +35,13 @@ app.initializers.add('flarum-mentions', function() {
items.add('postMentioned', { items.add('postMentioned', {
name: 'postMentioned', name: 'postMentioned',
icon: 'reply', icon: 'reply',
label: app.translator.trans('flarum-mentions.forum.notify_post_mentioned') label: app.translator.trans('flarum-mentions.forum.settings.notify_post_mentioned_label')
}); });
items.add('userMentioned', { items.add('userMentioned', {
name: 'userMentioned', name: 'userMentioned',
icon: 'at', icon: 'at',
label: app.translator.trans('flarum-mentions.forum.notify_user_mentioned') label: app.translator.trans('flarum-mentions.forum.settings.notify_user_mentioned_label')
}); });
}); });