{"id":28829632,"url":"https://github.com/glyph-cat/langutil","last_synced_at":"2026-05-18T15:38:32.501Z","repository":{"id":39710964,"uuid":"156201350","full_name":"glyph-cat/langutil","owner":"glyph-cat","description":"Localization for JavaScript made simple. ","archived":false,"fork":false,"pushed_at":"2023-01-09T15:22:01.000Z","size":12958,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-19T05:15:49.596Z","etag":null,"topics":["accessibility","auto-language-detection","javascript","language","localization","translation"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/glyph-cat.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},"funding":{"ko_fi":"glyphcat"}},"created_at":"2018-11-05T10:41:17.000Z","updated_at":"2021-12-28T10:59:26.000Z","dependencies_parsed_at":"2023-02-08T12:31:44.292Z","dependency_job_id":null,"html_url":"https://github.com/glyph-cat/langutil","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/glyph-cat/langutil","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glyph-cat%2Flangutil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glyph-cat%2Flangutil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glyph-cat%2Flangutil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glyph-cat%2Flangutil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glyph-cat","download_url":"https://codeload.github.com/glyph-cat/langutil/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glyph-cat%2Flangutil/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264777820,"owners_count":23662555,"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":["accessibility","auto-language-detection","javascript","language","localization","translation"],"created_at":"2025-06-19T05:14:23.529Z","updated_at":"2026-05-18T15:38:27.459Z","avatar_url":"https://github.com/glyph-cat.png","language":"TypeScript","funding_links":["https://ko-fi.com/glyphcat"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n[![Langutil](https://raw.githubusercontent.com/glyph-cat/langutil/main/assets/langutil-wording.svg)](https://github.com/glyph-cat/langutil)\n\n[![Version](https://img.shields.io/npm/v/langutil.svg)](https://github.com/glyph-cat/langutil/releases)\n![Build Status](https://img.shields.io/github/workflow/status/glyph-cat/langutil/Test/main)\n![Bundle size](https://img.shields.io/bundlephobia/min/langutil)\n![Downloads](https://img.shields.io/npm/dt/langutil)\n[![License](https://img.shields.io/github/license/glyph-cat/langutil)](https://github.com/glyph-cat/langutil/blob/main/LICENSE)\n\n[![Works with React](https://img.shields.io/static/v1?label\u0026logo=react\u0026logoColor=61DBFB\u0026message=Works%20with%20React\u0026color=4a4a4a)](#using-with-react)\n\u003c!-- See: https://github.com/microsoft/vscode/issues/128813#issuecomment-943125631 --\u003e\n[![Open in Visual Studio Code](https://img.shields.io/static/v1?logo=visualstudiocode\u0026label=\u0026message=Open%20in%20Visual%20Studio%20Code\u0026labelColor=2c2c32\u0026color=007acc\u0026logoColor=007acc)](https://open.vscode.dev/glyph-cat/langutil)\n[![Support me on Ko-fi](https://img.shields.io/static/v1?label\u0026logo=kofi\u0026logoColor=ffffff\u0026message=Support%20me%20on%20Ko-fi\u0026color=FF5E5B)](https://ko-fi.com/glyphcat)\n\n\u003c/div\u003e\n\n\u003cbr/\u003e\n\nA localization utility for JavaScript that comes with support for React and React Native.\n\n\u003cbr/\u003e\n\n![Langutil Demo](https://raw.githubusercontent.com/glyph-cat/langutil/main/assets/langutil-demo.gif)\n\n\u003cbr/\u003e\n\n# Table of Contents\n\u003c!-- Automatically generated by VS Code --\u003e\n- [Table of Contents](#table-of-contents)\n- [Installation/Setup](#installationsetup)\n- [Basic Usage](#basic-usage)\n  - [Initialization](#initialization)\n  - [Set language](#set-language)\n  - [Get language](#get-language)\n  - [Get Localized Content](#get-localized-content)\n    - [Basic](#basic)\n    - [With Dynamic Values](#with-dynamic-values)\n    - [Alternative Syntax](#alternative-syntax)\n- [Further Reading](#further-reading)\n- [Support Me](#support-me)\n\n\u003cbr/\u003e\n\n# Installation/Setup\n\nWith [Yarn](https://yarnpkg.com/package/langutil) (Recommended)\n```sh\nyarn add langutil\n```\n\u003cbr/\u003e\n\nWith [NPM](https://www.npmjs.com/package/langutil)\n```sh\nnpm i langutil\n```\n\u003cbr/\u003e\n\nWith UNPKG:\n```html\n\u003cscript src=\"https://unpkg.com/langutil@\u003cVERSION\u003e/lib/umd/index.js\" crossorigin\u003e\u003c/script\u003e\n```\nNote: Replace `index.js` with `index.min.js` when deploying.\n\n\u003cbr/\u003e\n\n# Basic Usage\n\n## Initialization\n\n```js\nimport { LangutilCore } from 'langutil'\n\nconst dictionary = {\n  en: {\n    GOOD_MORNING: 'Good morning',\n    GOOD_MORNING_NAME: 'Good morning, {:name}.',\n    GOOD_MORNING_PNAME: 'Good morning, %p.',\n    GOOD_MORNING_NAME_AND_NAME: 'Good morning, {:name1} and {:name2}.',\n  },\n  id: {\n    GOOD_MORNING: 'Selamat pagi.',\n    GOOD_MORNING_NAME: 'Selamat pagi, {:name}.',\n    GOOD_MORNING_PNAME: 'Selamat pagi, %p.',\n    GOOD_MORNING_NAME_AND_NAME: 'Selamat pagi, {:name1} dan {:name2}.',\n  },\n}\n\nconst core = new LangutilCore(dictionary, 'en', { auto: true })\n```\n\n## Set language\n\n```js\n// With auto-detect\ncore.setLanguage('en', { auto: true })\n\n// Without auto-detect\ncore.setLanguage('en')\n```\n\n## Get language\n\n```js\ncore.getLanguage()\n// en\n```\n\n## Get Localized Content\n\n### Basic\n\n```js\ncore.localize('GOOD_MORNING')\n// Good morning.\n```\n\n### With Dynamic Values\n\n```js\n// By object (Recommended for strings with multiple placeholders)\ncore.localize('GOOD_MORNING_NAME_AND_NAME', {\n  name1: 'John',\n  name2: 'Jane',\n})\n//  Original: Good morning, {:name1} and {:name1}.\n// Localized: Good morning, John and Jane.\n\n// By array (Recommended for strings with only one placeholder)\ncore.localize('GOOD_MORNING_PNAME', ['John'])\n//  Original: Good morning, %p.\n// Localized: Good morning, John.\n```\n\n### Alternative Syntax\n\nInstead of spreading the parameters, you can pass an object like this:\n\n```js\nconst localizedValue = core.localize({\n  keyword: 'GOOD_MORNING_NAME_AND_NAME',\n  param: {\n    name1: 'John',\n    name2: 'Jane',\n  }\n})\n// Good morning, John and Jane.\n```\n\n\u003cbr/\u003e\n\n# Further Reading\n\n* [Documentations](https://github.com/glyph-cat/langutil/tree/main/docs)\n* [Migrating from v3 and below](https://github.com/glyph-cat/langutil/tree/main/docs/v3-migration.md)\n* Miscellaneous: Looking for a general-purpose state manager for React? Then you might be interested in [React Relink](https://github.com/glyph-cat/react-relink).\n\n\u003cbr/\u003e\n\n# Support Me\n\n* Ko-fi: [`ko-fi.com/glyphcat`](https://ko-fi.com/glyphcat)\n* BTC: [`bc1q5qp6a972l8m0k26ln9deuhup0nmldf86ndu5we`](bitcoin:bc1q5qp6a972l8m0k26ln9deuhup0nmldf86ndu5we)\n\n\u003cbr/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglyph-cat%2Flangutil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglyph-cat%2Flangutil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglyph-cat%2Flangutil/lists"}