claudetech / node-static-i18n

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

Only translate defined locales, skip default locale while still removing all data-t attributes #48

Open nCubed opened 3 years ago

nCubed commented 3 years ago

Is it possible to only translate the defined locales and skip the base locale, but still strip the data-t attributes in the base locale?

For example, we have an existing static website with the English language and would like to create a Spanish language version. I would like to leave the existing English text and simply add the data-t="some.path" attribute where the language should be substituted for the Spanish version and output to the "es" directory. With the net effect of the original html file is the English text remains, but the data-t="some.path" attribute is stripped.

I've found this is mostly possible by defining only an "es" locale in the locales switch. The Spanish version of the html is created and the original English version is untouched. However, the original English version still retains the data-t attributes (and value), whereas the Spanish version data-t attribute (and value) is stripped as expected.

Hopefully this makes sense.