我将 Plunker 用于 Polymer 的 i18n
演示,但出现错误:
Uncaught (in promise) ReferenceError: IntlMessageFormat is not defined
默认是英文的,也是因为上面的错误所以没有显示。我希望它显示:
My name is Batman.
并且在将下拉列表从 English
更改为 France
时,文本应更改为:
Je m'apelle Batman.
此代码在我的本地系统上运行良好,但在 Plunker 上运行不正常。我错过了什么?
最佳答案
intl-messageformat
是必需的,但无法通过 polygit
获得(至少我无法让它工作),但你可以用这个 <script>
手动导入它标记 before 导入 <app-localize-behavior>
,这将允许您的演示工作:
<script src="https://rawgit.com/yahoo/intl-messageformat/v1.3.0/dist/intl-messageformat-with-locales.min.js"></script>
工作 plunker
关于javascript - polymer : Uncaught (in promise) ReferenceError: IntlMessageFormat is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41736423/