{"id":20870939,"url":"https://github.com/noelmugnier/svelte-translate","last_synced_at":"2025-10-07T09:16:20.508Z","repository":{"id":57375423,"uuid":"407839246","full_name":"noelmugnier/svelte-translate","owner":"noelmugnier","description":"Use a dynamic translation service (loaded from xx-XX.json files) and fallback to the text in html tags if no translations are provided.","archived":false,"fork":false,"pushed_at":"2021-10-01T14:03:20.000Z","size":895,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-07T11:41:27.696Z","etag":null,"topics":["svelte","sveltejs","translate"],"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/noelmugnier.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":"2021-09-18T11:17:42.000Z","updated_at":"2023-06-12T06:37:08.000Z","dependencies_parsed_at":"2022-09-07T13:40:15.091Z","dependency_job_id":null,"html_url":"https://github.com/noelmugnier/svelte-translate","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noelmugnier%2Fsvelte-translate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noelmugnier%2Fsvelte-translate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noelmugnier%2Fsvelte-translate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noelmugnier%2Fsvelte-translate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noelmugnier","download_url":"https://codeload.github.com/noelmugnier/svelte-translate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253729553,"owners_count":21954652,"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","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":["svelte","sveltejs","translate"],"created_at":"2024-11-18T06:18:13.751Z","updated_at":"2025-10-07T09:16:15.459Z","avatar_url":"https://github.com/noelmugnier.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Svelte Translate (inspired by angular i18n and svelte-i18n)\n\nDynamic translation service (loaded from xx-XX.json files) and fallback to the text in html tags if no translations are provided.\n\n# ICU support (FormatJS)\n\nThis component use [formatjs](https://github.com/formatjs/formatjs) to handle complex formatting (plural, select, etc...)\n\n# Usages\n\n```js\n\u003cscript\u003e\n    import {\n\t  i18n,\n\t  def,\n\t  i18nStore,\n\t  languages,\n\t  DynamicTranslatedApp,\n\t  getLocaleFromNavigator\n\t} from \"svelte-translate\";\n\n\timport LanguageSelector from \"./LanguageSelector.svelte\";\n\n\timport enGB from './../public/lang/en-GB.json';\n\timport frFR from './../public/lang/fr-FR.json';\n\n\tlet count = 0;\n\n\ti18nStore.addTranslations(\"en-GB\", enGB);\n\ti18nStore.addTranslations(\"fr-FR\", frFR);\n\u003c/script\u003e\n```\n\n```html\n\u003cDynamicTranslatedApp \n\tfallbackLanguage=\"fr-FR\" \n\tinitialLanguage={getLocaleFromNavigator()}\n\thideContentWhileLoading={true}\u003e\n    \u003cLanguageSelector /\u003e\n    \u003cspan i18n={def(\"myid\", {sampleValue})}\u003eDefault text with bindings {sampleValue}\u003cspan\u003e\n    \u003cspan i18n={\"simpleid\"}\u003eText without complex construction\u003c/span\u003e\n\u003c/DynamicTranslatedApp\u003e\n\n```\nThen add two json files (fr-FR.json/en-GB.json) in public/lang folder containing your translations :\n\n```json\n{\n  \"myid\": \"Custom translation text with bindings {sampleValue}\",\n  \"simpleid\": \"Custom text without bindings\",\n}\n```\n\n# TODO\n\n* [ ] support context/description in def() helper in order to extract them and complete xlf files require a fork on xliff library to use custom attributes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoelmugnier%2Fsvelte-translate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoelmugnier%2Fsvelte-translate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoelmugnier%2Fsvelte-translate/lists"}