{"id":18577389,"url":"https://github.com/ecomplus/i18n","last_synced_at":"2025-04-10T09:30:48.924Z","repository":{"id":36983928,"uuid":"210462564","full_name":"ecomplus/i18n","owner":"ecomplus","description":"Tree shakable dictionary for eCommerce JS apps","archived":false,"fork":false,"pushed_at":"2025-03-31T16:09:05.000Z","size":2264,"stargazers_count":2,"open_issues_count":3,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-02T01:41:25.568Z","etag":null,"topics":["dictionary","e-commerce","internationalization","javascript-modules","translations"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ecomplus.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}},"created_at":"2019-09-23T22:19:28.000Z","updated_at":"2025-02-17T17:51:26.000Z","dependencies_parsed_at":"2023-02-13T01:16:28.476Z","dependency_job_id":"92dbfa3b-54a0-4d38-a6d9-97a699c3b092","html_url":"https://github.com/ecomplus/i18n","commit_stats":{"total_commits":331,"total_committers":6,"mean_commits":"55.166666666666664","dds":0.5438066465256798,"last_synced_commit":"6466db55604cf718c8888b123a216b266dcf86ea"},"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomplus%2Fi18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomplus%2Fi18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomplus%2Fi18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomplus%2Fi18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ecomplus","download_url":"https://codeload.github.com/ecomplus/i18n/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248191638,"owners_count":21062542,"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":["dictionary","e-commerce","internationalization","javascript-modules","translations"],"created_at":"2024-11-06T23:28:59.992Z","updated_at":"2025-04-10T09:30:48.344Z","avatar_url":"https://github.com/ecomplus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# i18n\n\n[![Publish](https://github.com/ecomplus/i18n/workflows/Publish/badge.svg)](https://github.com/ecomplus/i18n/actions?workflow=Publish) [![npm version](https://img.shields.io/npm/v/@ecomplus/i18n.svg)](https://www.npmjs.org/@ecomplus/i18n) [![License MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n:brazil: :us:\n\nTree shakable dictionary focused on eCommerce JS applications.\n\n\u003e `i18n` ~ `i19` ~ Internationalization\n\n## Getting started\n\n```bash\nnpm i --save @ecomplus/i18n\n```\n\n### Usage\n\n```js\nimport { i19hello, i19visitor } from '@ecomplus/i18n'\nconsole.log(`${i19hello.en_us} ${i19visitor.pt_br}`)\n// Hello Visitor\nconsole.log(`${i19hello.pt_br} ${i19visitor.pt_br}`)\n// Olá Visitante\n```\n\nWe recommend using it with [`ecomUtils.i18n`](https://developers.e-com.plus/utils/ecomUtils.html#.i18n):\n\n```js\nimport { i18n } from '@ecomplus/utils'\nimport { i19hello, i19visitor } from '@ecomplus/i18n'\nconsole.log(`${i18n(i19hello)} ${i18n(i19visitor)}`)\n// Hello Visitor\n```\n\nChange current language with `ecomUtils._config`:\n\n```js\nimport { _config, i18n } from '@ecomplus/utils'\nimport { i19hello, i19visitor } from '@ecomplus/i18n'\n_config.set('lang', 'pt_br')\nconsole.log(`${i18n(i19hello)} ${i18n(i19visitor)}`)\n// Olá Visitante\n```\n\n#### Import entire dictionary object\n\nIt'll output large size bundle, _not good for frontend apps_.\n\n```js\nimport dictionary from '@ecomplus/i18n'\nconsole.log(`${dictionary.i19hello.en_us} ${dictionary.i19visitor.en_us}`)\n// Hello Visitor\n```\n\n### Webpack alias\n\nYou can import only one language variation using [Webpack `resolve.alias`](https://webpack.js.org/configuration/resolve/#resolvealias) as following:\n\n```js\n// webpack.config.js\nmodule.exports = {\n  //...\n  resolve: {\n    alias: {\n      '@ecomplus/i18n$': `@ecomplus/i18n/src/${lang}/`\n    }\n  }\n}\n```\n\n**By this way you'll import only strings instead of objects**:\n\n```js\nimport { i19hello, i19visitor } from '@ecomplus/i18n'\nconsole.log(`${i19hello} ${i19visitor}`)\n// Hello Visitor\n```\n\nYou can still use [`ecomUtils.i18n`](https://developers.e-com.plus/ecomplus-utils/ecomUtils.html#.i18n) the same way:\n\n```js\nimport { i18n } from '@ecomplus/utils'\nimport { i19hello, i19visitor } from '@ecomplus/i18n'\nconsole.log(`${i18n(i19hello)} ${i18n(i19visitor)}`)\n// Hello Visitor\n```\n\n## Conventions\n\n1. String values always with **uppercased first letter** (eg.: `'Hello'`);\n2. Variable (`const`) names always in English;\n3. **Prefix `i19`** for all variable names;\n4. String variables must be _camelCased_ (eg.: `i19helloWorld`);\n5. Object (enums) variables must be _PascalCased_ (eg.: `i19OrderStatus`);\n6. **All language options must have same variables**;\n7. For long messages: variable name should be suffixed with `Msg`;\n8. For questions: variable name should be suffixed with `Qn`;\n\n### Code style\n\n9. Exported constants must be alphabetically ordered;\n10. Additional line break before objects (not for strings);\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecomplus%2Fi18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fecomplus%2Fi18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecomplus%2Fi18n/lists"}