{"id":20060674,"url":"https://github.com/ficusjs/ficusjs-i18n","last_synced_at":"2026-03-27T04:45:47.244Z","repository":{"id":63551175,"uuid":"430463561","full_name":"ficusjs/ficusjs-i18n","owner":"ficusjs","description":"Functions for managing translations and localization in FicusJS components","archived":false,"fork":false,"pushed_at":"2023-10-23T04:23:10.000Z","size":1113,"stargazers_count":1,"open_issues_count":8,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-12T22:14:45.542Z","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/ficusjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"ficusjs"}},"created_at":"2021-11-21T19:42:37.000Z","updated_at":"2023-08-01T01:52:52.000Z","dependencies_parsed_at":"2025-01-12T22:14:14.370Z","dependency_job_id":"a5a82bf4-2c48-4e20-a04c-d03795b78efb","html_url":"https://github.com/ficusjs/ficusjs-i18n","commit_stats":{"total_commits":22,"total_committers":3,"mean_commits":7.333333333333333,"dds":"0.13636363636363635","last_synced_commit":"2ab0fd2c0c4a54610fc9bc0665d384e20c89436d"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ficusjs%2Fficusjs-i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ficusjs%2Fficusjs-i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ficusjs%2Fficusjs-i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ficusjs%2Fficusjs-i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ficusjs","download_url":"https://codeload.github.com/ficusjs/ficusjs-i18n/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241488201,"owners_count":19970829,"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-11-13T13:16:16.702Z","updated_at":"2026-03-27T04:45:47.191Z","avatar_url":"https://github.com/ficusjs.png","language":"JavaScript","funding_links":["https://github.com/sponsors/ficusjs"],"categories":[],"sub_categories":[],"readme":"# FicusJS internationalization (i18n)\n\nFunctions for managing translations and localization in FicusJS components.\n\nFor documentation visit [https://docs.ficusjs.org/i18n/](https://docs.ficusjs.org/i18n/)\n\n## Getting started\n\nFicusJS i18n can be used in any FicusJS component. It is recommended to use the `withI18n` or `withI18nReactive` functions to make translations available in the component.\n\n```js\nimport { createCustomElement, createI18n, withI18n } from 'https://cdn.skypack.dev/ficusjs@6'\nimport { html, renderer } from 'https://cdn.skypack.dev/@ficusjs/renderers@5/uhtml'\n\n// create the i18n instance\nconst i18n = createI18n()\n\n// change interpolation delimiters from {{}} to $\ni18n.interpolateWith(/\\$(\\w+)/g)\n\n// populate the messages\ni18n.add({\n  projectTitle: 'Project title',\n  button: {\n    text: 'Click me $userName!',\n    caption: 'Please click me!'\n  },\n  itemsCaption: [\n    '$count item',\n    '$count items'\n  ],\n  deep: {\n    nested: {\n      label: 'Deep nested label'\n    }\n  }\n})\n\n// Use the i18n instance in a new component\ncreateCustomElement(\n  'i18n-messages',\n  withI18n(i18n, {\n    renderer,\n    render () {\n      return html`\n        \u003ch1\u003ei18n messages\u003c/h1\u003e\n        \u003cdl\u003e\n          \u003cdt\u003eTitle\u003c/dt\u003e\n          \u003cdd\u003e${this.i18n.t('projectTitle')}\u003c/dd\u003e\n          \u003cdt\u003eButton text\u003c/dt\u003e\n          \u003cdd\u003e${this.i18n.t('button.text', { userName: 'George' })}\u003c/dd\u003e\n          \u003cdt\u003eButton caption\u003c/dt\u003e\n          \u003cdd\u003e${this.i18n.t('button.caption')}\u003c/dd\u003e\n          \u003cdt\u003eItems caption\u003c/dt\u003e\n          \u003cdd\u003e${this.i18n.t('itemsCaption', { count: 0 })}\u003c/dd\u003e\n          \u003cdd\u003e${this.i18n.t('itemsCaption', { count: 1 })}\u003c/dd\u003e\n          \u003cdd\u003e${this.i18n.t('itemsCaption', { count: 2 })}\u003c/dd\u003e\n          \u003cdt\u003eDeep nested label\u003c/dt\u003e\n          \u003cdd\u003e${this.i18n.t('deep.nested.label')}\u003c/dd\u003e\n        \u003c/dl\u003e\n      `\n    }\n  })\n)\n```\n\n## Installation\n\nFicusJS i18n is a core part of [FicusJS](https://docs.ficusjs.org) but can also be installed independently in a number of ways.\n\n### CDN\n\nWe recommend using native ES modules in the browser.\n\n```html\n\u003cscript type=\"module\"\u003e\n  import { createI18n, getI18n, withI18n, withI18nReactive } from 'https://cdn.skypack.dev/@ficusjs/i18n'\n\u003c/script\u003e\n```\n\nFicusJS i18n is available on [Skypack](https://www.skypack.dev/view/@ficusjs/i18n).\n\n### NPM\n\nFicusJS i18n work nicely with build tools such as Snowpack, Webpack or Rollup. If you are using a NodeJS tool, you can install the NPM package.\n\n```bash\nnpm install @ficusjs/i18n\n```\n\n### Available builds\n\nFicusJS i18n only provides ES module builds. For legacy browsers or alternative modules such as CommonJS, it is recommended to use a build tool to transpile the code.\n\n## Development\n\nHow to set-up FicusJS i18n for local development.\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/ficusjs/ficusjs-i18n.git\n```\n\n2. Change the working directory\n\n```bash\ncd ficusjs-i18n\n```\n\n3. Install dependencies\n\n```bash\nnpm install\n```\n\n4. Run the local development server\n\n```bash\nnpm run dev\n```\n\nThat's it! Now open http://localhost:8080 to see a local app.\n\n## License\n\nThis project is licensed under the MIT License - see the [`LICENSE`](LICENSE) file for details.\n\n## Contributing to FicusJS i18n\n\nAny kind of positive contribution is welcome! Please help us to grow by contributing to the project.\n\nIf you wish to contribute, you can work on any features you think would enhance the library. After adding your code, please send us a Pull Request.\n\n\u003e Please read [CONTRIBUTING](CONTRIBUTING.md) for details on our [CODE OF CONDUCT](CODE_OF_CONDUCT.md), and the process for submitting pull requests to us.\n\n## Support\n\nWe all need support and motivation. FicusJS is not an exception. Please give this project a ⭐️ to encourage and show that you liked it. Don't forget to leave a star ⭐️ before you move away.\n\nIf you found the library helpful, please consider [sponsoring us](https://github.com/sponsors/ficusjs).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fficusjs%2Fficusjs-i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fficusjs%2Fficusjs-i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fficusjs%2Fficusjs-i18n/lists"}