{"id":22123509,"url":"https://github.com/proai/babel-plugin-intlized-components","last_synced_at":"2025-03-24T07:29:32.877Z","repository":{"id":94889149,"uuid":"121294028","full_name":"ProAI/babel-plugin-intlized-components","owner":"ProAI","description":":earth_americas: Babel plugin for intlized-components","archived":false,"fork":false,"pushed_at":"2022-02-19T20:17:58.000Z","size":130,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T13:08:58.225Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ProAI.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-12T19:51:15.000Z","updated_at":"2022-02-15T09:01:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"ab27367e-6518-49ba-9f53-5509b8ee6b32","html_url":"https://github.com/ProAI/babel-plugin-intlized-components","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProAI%2Fbabel-plugin-intlized-components","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProAI%2Fbabel-plugin-intlized-components/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProAI%2Fbabel-plugin-intlized-components/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProAI%2Fbabel-plugin-intlized-components/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ProAI","download_url":"https://codeload.github.com/ProAI/babel-plugin-intlized-components/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245227046,"owners_count":20580795,"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":[],"created_at":"2024-12-01T15:34:05.749Z","updated_at":"2025-03-24T07:29:32.844Z","avatar_url":"https://github.com/ProAI.png","language":"JavaScript","readme":"# 🌎 babel-plugin-intlized-components\n\nBabel plugin for package [intlized-components](https://github.com/ProAI/intlized-components). The primary use case for this plugin is to extract message ids and default messages from all files of a project.\n\n## Installation\n\n```shell\nnpm install babel-plugin-intlized-components\n# or\nyarn add babel-plugin-intlized-components\n```\n\n## Usage\n\nAdd the plugin to your babel configuration:\n\n```json\n{\n  \"plugins\": [\"babel-plugin-styled-components\"]\n}\n```\n\n### Message extraction\n\n```javascript\nimport babel from '@babel/core';\n\n// Define fileName and babelConfig variables here.\n\nconst { metadata: result } = babel.transformFileSync(fileName, babelConfig);\nconst { translations } = result['intlized-components'];\n\n// Do something with the translations, e.g. save them in file.\n```\n\n## Docs\n\n### Options\n\n#### `customImportKey`\n\nIf you don't import `createDict` from `intlized-components` directly, you can set a custom import key in the babel plugin, so that `createDict` is detected anyway.\n\nExample:\n\nIn babel configuration:\n\n```json\n{\n  \"plugins\": [\n    [\n      \"babel-plugin-styled-components\",\n      { \"customImportKey\": \"my-custom-import\" }\n    ]\n  ]\n}\n```\n\nIn a file:\n\n```javascript\nimport { createDict } from 'my-custom-import';\n\nconst dict = createDict(...);\n```\n\n#### `ignoreImport`\n\nIf this option is set to `true`, imports will not be verified. This means that all functions named `createDict` will be transformed no matter what the import is. While this option might be helpful in some cases, you need to be careful as you should not name other functions `createDict`.\n\n#### `autoResolveKey`\n\nNormally you have to set a key as the first parameter and a message object as the second parameter for `createDict`. If you set this option to the base path of your application, the babel plugin will derive the first parameter from the file name, so that you can call `createDict` with a message object only.\n\nExample:\n\nWithout `autoResolveKey` option:\n\n```javascript\nconst dict = createDict('welcome.Welcome', {\n  hello: 'Hello',\n});\n```\n\nWith `autoResolveKey` option:\n\nIn babel configuration:\n\n```json\n{\n  \"plugins\": [\n    [\"babel-plugin-styled-components\", { \"autoResolveKey\": \"path-to-my-app\" }]\n  ]\n}\n```\n\nIn file `welcome/Welcome.js`:\n\n```javascript\n// Babel will transform createDict and will add the key \"welcome.Welcome\" as first parameter to the function call.\nconst dict = createDict({\n  hello: 'Hello',\n});\n```\n\n_Hint: You can even set a key manually if this option is on, so you can mix up auto resolved and manually set keys._\n\n## License\n\nThis package is released under the [MIT License](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproai%2Fbabel-plugin-intlized-components","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproai%2Fbabel-plugin-intlized-components","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproai%2Fbabel-plugin-intlized-components/lists"}