claudetech / node-static-i18n

HTML static pages i18n tool
https://www.npmjs.com/package/static-i18n
MIT License
102 stars 21 forks source link

Not translating texts with periods #11

Closed alvarotrigo closed 6 years ago

alvarotrigo commented 6 years ago

For example:

<p data-t>This is a demo of a text that won't get translated. Not sure why.</p>

Using the following json file:

{
  "Create": "pepe",
  "This is a demo of a text that won't get translated. Not sure why.": "aaaaa"
}

It seems the dot is not allowed within the key. Not matter if you use json or yaml

alvarotrigo commented 6 years ago

Found the solution, we have to change the default value for keyseparator in i18next

static-i18n -l en -i en -i es --fileFormat yml --i18n "{\"keyseparator\": \"::\"}" www
danhper commented 6 years ago

Hi, Yes, by default . is used to separate keys to be able to nest them. As you said, changing the keyseparator is I think the best solution.

Note that you can used single quotes in your shell to avoid having to escape JSON keys:

static-i18n -l en -i en -i es --fileFormat yml --i18n '{"keyseparator": "::"}' www