{"id":15383331,"url":"https://github.com/andreruffert/i18n-literally","last_synced_at":"2025-04-05T02:04:16.378Z","repository":{"id":37612109,"uuid":"168389620","full_name":"andreruffert/i18n-literally","owner":"andreruffert","description":"🍦 A simple way to introduce internationalization to your JS","archived":false,"fork":false,"pushed_at":"2025-03-25T00:21:21.000Z","size":277,"stargazers_count":80,"open_issues_count":4,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-29T01:02:53.645Z","etag":null,"topics":["cli","i18n","internationalization","javascript","js","l10n","localization","template-literals","translation"],"latest_commit_sha":null,"homepage":"https://npm.im/i18n-literally","language":"JavaScript","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/andreruffert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["andreruffert"],"custom":["https://paypal.me/andreruffert","https://thx.to/:andre"]}},"created_at":"2019-01-30T18:03:31.000Z","updated_at":"2025-03-05T02:28:05.000Z","dependencies_parsed_at":"2024-06-21T20:19:38.722Z","dependency_job_id":"c94aace9-66cb-447c-bcb7-d357d0d058c7","html_url":"https://github.com/andreruffert/i18n-literally","commit_stats":{"total_commits":142,"total_committers":6,"mean_commits":"23.666666666666668","dds":0.4859154929577465,"last_synced_commit":"a7a228639a8b8571c7a1b1b47386e000e062f573"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreruffert%2Fi18n-literally","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreruffert%2Fi18n-literally/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreruffert%2Fi18n-literally/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreruffert%2Fi18n-literally/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreruffert","download_url":"https://codeload.github.com/andreruffert/i18n-literally/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276162,"owners_count":20912288,"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":["cli","i18n","internationalization","javascript","js","l10n","localization","template-literals","translation"],"created_at":"2024-10-01T14:36:58.632Z","updated_at":"2025-04-05T02:04:16.363Z","avatar_url":"https://github.com/andreruffert.png","language":"JavaScript","funding_links":["https://github.com/sponsors/andreruffert","https://paypal.me/andreruffert","https://thx.to/:andre"],"categories":[],"sub_categories":[],"readme":"# i18n-literally\n\n\u003e A simple way to introduce internationalization to your JS.\n\n[![CI status](https://github.com/andreruffert/i18n-literally/workflows/CI/badge.svg)](https://github.com/andreruffert/i18n-literally/actions?workflow=CI)\n[![npm version](https://img.shields.io/npm/v/i18n-literally.svg)](https://www.npmjs.com/package/i18n-literally)\n[![npm downloads](https://img.shields.io/npm/dm/i18n-literally?logo=npm)](https://www.npmjs.com/package/i18n-literally)\n\n## Install\n\n```\n$ npm install i18n-literally\n```\n\n\n## Usage\n\n```js\nimport i18n from 'i18n-literally';\nimport db from './i18n.db.json';\n\n// Set the database\ni18n.db = db;\n\n// 1. Write in the default language\ni18n`Hello ${'World'}!`\n// =\u003e Hello World!\n\n// 2. Add/update your translations for a language\n\"$ npx i18n-literally index.js es\"\n\n// 3. Get translations based on locale\ni18n.locale = 'es';\ni18n`Hello ${'World'}!`\n// =\u003e Hola World!\n```\n\nWrite your entire application in the default language, and support multiple versions of the language by simply changing the `i18n.locale`. To Add/update translations simply run the [cli](#cli).\n\n\n## API\n\n### i18n\\`template\\`\n\nReturns a string based on the locale (default \"en\").\n\n### i18n.locale\n\nType: `string`\nDefault: `en`\n\n### i18n.db\n\nType: `object`\nDefault: `{}`\n\n\n## CLI\n\nThe cli helps you to easily maintain your translations in a simple web app.\nAll translations are stored in a [i18n.db.json](i18n.db.json) file.\n\n```console\n$ npx i18n-literally --help\n\n  Usage:\n    $ literally \u003ccmd\u003e \u003centry\u003e \u003clocale\u003e [db]\n\n  Arguments:\n    \u003ccmd\u003e       Command defaults to \"edit\" (edit, check-missing-translations)\n    \u003centry\u003e     The entry file of your app\n    \u003clocale\u003e    Locale to add/update translations for\n    [db]        Database file defaults to \"./i18n.db.json\"\n\n  Options:\n    --root      Project's root directory (default: $PWD)\n    --rootAlias Alias used by imports for project's root\n    --help      Show information\n    --version   Show current version\n\n  Examples:\n    $ literally edit ./index.js es\n    $ literally edit ./src/index.js en --root=src --rootAlias=~\n```\n\n_The cli web app to add/update translations_.\n![alt text](https://user-images.githubusercontent.com/464300/52097192-240d8c80-25ca-11e9-9a97-8a7d3b4626e0.png)\n\n\n## Related\n\nInspired by this [post](https://codeburst.io/easy-i18n-in-10-lines-of-javascript-poc-eb9e5444d71e) from [Andrea Giammarchi](https://github.com/WebReflection).\n\n\n## License\n\nMIT © [André Ruffert](https://andreruffert.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreruffert%2Fi18n-literally","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreruffert%2Fi18n-literally","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreruffert%2Fi18n-literally/lists"}