orionjs / orioncms

[Old] Orion is an open source framework built on Meteor that makes complex as well as simple apps possible with minimal effort.
http://orionjs.org
MIT License
715 stars 129 forks source link

i18n tabular not translated #279

Open loongmxbt opened 9 years ago

loongmxbt commented 9 years ago

Does anyone notice that i18n in tabular not really translated? I've tested several langs including the official es, not translated. Does anyone else meet the same problem?

orion/packages/bootstrap/tabular.js

PEM-- commented 9 years ago

The tracker.autorun (https://github.com/orionjs/orion/blob/master/packages/bootstrap/tabular.js#L31) should be set on line 5 so that it can recreate the translation when the language is set.

Something like this should do it:

orion.collections.onCreated(function() {
  var self = this;
  // if the collection doesn't has the tabular option, nothing to do here!
  if (!_.has(this, 'tabular')) return;

  Tracker.autorun(function () {
    // Use reactivity to capture language changes
    currentLang = i18n.getLanguage();
    var tabularOptions = _.extend({
      name: 'tabular_' + self.name,
      collection: self,
      columns: [
        { data: "_id", title: "ID" }
      ],
      selector: function(userId) {
        var selectors = Roles.helper(userId, 'collections.' + self.name + '.indexFilter');
        return { $or: selectors };
      },
      language: {
        search: i18n('tabular.search'),
        info: i18n('tabular.info'),
        infoEmpty: i18n('tabular.infoEmpty'),
        lengthMenu: i18n('tabular.lengthMenu'),
        emptyTable: i18n('tabular.emptyTable'),
        paginate: {
          first: i18n('tabular.paginate.first'),
          previous: i18n('tabular.paginate.previous'),
          next: i18n('tabular.paginate.next'),
          last: i18n('tabular.paginate.last'),
        }
      }
    }, this.tabular);

    tabularOptions.columns.map(function (column) {
      if (_.isFunction(column.title)) {
        column.langTitle = column.title;
      }
      if (_.isFunction(column.langTitle)) {
        column.title = column.langTitle();
      }
      return column;
    });
    self.tabularTable = new Tabular.Table(tabularOptions);
  });
});
Sabst commented 8 years ago

+1 ... and same problem with titles of my collections on the admin left-hand side... If no english string is defined, this message is displayed (note the missing language after 'in'): [no translation for "myTests.title" in ]

goooseman commented 8 years ago

+1

alexisurvoy commented 8 years ago

+1 Any idea when this will be fixed or a workaround ?

piotrekfracek commented 8 years ago

+1

kamil-borkowski commented 8 years ago

+1