How to translate SimpleSchema into different languages?

Hi guys,

what is the best way right now to implement localisation in meteor?

Let’s say I am starting off with a simple schema containing this:

  title: {
    type: String,
    allowedValues: ['Mr', 'Mrs', 'Family'],
    defaultValue: 'Mrs',
  },

How do make those strings multi-lingual and available in a different language (lets say we have a french speaking user logged in)?
I guess there must be an App available to do this?
What is best practise?

Kind regards
Thebarty

bump… does anyone have a solution for this? :flushed:

Hey @thebarty ,
You can start here, it’s bunch of localization package options for Meteor on atmosphere.

How I do it (for labels):

Mongo.Collection.prototype.internationalize = function(){
  var schema = this.simpleSchema()._schema;
  _.each(schema, function (property, key) {
    if (!property.label) {
      schema[key].label = function () {
        // if property is nested ("telescope.email"), only consider the last part ("email")
        if (key.indexOf(".") !== -1) {
          key = _.last(key.split("."));
        }
        return i18n.t(key); // i18n.t() is my i18n function
      };
    }
  });
  return this;
};

// later…

Meteor.startup(function(){
  Comments.internationalize();
});