Meteor 1.8,Blaze和i18n本地化

时间:2019-04-09 21:29:58

标签: meteor localization internationalization meteor-blaze i18next

到目前为止,似乎Tap&Universe都不适合Meteor 1.8和Blaze

安装Universe:

meteor add universe:i18n universe:i18n-blaze

为Tap安装:

meteor add tap:i18n tap:i18n-db

我有以下配置文件(Tap和Universe):

/i18n/en.i18n.json

{
    "hello": "hello world"
}

/i18n/fr.i18n.json

{
    "hello": "bonjour"
}

带有Tap的Blaze模板文件 /client/blaze-template-tap.html

<template name="BlazeTemplateTap">
  {{_ "hello"}}
</template>

/client/blaze-template-universe.html

<template name="BlazeTemplateUniverse">
  {{__ "hello"}}
</template>

此外,对于Universe(仅),我需要在模板中注册名称空间: /client/blaze-template-universe.js

Template.BlazeTemplateUniverse.bindI18nNamespace('hello');

无论是否通过

更改英语和法语之间的本地化,结果始终是
chrome://settings/languages

和/或Quick Language Switcher Chrome扩展程序。

// Chrome结果:

hello world

因此在Blaze模板{{__ "hello"}}和en.i18n.json文件{ "hello" "hello world" }之间建立了连接(在Tap和Universe中都是如此),因为它显示的是“ hello world”。但是,当我尝试在Chrome中切换语言时,没有点击。

我需要帮助让Tap或Universe(甚至我尚未尝试过的i18next)在Blaze中显示不同的语言。

0 个答案:

没有答案
相关问题