{"id":42134069,"url":"https://github.com/pureartisan/simple-i18n","last_synced_at":"2026-01-26T16:04:03.592Z","repository":{"id":33260578,"uuid":"156893071","full_name":"pureartisan/simple-i18n","owner":"pureartisan","description":"Simple and lightweight i18n library","archived":false,"fork":false,"pushed_at":"2023-01-04T21:36:52.000Z","size":713,"stargazers_count":3,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-11T13:26:34.320Z","etag":null,"topics":["extensible","i18n","internationalization","javascript","lightweight","localization","translation"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pureartisan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-09T17:06:08.000Z","updated_at":"2023-06-06T12:03:43.000Z","dependencies_parsed_at":"2023-01-15T00:09:11.255Z","dependency_job_id":null,"html_url":"https://github.com/pureartisan/simple-i18n","commit_stats":null,"previous_names":["prageeth/simple-i18n"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/pureartisan/simple-i18n","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pureartisan%2Fsimple-i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pureartisan%2Fsimple-i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pureartisan%2Fsimple-i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pureartisan%2Fsimple-i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pureartisan","download_url":"https://codeload.github.com/pureartisan/simple-i18n/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pureartisan%2Fsimple-i18n/sbom","scorecard":{"id":743386,"data":{"date":"2025-08-11","repo":{"name":"github.com/pureartisan/simple-i18n","commit":"cdcab82ca319f887c5b1de5e8b6fae63da0fe56c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/26 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/pureartisan/simple-i18n/nodejs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/pureartisan/simple-i18n/nodejs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npmpublish.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/pureartisan/simple-i18n/npmpublish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npmpublish.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/pureartisan/simple-i18n/npmpublish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npmpublish.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/pureartisan/simple-i18n/npmpublish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npmpublish.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/pureartisan/simple-i18n/npmpublish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npmpublish.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/pureartisan/simple-i18n/npmpublish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npmpublish.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/pureartisan/simple-i18n/npmpublish.yml/master?enable=pin","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   4 out of   4 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1","Warn: no topLevel permission defined: .github/workflows/npmpublish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"29 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-8hfj-j24r-96c4","Warn: Project is vulnerable to: GHSA-wc69-rhjr-hc9g","Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T18:06:59.985Z","repository_id":33260578,"created_at":"2025-08-22T18:06:59.985Z","updated_at":"2025-08-22T18:06:59.985Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28782096,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T13:55:28.044Z","status":"ssl_error","status_checked_at":"2026-01-26T13:55:26.068Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["extensible","i18n","internationalization","javascript","lightweight","localization","translation"],"created_at":"2026-01-26T16:04:01.663Z","updated_at":"2026-01-26T16:04:03.585Z","avatar_url":"https://github.com/pureartisan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple I18n [![npm version](https://badge.fury.io/js/%40pureartisan%2Fsimple-i18n.svg)](https://badge.fury.io/js/%40pureartisan%2Fsimple-i18n) [![CircleCI](https://circleci.com/gh/pureartisan/simple-i18n.svg?style=svg)](https://circleci.com/gh/pureartisan/simple-i18n)\n\nSimple and light weight i18n library.\n\n## Installation\n```\nnpm install @pureartisan/simple-i18n\n```\n\n### HTML tags in your translations\n\nIf you want to use HTML tags in your translations safely (without opening your application into XSS), you have to use a proper technic to parse the tags in the translation file.\n\nYou can use one of the plugins for \"Simple I18n\" below. Depending on the framework being used:\n* React: plugin [`@pureartisan/simple-i18n-react`](https://github.com/prageeth/simple-i18n-react)\n* Angular: plugin coming soon...\n* Vue: plugin coming soon...\n\n***NOTE***\nThe above plugins are required ONLY if you want to use HTML tags in the translation files, otherwise you can simple use this module without your React/Angular/Vue projects.\n\n## Getting started\n```\n// ES5\nvar i18n = require('@pureartisan/simple-i18n');\n\n// ES6\nimport i18n from '@pureartisan/simple-i18n';\n\n// initialise once at the start\n// NOTE: normally you'd want to define the languages and rules on separate files and import them here.\n\ni18n.init({\n  locale: 'en',\n  languages: {\n    'en': { ... },\n    'en-uk': { ... },\n    'en-us': { ... },\n    'de': { ... },\n    'fr': { ... }\n  },\n  rules: {\n    'date': function() { ... },\n    'custom': function() { ... }\n  }\n});\n```\n\n## Translations\n```\n/*\nsample language file entry\n{\n  'home-page.greeting': 'Hello'\n}\n*/\nvar translated1 = i18n.translate('home-page.greeting');\n\n/*\nsample language file entry\n{\n  'home-page.greeting': 'Hello {firstName}'\n}\n*/\nvar translated2 = i18n.translate('home-page.greeting', { firstName: 'Bob' });\n```\n\n### Easy syntax\n\n```\n// ES5\nvar i18n = require('@pureartisan/simple-i18n');\nvar translate = i18n.translate;\n\n// ES6\nimport { translate } from '@pureartisan/simple-i18n';\n\n...\n\ntranslate('greeting');\n\n```\n\n## Locales\n\n```\nvar languageDefinitions = { // loaded from files\n  'common': {     // 'common' is shared with every different language and is used as a fallback\n    'greeting': 'Hi'\n  }\n  'en': {\n    'greeting': 'Hello'\n  },\n  'de': {\n    'greeting': 'Hallo'\n  }\n};\n\ni18n.init({\n  languages: languageDefinitions,\n  locale: 'en'\n});\n\n// translate now, will work with 'en'\ni18n.translate('greeting'); // returns 'Hello'\n\n// change to 'de'\ni18n.setLocale('de');\ni18n.translate('greeting'); // returns 'Hallo'\n\n// change to 'fr' (not defined in languages)\ni18n.setLocale('fr'); // this will default to 'common' locale\ni18n.translate('greeting'); // returns 'Hi'\n```\n\n## Rules\n\nRules are variable transforming functions, that takes in an object or string as a value, and the name of the variable and always returns a string.\n```\nfunction ( objectOrStringOption, nameOfVariable ) {\n  return someTransformedString;\n}\n```\n\nExample:\n```\nlanguage file entry:\n...\n'animal-count-statement': 'I have {count,number} {animal,singular-plural}'\n...\n\nvar rules = {\n  'number': function(value, name) {\n     return Math.floor(value).toString();\n   },\n   'singular-plural': function(obj, name) { // you can define the shape of this 'obj' according to your custom rule\n      var amount = obj.number;\n      var labelWhenSingular = obj.sinuglar;\n      var labelWhenPlural = obj.plural;\n      return amount === 1 ? labelWhenSingular : labelWhenPlural;\n   }\n}\n\n// calling the translation as below,\n// remember we need to provide the variables 'count' and 'animal' according to the above language file:\n// 'I have {count,number} {animal,singular-plural}'\n\nvar numCats = 5;\nvar catArgs = {\n  count: numCats,\n  animal: {\n    // remember the custom rule for 'singular-plural'\n    number: numCats,\n    singular: 'cat',\n    plural: 'cats'\n  }\n};\n\nvar numDogs = 1;\nvar dogArgs = {\n  count: numDogs,\n  animal: {\n    // remember the custom rule for 'singular-plural'\n    number: numDogs,\n    singular: 'dog',\n    plural: 'dogs'\n  }\n};\n\ni18n.translate('animal-count-statement', catArgs); // returns 'I have 5 cats'\ni18n.translate('animal-count-statement', dogArgs); // returns 'I have 1 dog'\n```\n\n## Locale dependant rules\n\nWe may sometimes need rules dependent on locale, such as different date formats\n\n```\nimport moment from 'moment';\n\n...\n\nvar languageDefinitions = {\n  'common': {\n    'greeting.today': 'Hi, today is {today,date}' // 'today' is the variable name, 'date' is the rule name\n  },\n  'en': {\n    'date-format': 'DD-MM-YYYY'\n  },\n  'de': {\n    'date-format': 'DD.MM.YYYY'\n  }\n};\n\nvar rules = {\n  'date': function(value, name) {\n     var dateFormat = i18n.raw('date-format'); // this will be resolved using the current locale\n     return moment(value).format(dateFormat);\n   }\n}\n\ni18n.init({\n  languages: languageDefinitions,\n  locale: 'en',\n  rules: rules\n});\n\n...\n\n// current locale is 'en'\ni18n.translate('greeting.today', { today: new Date() }); // returns 'Hi, today is 12-11-2018'\n\n// change to 'de'\ni18n.setLocale('de');\ni18n.translate('greeting.today'); // returns 'Hi, today is 12.11.2018'\n```\n\n## Helpers\n\n### i18n.setLocale(locale)\n\nYou can override the locale using `setLocal()` method.\n\n```\n// locale; e.g. 'en', 'en-uk', 'de', 'fr'\nfunction onUserChooseLanguage(locale) {\n   i18n.setLocale(lanugage);\n}\n```\n\n### i18n.raw(i18nKey)\n\nYou can access the raw/unprocessed i18n translation, that will return a raw string (variables will not be replaced).\n\n```\nvar languageDefinitions = {\n  'common': {\n    'greeting.today': 'Hi, today is {today,date}'\n  }\n}\n\n...\n\ni18n.raw(i18nKey); // returns 'Hi, today is {today,date}'\n```\n\n### i18n.process(i18nKey, i18nOptions)\n\nYou can also use the manual rules processor (regardless of the current locale).\n```\n// taken from the above example of rules, you can directly call the 'process()' method\ni18n.process('I have {count,number} {animal,singular-plural}', catArgs); // returns 'I have 5 cats'\ni18n.process('She has {count,number} {animal,singular-plural}', dogArgs); // returns 'She has 1 dog'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpureartisan%2Fsimple-i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpureartisan%2Fsimple-i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpureartisan%2Fsimple-i18n/lists"}