AngularJS 模块 angularMoment 的翻译

Translations for AngularJS module angularMoment

我在我的应用程序中使用 angularMoment 模块来显示 post 创建时间,例如几秒前、2 小时前等等。问题是我的应用程序支持多种语言。我该如何翻译它?

我使用本教程实现了 angularMoment https://scotch.io/tutorials/display-time-relatively-in-angular

如 angularMoment 文档中所述,您可以执行以下操作:

If you need internationalization support, load specified moment.js locale file first:

<script src="components/moment/locale/de.js"></script> Then call the amMoment.changeLocale() method (e.g. inside your app's run() callback):

changeLocale 函数更改 moment.js 的本地并更新所有 am-time-ago 指令实例。此函数接受两个参数语言环境和一个具有覆盖的对象。区域设置是区域设置代码的字符串,例如。 en、es、ru 等