Blank topics page when interface language is German


(Gerhard Schlager) #1

Since this morning, I’m getting a blank page when I visit meta.discouse.org as long as I’m using German as interface language. I can’t test this anywhere else right now (try.discourse.org doesn’t allow users to change the interface language), but it’s definitely a problem here on meta.

Steps to reproduce:

  • Go to the user preferences
  • Change the interface language to “de”
  • Go back to the topic list and refresh the page

It seems to work with “ru”, but it looks like “fr” doesn’t work either.


(Simon Cossar) #2

Getting the error Cannot set property ‘bugs’ of undefined’,

I18n.translations.en.js.filters.bugs = { title: "Bugs", help: "Open Bugs" };


(Gerhard Schlager) #3

Yeah, that error has been there for ages. :wink:
Must be something else.


(Simon Cossar) #4

I just updated my forum and everything works fine there. Everything works properly in my development environment too.


(Simon Cossar) #5

Meta seems to be using this customization to create the ‘Bug’ and ‘Features’ nav items.

<script>
Discourse.ExternalNavItem = Discourse.NavItem.extend({
    href: function() {
        return this.get('href');
    }
    .property('href')
});

Discourse.NavItem.reopenClass({
    buildList: function(category, args) {
        var list = this._super(category, args);
        if (!category) {
             I18n.translations.en.js.filters.bugs = {
                title: "Bugs",
                help: "Open Bugs"
            };
            I18n.translations.en.js.filters.features = {
                title: "Features",
                help: "Open Feature Requests"
            };
            list.push(Discourse.ExternalNavItem.create({
                href: '/category/bug?order=op_likes&status=open',
                name: 'bugs'
            }));
            list.push(Discourse.ExternalNavItem.create({
                href: '/category/feature?order=op_likes&status=open',
                name: 'features'
            }));
        }
        return list;
    }
});
</script>

When I add that as a customization to the head section of my site I get similar results to what I’m seeing on meta when I change the locale to ‘fr’ or ‘de’. Moving the ‘bugs’ and ‘features’ translations out of the buildList function seems to solve the problem.


(Sam Saffron) #6

Ahhhh at last I know what happened here will fix


(Sam Saffron) #7

The pattern I used for adding a localization from a site customization was incorrect.

Instead of:

  I18n.translations.en.js.filters.bugs = { title: "Bugs", help: "Open Bugs" };
  I18n.translations.en.js.filters.features = { title: "Features", help: "Open Feature Requests" };

Should have been

  I18n.translations[I18n.locale].js.filters.bugs = { title: "Bugs", help: "Open Bugs" };
  I18n.translations[I18n.locale].js.filters.features = { title: "Features", help: "Open Feature Requests" };

(Sam Saffron) #8

OK, this works, but I did notices some hebrew glitches a unread is not translated properly and @Simon_Cossar it looks like 1.2k has the k in the wrong side on front page


(Sam Saffron) #9