我将如何在Meteor中包含预定义的瞬间语言环境? [英] How would I include the pre-defined moment locales in Meteor?

查看:71
本文介绍了我将如何在Meteor中包含预定义的瞬间语言环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在流星中包含预定义的momentjs语言环境之一,该语言环境通常位于locales/*.js中,但是每当文档在Meteor中不起作用时都包括在内:

I'm wondering how to include one of the pre-defined momentjs locales in meteor, which normally resides in locales/*.js, but including this per the moment docs does not work in Meteor:

<script src="locale/pt.js"></script>

我如何在Meteor中包括预定义的瞬间语言环境?

How would I include the pre-defined moment locales in Meteor?

推荐答案

当需要外部资源(javascript库,css,图像,字体)时,请将它们放在public中.因此,在您的情况下,我会将文件放在public/js/momentjs/locales/pt.js中.然后,在包含我应用程序的<head>(在我的情况下为client/head.html)的文件中:

When external resources (javascript libraries, css, images, fonts) are needed, put them in public. So in your case, I would put the file in public/js/momentjs/locales/pt.js. Then, in the file containing my app's <head> (client/head.html in my case):

<head>
  <!-- etc -->
  <script src="/js/momentjs/locales/pt.js"></script>
</head>

您添加到头部的所有资源最终将被 插入流星包中的所有头部之后,因此无需担心加载顺序.

All the resources you add in the head will end up being inserted in the head after all the ones from meteor packages, so no need to worry about load order.

这篇关于我将如何在Meteor中包含预定义的瞬间语言环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆