{"id":20226309,"url":"https://github.com/mathix420/sb-datasource-to-i18n-json","last_synced_at":"2026-05-12T04:37:29.916Z","repository":{"id":207382466,"uuid":"719038457","full_name":"mathix420/sb-datasource-to-i18n-json","owner":"mathix420","description":"Convert Storyblok Datasource to i18n JSON","archived":false,"fork":false,"pushed_at":"2023-11-22T20:50:42.000Z","size":235,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T16:41:17.377Z","etag":null,"topics":["bun","cli","converter","extract","i18n","storyblok","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mathix420.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-11-15T10:16:38.000Z","updated_at":"2023-11-22T20:08:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"b799f1d1-a700-4cf7-a4e9-838c8b96f7ab","html_url":"https://github.com/mathix420/sb-datasource-to-i18n-json","commit_stats":null,"previous_names":["mathix420/sb-datasource-to-i18n-json"],"tags_count":5,"template":false,"template_full_name":"mathix420/starter-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathix420%2Fsb-datasource-to-i18n-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathix420%2Fsb-datasource-to-i18n-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathix420%2Fsb-datasource-to-i18n-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathix420%2Fsb-datasource-to-i18n-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mathix420","download_url":"https://codeload.github.com/mathix420/sb-datasource-to-i18n-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241670132,"owners_count":20000326,"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":["bun","cli","converter","extract","i18n","storyblok","typescript"],"created_at":"2024-11-14T07:17:22.999Z","updated_at":"2026-05-12T04:37:24.878Z","avatar_url":"https://github.com/mathix420.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sb-datasource-to-i18n-json\n\n\u003e Convert Storyblok Datasource to i18n JSON.\n\n[![wakatime](https://wakatime.com/badge/github/mathix420/sb-datasource-to-i18n-json.svg)](https://wakatime.com/badge/github/mathix420/sb-datasource-to-i18n-json) [![npm version](https://badge.fury.io/js/sb-datasource-to-i18n-json.svg)](https://badge.fury.io/js/sb-datasource-to-i18n-json)\n\nUseful for utilizing existing i18n integrations on a frontend framework instead of fetching from the Storyblok API.\n\nDesigned for a [nuxt-i18n](https://i18n.nuxtjs.org/) use case, but it's framework-agnostic.\n\nAs I have set up Vercel deployment webhooks on my Storyblok instance, every time the datasource is updated and saved, a new deployment will be performed, reflecting the changes.\n\n\n## Usage guide\n\n### Install\n\n```bash\n# npm\nnpm i -D sb-datasource-to-i18n-json\n# bun\nbun i -D sb-datasource-to-i18n-json\n# pnpm\npnpm i -D sb-datasource-to-i18n-json\n# yarn\nyarn add -D sb-datasource-to-i18n-json\n```\n\n### Run\n\n```bash\nnpx sb-i18n --help\n# OR\nbunx sb-i18n --help\n```\n\n### Integrate\n\nIn your `package.json`:\n```json\n{\n    \"scripts\": {\n        // To trigger on every npm i (usefull for CI jobs)\n        \"prepare\": \"sb-i18n -r eu -t TO_REPLACE -d DATASOURCE_NAME -l fr\",\n        // OR\n        \"sync-i18n\": \"sb-i18n -r eu -t TO_REPLACE -d DATASOURCE_NAME -l fr\",\n    }\n}\n```\n\nThen run\n```bash\nnpm i\n# OR\nnpm run sync-i18n\n```\n\n### Environment variables\n\nYou can use environment variables to define Storyblok access token and region.\n\n- `SB_ACCESS_TOKEN`, overriten by `-t, --token`\n- `SB_REGION`, overriten by `-r, --region`\n\n## Requirements\n\nFor this script to work, you need to setup a datasource following these rules:\n\n- Do not create a dimension for the default language.\n- Create a dimension for each language you want a translation:\n    - For the name of the dimension put everything you want (ex: `German`).\n    - For the value of the dimension, you need to respect the value your put in your i18n config (ex: `de`).\n- Remember the Slug/ID when creating a datasource (or see it in settings) as it correspond to the `-d, --datasource \u003cslug\u003e` parameter.\n\n## Dev guide\n\nTo install dependencies:\n\n```bash\nbun install\n```\n\nTo run:\n\n```bash\nbun run src/index.ts\n```\n\nThis project was created using `bun init`. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathix420%2Fsb-datasource-to-i18n-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathix420%2Fsb-datasource-to-i18n-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathix420%2Fsb-datasource-to-i18n-json/lists"}