Locale2.17.1+

  1. moment.duration().locale();
  2. moment.duration().locale(String);

You can get or set the locale of a duration using locale(…). The locale will affect the duration's string methods, like humanize(). See the intl section for more information on internationalization generally.

  1. moment.duration(1, "minutes").locale("en").humanize(); // a minute
  2. moment.duration(1, "minutes").locale("fr").humanize(); // une minute
  3. moment.duration(1, "minutes").locale("es").humanize(); // un minuto

Suffixes in humanize() are also internationalized:

  1. moment.duration(1, "minutes").locale("en").humanize(true); // in a minute
  2. moment.duration(1, "minutes").locale("fr").humanize(true); // dans une minute
  3. moment.duration(1, "minutes").locale("es").humanize(true); // en un minuto
  4. moment.duration(-1, "minutes").locale("en").humanize(true); // a minute ago
  5. moment.duration(-1, "minutes").locale("fr").humanize(true); // il y a une minute
  6. moment.duration(-1, "minutes").locale("es").humanize(true); // hace un minuto