0

我正在使用 gettext 来翻译我的 AngularJS 网站——在我有可以添加“翻译”的 HTML 属性的地方,一切正常。

但是,我还有一个相当大且复杂的 JSON 文件需要翻译,其中包括数组和对象。

有没有办法将它包含在 gettext 所做的翻译中,到 PO 文件中?或者我是否需要重新考虑使用 JSON 文件来分割客户流的整个想法?

我在下面包含了 JSON 文件的初始提取

{
  "version": "1.1",
  "name": "MVP",
  "description": "Initial customer segmenting flow",
  "enabled": true,
  "funnel": [
    {
      "text": "I am...",
      "image": "",
      "help": "",
      "options": [
        {
          "text": "Placing an order",
          "image": "image1.png",
          "next": 2
        },
        {
          "text": "E-mailing customer service",
          "image": "image2.png",
          "next": 2
        },

谢谢詹姆斯

4

1 回答 1

0

在构建时使用脚本自己处理 HTML 文件,并将所有可翻译的消息转储到一个虚拟源文件中,使用字符串提取器所期望的语法,可能是这样的:

<translate>I am ...</translate>
<translate>Placing an order</translate>
<translate>E-mailing customer service</translate>
于 2018-08-09T12:43:08.990 回答