FIX: translation issues with top periods

This commit is contained in:
Régis Hanol 2015-04-06 13:23:57 +02:00
parent 7749b3e99f
commit 1fd50634f0
4 changed files with 22 additions and 17 deletions
app/assets/javascripts/discourse
components
controllers/navigation
helpers
config/locales

View file

@ -10,14 +10,14 @@ export default Ember.Component.extend(StringBuffer, {
title: function() {
var categoryName = this.get('content.categoryName'),
name = this.get('content.name'),
extra;
extra = {};
if (categoryName) {
extra = { categoryName: categoryName };
name = "category";
extra.categoryName = categoryName;
}
return I18n.t("filters." + name + ".help", extra);
}.property("content.name"),
return I18n.t("filters." + name.replace("/", ".") + ".help", extra);
}.property("content.{categoryName,name}"),
active: function() {
return this.get('content.filterMode') === this.get('filterMode') ||
@ -33,11 +33,11 @@ export default Ember.Component.extend(StringBuffer, {
name = 'category';
extra.categoryName = Discourse.Formatter.toTitleCase(categoryName);
}
return I18n.t("filters." + name + ".title", extra);
}.property('content.count'),
return I18n.t("filters." + name.replace("/", ".") + ".title", extra);
}.property('content.{categoryName,name,count}'),
renderString: function(buffer) {
var content = this.get('content');
renderString(buffer) {
const content = this.get('content');
buffer.push("<a href='" + content.get('href') + "'>");
if (content.get('hasIcon')) {
buffer.push("<span class='" + content.get('name') + "'></span>");

View file

@ -2,6 +2,7 @@ import DiscourseController from 'discourse/controllers/controller';
export default DiscourseController.extend({
needs: ['discovery', 'discovery/topics'],
categories: function() {
return Discourse.Category.list();
}.property(),

View file

@ -1,9 +1,11 @@
import { iconHTML } from 'discourse/helpers/fa-icon';
const TITLE_SUBS = { yearly: 'this_year',
monthly: 'this_month',
daily: 'today',
all: 'all' };
const TITLE_SUBS = {
all: 'all_time',
yearly: 'this_year',
monthly: 'this_month',
daily: 'today',
};
export default Ember.Handlebars.makeBoundHelper(function (period) {
const title = I18n.t('filters.top.' + (TITLE_SUBS[period] || 'this_week'));

View file

@ -1552,15 +1552,17 @@ en:
top:
title: "Top"
help: "the most active topics in the last year, month, week or day"
all:
title: "All Time"
yearly:
title: "Top Yearly"
title: "Yearly"
monthly:
title: "Top Monthly"
title: "Monthly"
weekly:
title: "Top Weekly"
title: "Weekly"
daily:
title: "Top Daily"
all: "All Time"
title: "Daily"
all_time: "All Time"
this_year: "This year"
this_month: "This month"
this_week: "This week"