{"_id":"@dare.me/static-i18n","_rev":"2-20a2ef1e572a8a8d0dbd8fd5de9814b0","name":"@dare.me/static-i18n","dist-tags":{"latest":"0.2.12"},"versions":{"0.2.10":{"name":"@dare.me/static-i18n","version":"0.2.10","description":"Utility to translate static HTML files.","main":"lib/index.js","bin":{"static-i18n":"bin/static-i18n.js"},"scripts":{"test":"mocha","coverage":"nyc mocha"},"repository":{"type":"git","url":"https://github.com/dare-me/node-static-i18n"},"keywords":["html","i18n","internationalization"],"author":{"name":"Daniel Perez"},"license":"MIT","bugs":{"url":"https://github.com/dare-me/node-static-i18n/issues"},"homepage":"https://github.com/dare-me/node-static-i18n","devDependencies":{"eslint":"^4.17.0","expect.js":"^0.3.1","nyc":"^11.4.1","tmp":"^0.0.33"},"dependencies":{"bluebird":"^3.5.1","cheerio":"^0.22.0","fs-extra":"^5.0.0","glob":"^7.1.2","i18next":"^11.2.3","js-yaml":"^3.10.0","lodash":"^4.17.5","minimist":"^1.1.0","mocha":"^5.0.1"},"prettier":{"singleQuote":true},"licenseText":"Copyright (c) 2014 Claude Tech\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@dare.me/static-i18n@0.2.10","dist":{"shasum":"cd608f8fb8ccd8c3576fd82d20515f437b315934","integrity":"sha512-I0oNE1874sWjvjzkIwti1WMQoI4AB1fcxWM9nf0xUsY3tAB9wCW9bGfr34q7eHaszG5zcW81YreUrKOPvD7POw==","tarball":"https://registry.npmjs.org/@dare.me/static-i18n/-/static-i18n-0.2.10.tgz","fileCount":15,"unpackedSize":24435,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDQoIDAluK597PCSpOQfFwfp2uARfyG6WIbzCzw8wF7DgIgEjU/YP4tcNISUAm2dlr7Wc6nK1pZnFOCOLLnPxUS0cM="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkNbRsACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmojQg/+PWvhRN+atArj08umAv3c+TXK03Kovd+nq5HsCtb/BQV/9yda\r\nMzvU770X/45npnwBaF8JSebGQ6M4pS3x0/9W2O1AtDGgh6KHDKWbKRCbcolN\r\nmpp4HdwFDBOAXgclRDyWdDYaqjxyCCix6QYNQny9AYJYR3HoW8U9HSs9hHi1\r\nkq1g5hggx8nkGTXyAnAYjRItkEZRYt1a692eX1TegVVXoV+hQ1QcLg30heK6\r\nnJAhC5bPlHhUtZ9vI03ijPdLmyP5qPp5Kug0OCJL3gsrN/axrjxoqPq34tf7\r\nvtJcpbJUfROrcnC4sbJgbes3EaPA9yNDjj9qN7QB+jFyMaCcBvF32l7KWMIO\r\nzzugpm3bGHb62kNLwNinpW2kSYML4kGts0sIjyUWQmkn9xjtBGYFOdr7aI4F\r\noKg2lTP9ZIy93Qx/Xh1R5VUeY0AWL4V24imj6KBrHPJCzAgLn1L1CvqqHcpb\r\nAdbyOi/315yqDS5FhFGv47wYoPz5au0tp1QmKTc05BJxIhKd39/Md+olCV94\r\nYEIQLrZ5fzghO3SymsL93TjUFf/FtOb5nKCBEVlSn8VtAmi/mF4jzzZZkGe5\r\n6tEqocKhWqsgQRS23dukgvSdyW6uRA9YwyLXBld9hMAFhAZYWUfoYlWPz+o6\r\ncnzZYNtq3/uff/kOCblWspovujXH0EEzryw=\r\n=MUmu\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dare.me","email":"daniel.redwig@dare-tec.de"},"directories":{},"maintainers":[{"name":"dare.me","email":"daniel.redwig@dare-tec.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/static-i18n_0.2.10_1681241196183_0.8053400313736068"},"_hasShrinkwrap":false},"0.2.11":{"name":"@dare.me/static-i18n","version":"0.2.11","description":"Utility to translate static HTML files.","main":"lib/index.js","bin":{"static-i18n":"bin/static-i18n.js"},"scripts":{"test":"mocha","coverage":"nyc mocha"},"repository":{"type":"git","url":"https://github.com/dare-me/node-static-i18n"},"keywords":["html","i18n","internationalization"],"author":{"name":"Daniel Perez"},"license":"MIT","bugs":{"url":"https://github.com/dare-me/node-static-i18n/issues"},"homepage":"https://github.com/dare-me/node-static-i18n","devDependencies":{"eslint":"^4.17.0","expect.js":"^0.3.1","nyc":"^11.4.1","tmp":"^0.0.33"},"dependencies":{"bluebird":"^3.7.2","cheerio":"^0.22.0","fs-extra":"^5.0.0","glob":"^7.1.2","i18next":"^11.2.3","js-yaml":"^4.1.0","lodash":"^4.17.5","minimist":"^1.2.8","mocha":"^10.2.0"},"prettier":{"singleQuote":true},"licenseText":"Copyright (c) 2014 Claude Tech\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@dare.me/static-i18n@0.2.11","dist":{"shasum":"9d3eb000b936ef6ff07b9527a9749a5cc85e0ec5","integrity":"sha512-ViXBTmBxG1xYNktKiWgap+mX0qM+4wwyYd8KumdpWjK2OnImXgCdVFss0Sw4lXyPZD0tCcZjNAjwimgsmF7AGg==","tarball":"https://registry.npmjs.org/@dare.me/static-i18n/-/static-i18n-0.2.11.tgz","fileCount":15,"unpackedSize":24435,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDzNaf6vuCJHVXvOtIlsVoa5EqWfznvinWhUnk9NA+eTwIgNEDn9r17AUf2eAxIwLB05Y2w5zk4qJ22rJdYbIm1oEg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkNbdcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrBSxAAkVe+vFgdStwhClG4RZKhhH4jRQjg0CLMVCGVoPkj3wqAM1hu\r\nwDwqcYLOwYJMAsMJswoHERoKdDxK8K86zq1aOZxIfmdHr7c4GCN4lh0ggefy\r\n6GQh+inV8whLIUiWpff33s9Rg2QpFZBqnyWBbjOtMwHfmKkGGb4yoJVyQQVb\r\nC8zwUir2nDqTahL9Z1x4a+yJTgc9y7BdxUNo0go78zYfH8ZRPQCQcv2nZZkX\r\nwL+AknSxuRx9hqQEdbuNb/QEoVdlDg79rWiwG2+57P2vrHYZdwZUzb1AervX\r\nIaOPHcLyptvBRPG05oVDl0LwDv4srLVLhy7FHfe0rTRcE1M0LLVoHdEwYoPF\r\naWbl1s23M6VJslUGSdeiRfpIWtWd2ChsHJQh4HlkZ51+y65zUDzj4uIEpAik\r\nVUeP0OhIBFHnpD7NRFMdv72gb0OY/mvtzou3ptXpYPxj9JC85zCEYiEUf4BL\r\nL4DG6X4lqB8P3yittaJXys8om0Dqq6T+j5wHrqvJZ51PQtHxL8suWOg0AVWA\r\n+T8eTYMXEvFdffumaWRQrc3lZFrS3oqCyhcPlgHtwK3BQPl23PLL2kRaGbDf\r\nDadFvbAbaTXl7MbY+q1dRwFe6AVxZOxOts9m0A49oj8qIxo3nNMpognVMDo+\r\nBkPYfKPmcfCvUt2KDnumG8V/9NY9B1neg/E=\r\n=X23y\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dare.me","email":"daniel.redwig@dare-tec.de"},"directories":{},"maintainers":[{"name":"dare.me","email":"daniel.redwig@dare-tec.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/static-i18n_0.2.11_1681241947782_0.3790667488921309"},"_hasShrinkwrap":false},"0.2.12":{"name":"@dare.me/static-i18n","version":"0.2.12","description":"Utility to translate static HTML files.","main":"lib/index.js","bin":{"static-i18n":"bin/static-i18n.js"},"scripts":{"test":"mocha","coverage":"nyc mocha"},"repository":{"type":"git","url":"https://github.com/dare-me/node-static-i18n"},"keywords":["html","i18n","internationalization"],"author":{"name":"Daniel Perez"},"license":"MIT","bugs":{"url":"https://github.com/dare-me/node-static-i18n/issues"},"homepage":"https://github.com/dare-me/node-static-i18n","devDependencies":{"eslint":"^4.17.0","expect.js":"^0.3.1","nyc":"^11.4.1","tmp":"^0.0.33"},"dependencies":{"bluebird":"^3.7.2","cheerio":"^1.0.0-rc.12","fs-extra":"^5.0.0","glob":"^7.1.2","i18next":"^11.2.3","js-yaml":"^4.1.0","lodash":"^4.17.5","minimist":"^1.2.8","mocha":"^10.2.0"},"prettier":{"singleQuote":true},"licenseText":"Copyright (c) 2014 Claude Tech\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@dare.me/static-i18n@0.2.12","dist":{"shasum":"6dd10fc779292c3e08233c7ed42c13534def46f9","integrity":"sha512-1NoaW2UYyLKHYt4omVCYQCQEc6Ypb7u81prThBiui347H6gN9dx+3efERTuEdCjzn1mGnJtK7Fp33wDhMq2JHA==","tarball":"https://registry.npmjs.org/@dare.me/static-i18n/-/static-i18n-0.2.12.tgz","fileCount":15,"unpackedSize":24440,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHQc0iAM9din3WGkhiLI8wl9EA+0pK5PejdoH3NIf23kAiEAnkZhxqoxAqNV0eKyZskD/+BMdyeTnSu7uhMYllG4yqs="}]},"_npmUser":{"name":"dare.me","email":"daniel.redwig@dare-tec.de"},"directories":{},"maintainers":[{"name":"dare.me","email":"daniel.redwig@dare-tec.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/static-i18n_0.2.12_1684153395689_0.37656608738856345"},"_hasShrinkwrap":false}},"time":{"created":"2023-04-11T19:26:36.121Z","0.2.10":"2023-04-11T19:26:36.318Z","modified":"2023-05-15T12:23:16.039Z","0.2.11":"2023-04-11T19:39:07.971Z","0.2.12":"2023-05-15T12:23:15.907Z"},"maintainers":[{"name":"dare.me","email":"daniel.redwig@dare-tec.de"}],"description":"Utility to translate static HTML files.","homepage":"https://github.com/dare-me/node-static-i18n","keywords":["html","i18n","internationalization"],"repository":{"type":"git","url":"https://github.com/dare-me/node-static-i18n"},"author":{"name":"Daniel Perez"},"bugs":{"url":"https://github.com/dare-me/node-static-i18n/issues"},"license":"MIT","readme":"# node-static-i18n [![Build Status](https://travis-ci.org/claudetech/node-static-i18n.svg?branch=master)](https://travis-ci.org/claudetech/node-static-i18n)\n\nA simple utility to translate static HTML files.\n\nSupports JSON and YAML dictionaries.\n\n## Installation\n\nFor global installation, needed for CLI uage, run\n\n```sh\n$ npm install -g static-i18n\n```\n\nNote that you can also use this as a [Grunt plugin](https://github.com/claudetech/grunt-i18n-static) or a [gulp plugin](https://github.com/36web/gulp-static-i18n-html).\n\n## Example\n\nA simple example should be easy to understand.\n\nWith the following files:\n\n`www/index.html`:\n\n```html\n<html>\n  <head>\n    <script src=\"js/app.js\"></script>\n  </head>\n  <body>\n    <h1 data-t=\"my.key\"></h1>\n    <p data-t>other.key</p>\n    <input type=\"submit\" data-attr-t value-t=\"other.ok\">\n  </body>\n</html>\n```\n\n`locales/en.json`\n\n```json\n{\n  \"my\": {\n    \"key\": \"Hey\"\n  },\n  \"other\": {\n    \"key\": \"man\",\n    \"ok\": \"confirm\"\n  }\n}\n```\n\n`locales/fr.json`\n\n```json\n{\n  \"my\": {\n    \"key\": \"Salut\"\n  },\n  \"other\": {\n    \"key\": \"mec\",\n    \"ok\": \"confirmer\"\n  }\n}\n```\n\nThe following command\n\n```sh\n$ static-i18n -l en -i en -i fr www\n```\n\nwill generate:\n\n`i18n/index.html`\n\n```html\n<html>\n  <head>\n    <script src=\"js/app.js\"></script>\n  </head>\n  <body>\n    <h1>Hey</h1>\n    <p>man</p>\n    <input type=\"submit\" value=\"confirm\">\n  </body>\n</html>\n```\n\n`i18n/fr/index.html`\n\n```html\n<html>\n  <head>\n    <script src=\"../js/app.js\"></script>\n  </head>\n  <body>\n    <h1>Salut</h1>\n    <p>mec</p>\n    <input type=\"submit\" value=\"confirmer\">\n  </body>\n</html>\n```\n\n## Interpolation\nYou can optionally specify that interpolation should be applied to the custom attributes on an element.\nThis will translate only the parts of an element wrapped in curly braces {{ }} and leave the rest alone.\n\nWith the following files:\n\n`www/index.html`:\n\n```html\n<html>\n  <head>\n    <link rel=\"canonical\" data-attr-t data-attr-t-interpolate href-t=\"{{links.baseAbsolute}}filename.{{links.extension}}\" />\n  </head>\n</html>\n```\n\n`locales/en.json`\n\n```json\n{\n  \"links\": {\n    \"baseAbsolute\": \"http://www.example.com/\",\n    \"extension\": \"html\"\n  }\n}\n```\n\n`locales/ja.json`\n\n```json\n{\n  \"links\": {\n    \"baseAbsolute\": \"http://www.example.com/ja/\",\n    \"extension\": \"htm\"\n  }\n}\n```\n\nThe following command\n\n```sh\n$ static-i18n --locale en --locales en --locales ja www\n```\n\nWill generate:\n\n`i18n/index.html`\n\n```html\n<html>\n  <head>\n    <link rel=\"canonical\" href=\"http://www.example.com/filename.html\" />\n  </head>\n</html>\n```\n\n`i18n/ja/index.html`\n\n```html\n<html>\n  <head>\n    <link rel=\"canonical\" href=\"http://www.example.com/ja/filename.htm\" />\n  </head>\n</html>\n```\n\n## Configuration\n\nThis tool has several configuration options to adapt to most common use cases.\n\nWhen using the CLI, these options can be passed by using the kebab-case version of the key. For example. `attrSelector` can be passed with\n\n```\nstatic-i18n --attr-selector my-attr-t ...\n```\n\n* `selector` (default: `[data-t]`): The selector to look for elements to translate. If it is an attribute, the attribute content is used as the key when non empty, otherwise the text of the element is used.\n* `attrSelector` (default: `[data-attr-t]`): The selector to look for elements\n* `attrInterpolateSelector` (default: `[data-attr-t-interpolate]`): The selector that should be applied to elements to indicate that interpolation should be performed for the custom attributes on that element\n* `xml` (default: `false`): If `true`, enables XML mode for https://github.com/fb55/htmlparser2 which avoids breaking self-closing tags\n* `attrSuffix` (default: `-t`): Suffix for attr to translate. `value-t` will be translated and mapped to `value`.\n* `attrInterpolateSuffix` (default: `-t-interpolate`): Suffix for attr to interpolate the translations.\n* `useAttr` (default: `true`): If `false`, the element text is always used as the key, even if the attribute value is not empty.\n* `nsSeparator` (default: `:`): The namespace separator. Useful if keys contain colons. Change it to something else to prevent cutting off the namespace.\n* `replace` (default: `false`): If `true`, the element is replaced by the translation. Useful to use something like `<t>my.key</t>` to translate.\n* `locales` (default: `['en']`, CLI alias: `-i`): the list of locales to be generated.\n  All locales need to have an existing resource file.\n* `fixPaths` (default: `true`): When `true`, the `script[src]` and `link[href]`  relative paths are fixed to fit the new subdirectory structure. (See example above.)\n* `locale` (default: `en`, CLI alias: `-l`): The default locale.\n* `exclude` (default: `[]`): Files to exclude. Can contain regex (uses normal test) or string (uses startsWith).\n* `fileFormat` (default: `json`): The file format for the translations.\n  Supports `json`, and `yml` or `yaml` which will be treated as YAML files. The file extension must match this format.\n* `encoding` (default: `utf8`): The encoding to read files (only works with yaml for now)\n* `files` (default: `**/*.html`): The files to translate, relative to the base directory.\n* `baseDir` (default: `process.cwd()`, CLI alias: `-d`): The base directory to look for translations. Not useful for CLI usage as it is overriden by the directory argument.\n* `translateConditionalComments` (default: `false`): Translate the content of conditional comments (see #1). This is still experimental, and could fail on edge cases. Open an issue if needed.\n* `allowHtml` (default: `false`): Allow the usage of HTML in translation\n* `removeAttr` (default: `true`): When `true`, removes the attribute used to translate (e.g. `data-t` will be removed)\n* `outputDir` (default: `i18n`, CLI alias: `-o`): The directory to output generated files\n* `outputDefault` (default: `__file__`): The name for the default locale output files, relative to `outputDir`. `__file__` will be replaced by the\n current file name\n* `outputOther` (default: `__lng__/__file__`): The name for the other locales output files, relative to `outputDir`. `__lng__` will be replaced\n  by the current locale\n* `localesPath` (default: `locales`): The directory of the translations, where\n  each file should be named `LOCALE_NAME.json`\n* `outputOverride`: Override outputDefault or outputOther for special cases (default: {})\n  eg:\n\n    ```javascript\n    {\n      \"en\": {\n        \"index.html\": \"foo.html\"\n      },\n      \"ja\": {\n        \"index.html\": \"ja_index.html\"\n      }\n    }\n    ```\n* `i18n`: Object passed directly to [`i18next.init`](http://i18next.com/pages/doc_init.html). This allows you to override pretty much anything. Read [i18next](http://i18next.com/) doc for more info.\n\nWhen using the CLI, `outputOverride` and `i18n` options are parsed as JSON.\n","readmeFilename":"README.md"}