{"id":34538487,"url":"https://github.com/stefanholzapfel/lit-translate","last_synced_at":"2025-12-24T06:12:17.506Z","repository":{"id":44889237,"uuid":"362404808","full_name":"stefanholzapfel/lit-translate","owner":"stefanholzapfel","description":"A very basic and lightweight translation directive for LitElement 2","archived":false,"fork":false,"pushed_at":"2025-10-24T09:04:50.000Z","size":70,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-23T15:05:08.171Z","etag":null,"topics":["builtwithlit","lit","localization","translation"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stefanholzapfel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-04-28T09:06:04.000Z","updated_at":"2025-10-24T09:04:53.000Z","dependencies_parsed_at":"2025-10-24T11:09:40.691Z","dependency_job_id":"93c1a3ca-8b39-4b97-a49c-acd3a38e5f66","html_url":"https://github.com/stefanholzapfel/lit-translate","commit_stats":{"total_commits":54,"total_committers":3,"mean_commits":18.0,"dds":0.537037037037037,"last_synced_commit":"ac27810839943cc24a7fc87535a7daa491c2f0a9"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/stefanholzapfel/lit-translate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanholzapfel%2Flit-translate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanholzapfel%2Flit-translate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanholzapfel%2Flit-translate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanholzapfel%2Flit-translate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stefanholzapfel","download_url":"https://codeload.github.com/stefanholzapfel/lit-translate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanholzapfel%2Flit-translate/sbom","scorecard":{"id":850447,"data":{"date":"2025-08-11","repo":{"name":"github.com/stefanholzapfel/lit-translate","commit":"df451812676b3b5a5f73392dd9a8b2762b174b59"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"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/30 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":"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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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: MIT License: 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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"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-23T22:22:30.828Z","repository_id":44889237,"created_at":"2025-08-23T22:22:30.828Z","updated_at":"2025-08-23T22:22:30.828Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27996029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["builtwithlit","lit","localization","translation"],"created_at":"2025-12-24T06:12:16.903Z","updated_at":"2025-12-24T06:12:17.501Z","avatar_url":"https://github.com/stefanholzapfel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lit-translate\nA very basic and lightweight translation directive for Lit\n\n\u003ch1\u003eInstallation\u003c/h1\u003e\n\n```\nnpm install @stefanholzapfel/lit-translate\n```\n\n\u003ch1\u003eInitialize the service\u003c/h1\u003e\n\nBefore using the directive register a \"loader\" with the service.\n\nThe loader is an async function telling the translator how to load any specific language.\n\nIt receives a language identifier (string) and must return a Strings object which is an arbitrarily deeply nested object with only string values.\n\n```\nimport { TranslateService } from '@stefanholzapfel/lit-translate';\n\nTranslateService.init(\n    language =\u003e {\n        // load and return translations for language here (e.g. fetch from a JSON file)\n    });\n```\n\n\u003ch1\u003eUsage\u003c/h1\u003e\n\n\u003ch3\u003eSet language:\u003c/h3\u003e\n\nSet the language to use with use().\n\nThe function is async and can be awaited if you want to avoid translation identifiers flashing up in your app.\n\nThe translation identifier can be whatever string you want, but I suggest to stick to a standard like ISO639.\n```\nawait TranslateService.use('en-GB');\n```\n\n\u003ch3\u003eUsage in lit-html:\u003c/h3\u003e\n\nThe translate directive accepts an identifier in dot notation. For this Strings object:\n```\n{\n    app: {\n        my_string: \"TEST\"\n    }\n}\n```\n\n\n\n```\n\u003cspan\u003etranslate('app.my_string')\u003c/span\u003e\n```\n\nresolves to:\n```\n\u003cspan\u003eTEST\u003c/span\u003e\n```\n\nThe directive will automatically listen for language changes and change all directive values accordingly.\n\nUse ``translateUnsafeHTML()`` if you want HTML in translations to be interpreted (otherwise same interface).\nUse ``translateUppercase()`` if you want the output in uppercase letters.\n\n\u003ch3\u003eInterpolation:\u003c/h3\u003e\n\nYou can have dynamic parts in your translations. Just mark them with {{ name }} e.g.:\n\n```\n{\n    app: {\n        my_string: \"TEST {{ test_var }}\"\n    }\n}\n```\n\n\n```\n\u003cspan\u003etranslate('app.my_string', { test_var: \"another test\" })\u003c/span\u003e\n```\n\nresolves to:\n```\n\u003cspan\u003eTEST another test\u003c/span\u003e\n```\n\nUse as many interpolation values as you want. Just add them as properties to the interpolation object.\n\nInterpolations can be strings, TemplateResults or DirectiveResults. That means you can e.g. nest translate directives\nin each other: \n```\n\u003cspan\u003etranslate('app.my_string', { test_var: translate('app.nested_string') })\u003c/span\u003e\n```\n\n\n\u003ch3\u003eClear all cached Strings:\u003c/h3\u003e\n\n```\nTranslateService.clearStrings();\n```\n\n\u003ch1\u003eOptional: Directly translate from objects\u003c/h1\u003e\n\nThis library also offers a way to provide a translations object in-place and a directive that automatically renders the language currently active in the `TranslateService` from it:\n\nA sample translations object:\n\n```\nconst myTranslations = {\n    'en-GB': 'Hi, I'm a translationsObject!',\n    'de-DE': 'Hallo, ich bin ein translationsObject!'\n};\n```\n\nUsage with the directive:\n\n```\ntranslateObject(myTranslations);\n```\n\nA fallback language identifier can be provided as second parameter to the directive.\n\nUse ```translateObjectUnsafeHTML(myTranslations)``` to interpret HTML in translation strings.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanholzapfel%2Flit-translate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefanholzapfel%2Flit-translate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanholzapfel%2Flit-translate/lists"}