Skip to content

Commit 24be8fe

Browse files
committed
rename: auto-dom-i18n → auto-html-i18n (npm + composer + namespace)
1 parent df6b2e1 commit 24be8fe

28 files changed

Lines changed: 67 additions & 67 deletions

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
66

77
This is a monorepo with one library implemented across multiple runtimes:
88

9-
- [packages/js](packages/js/) — TypeScript browser library (the original `auto-dom-i18n` npm package)
9+
- [packages/js](packages/js/) — TypeScript browser library (the original `auto-html-i18n` npm package)
1010
- [packages/php](packages/php/) — PHP 8.1+ server-side library
1111
- [fixtures/](fixtures/) — shared JSON test cases (Masker behavior parity across ports)
1212

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# auto-dom-i18n
1+
# auto-html-i18n
22

33
Automatic translation of rendered markup. Walks HTML, extracts translatable text, masks variables (numbers, dates, ignored words, inline tags), looks up translations in a cache, and falls back to a user-supplied backend for misses. ICU MessageFormat is supported throughout.
44

@@ -8,8 +8,8 @@ This repository hosts implementations for multiple runtimes. Both ports share th
88

99
| Package | Runtime | Use it for | Path |
1010
|---|---|---|---|
11-
| `auto-dom-i18n` (npm) | Browser / DOM | Live translation of rendered pages via `MutationObserver` | [packages/js](packages/js/) |
12-
| `auto-dom-i18n` (Composer) | PHP 8.1+ | Server-side: HTML string in, translated HTML string out | [packages/php](packages/php/) |
11+
| `auto-html-i18n` (npm) | Browser / DOM | Live translation of rendered pages via `MutationObserver` | [packages/js](packages/js/) |
12+
| `auto-html-i18n` (Composer) | PHP 8.1+ | Server-side: HTML string in, translated HTML string out | [packages/php](packages/php/) |
1313

1414
## Repo layout
1515

packages/js/README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# auto-dom-i18n
1+
# auto-html-i18n
22

3-
[![NPM Version](https://img.shields.io/npm/v/auto-dom-i18n)](https://www.npmjs.com/package/auto-dom-i18n)
4-
[![Build Status](https://img.shields.io/github/actions/workflow/status/gabepri/auto-dom-i18n/main.yml)](https://github.com/gabepri/auto-dom-i18n/actions)
5-
[![License](https://img.shields.io/github/license/gabepri/auto-dom-i18n)](https://github.com/gabepri/auto-dom-i18n/blob/main/LICENSE)
3+
[![NPM Version](https://img.shields.io/npm/v/auto-html-i18n)](https://www.npmjs.com/package/auto-html-i18n)
4+
[![Build Status](https://img.shields.io/github/actions/workflow/status/gabepri/auto-html-i18n/main.yml)](https://github.com/gabepri/auto-html-i18n/actions)
5+
[![License](https://img.shields.io/github/license/gabepri/auto-html-i18n)](https://github.com/gabepri/auto-html-i18n/blob/main/LICENSE)
66

7-
**auto-dom-i18n** is a framework-agnostic translation library that uses `MutationObserver` to automatically translate text content in your application, with built-in ICU MessageFormat support for advanced pluralization and gender handling.
7+
**auto-html-i18n** is a framework-agnostic translation library that uses `MutationObserver` to automatically translate text content in your application, with built-in ICU MessageFormat support for advanced pluralization and gender handling.
88

99
It features **Smart Masking**, **Inline Tag Support**, and **ICU MessageFormat** evaluation. Unlike traditional libraries that map static keys to strings, this library observes the DOM and detects natural language automatically—no manual key mapping or framework bindings required.
1010

@@ -43,19 +43,19 @@ It features **Smart Masking**, **Inline Tag Support**, and **ICU MessageFormat**
4343
## 📦 Installation
4444

4545
```bash
46-
npm install auto-dom-i18n
46+
npm install auto-html-i18n
4747
# or
48-
yarn add auto-dom-i18n
48+
yarn add auto-html-i18n
4949
# or
50-
pnpm add auto-dom-i18n
50+
pnpm add auto-html-i18n
5151
```
5252

5353
## 🚀 Quick Start
5454

5555
Initialize the library at the root of your application.
5656

5757
```javascript
58-
import { I18nObserver } from 'auto-dom-i18n';
58+
import { I18nObserver } from 'auto-html-i18n';
5959

6060
// 1. Define your configuration
6161
const i18n = new I18nObserver({
@@ -131,7 +131,7 @@ Each variable includes its auto-detected type (`'ignoreWord'`, `'number'`, `'dat
131131

132132
## 📡 Backend Requirements
133133

134-
Since `auto-dom-i18n` is client-side only, you must provide a backend endpoint to perform the actual translation (e.g., database lookup, translation API, and/or an LLM).
134+
Since `auto-html-i18n` is client-side only, you must provide a backend endpoint to perform the actual translation (e.g., database lookup, translation API, and/or an LLM).
135135

136136
### Request Format
137137
Here is an example of how you might structure the POST body in your callback:
@@ -527,7 +527,7 @@ const i18n = new I18nObserver({
527527

528528
## 🌐 Browser Support
529529

530-
**auto-dom-i18n** relies on `MutationObserver`, which is supported in all modern browsers:
530+
**auto-html-i18n** relies on `MutationObserver`, which is supported in all modern browsers:
531531

532532
- Chrome 26+
533533
- Firefox 14+
@@ -621,7 +621,7 @@ You can immediately see the DOM structure and reconstruct it for a bug report.
621621

622622
## 🛠 Framework Integration
623623

624-
While **auto-dom-i18n** is framework-agnostic, here is how you typically initialize it:
624+
While **auto-html-i18n** is framework-agnostic, here is how you typically initialize it:
625625

626626
### How It Works with Frameworks
627627

@@ -658,8 +658,8 @@ We welcome contributions! This library is built with TypeScript and uses Vitest
658658
1. **Clone the repo**
659659

660660
```bash
661-
git clone https://github.com/gabepri/auto-dom-i18n.git
662-
cd auto-dom-i18n
661+
git clone https://github.com/gabepri/auto-html-i18n.git
662+
cd auto-html-i18n
663663
```
664664

665665
2. **Install dependencies**

packages/js/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/js/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
2-
"name": "auto-dom-i18n",
2+
"name": "auto-html-i18n",
33
"version": "0.3.1",
44
"description": "Framework-agnostic translation library using MutationObserver for automatic DOM translation with ICU MessageFormat support",
55
"type": "module",
6-
"main": "./dist/auto-dom-i18n.cjs",
7-
"module": "./dist/auto-dom-i18n.js",
6+
"main": "./dist/auto-html-i18n.cjs",
7+
"module": "./dist/auto-html-i18n.js",
88
"types": "./dist/index.d.ts",
99
"exports": {
1010
".": {
1111
"import": {
1212
"types": "./dist/index.d.ts",
13-
"default": "./dist/auto-dom-i18n.js"
13+
"default": "./dist/auto-html-i18n.js"
1414
},
1515
"require": {
1616
"types": "./dist/index.d.cts",
17-
"default": "./dist/auto-dom-i18n.cjs"
17+
"default": "./dist/auto-html-i18n.cjs"
1818
}
1919
}
2020
},
@@ -45,7 +45,7 @@
4545
"license": "MIT",
4646
"repository": {
4747
"type": "git",
48-
"url": "https://github.com/gabepri/auto-dom-i18n.git"
48+
"url": "https://github.com/gabepri/auto-html-i18n.git"
4949
},
5050
"devDependencies": {
5151
"@types/node": "^25.6.0",

packages/js/src/I18nObserver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export class I18nObserver {
227227
}
228228
}
229229
} catch (err) {
230-
console.error('auto-dom-i18n: translation callback error', err);
230+
console.error('auto-html-i18n: translation callback error', err);
231231
// Mark items as reported to prevent infinite re-queuing
232232
for (const item of items) {
233233
this.store.markReported(this.currentLocale, item.masked);

packages/js/src/Queue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class Queue {
3535
await this.onFlush(chunk);
3636
} catch {
3737
// Log but don't re-throw to prevent breaking the observation pipeline
38-
console.error('auto-dom-i18n: onFlush error');
38+
console.error('auto-html-i18n: onFlush error');
3939
}
4040
}
4141
}

packages/js/vite.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ export default defineConfig({
1212
build: {
1313
lib: {
1414
entry: resolve(__dirname, 'src/index.ts'),
15-
name: 'AutoDomI18n',
15+
name: 'AutoHtmlI18n',
1616
formats: ['es', 'cjs'],
1717
fileName: (format) => {
18-
if (format === 'es') return 'auto-dom-i18n.js';
19-
return 'auto-dom-i18n.cjs';
18+
if (format === 'es') return 'auto-html-i18n.js';
19+
return 'auto-html-i18n.cjs';
2020
},
2121
},
2222
sourcemap: true,

packages/php/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# auto-dom-i18n (PHP)
1+
# auto-html-i18n (PHP)
22

33
Server-side automatic translation for PHP-rendered HTML. Walks markup, masks dynamic values (numbers, dates, names, URLs, inline tags) into stable cache keys, looks them up in a translation cache, and falls back to a user-supplied backend for cache misses. Returns translated HTML in a single synchronous pass — no async bookkeeping, no client-side JS required.
44

@@ -7,16 +7,16 @@ This is the PHP sibling of [`packages/js`](../js). Both packages share the same
77
## Install
88

99
```bash
10-
composer require gabepri/auto-dom-i18n
10+
composer require gabepri/auto-html-i18n
1111
```
1212

1313
Requires PHP 8.1+, the `intl` and `mbstring` extensions.
1414

1515
## Quickstart
1616

1717
```php
18-
use AutoDomI18n\I18nTranslator;
19-
use AutoDomI18n\TranslationItem;
18+
use AutoHtmlI18n\I18nTranslator;
19+
use AutoHtmlI18n\TranslationItem;
2020

2121
$i18n = new I18nTranslator([
2222
'locale' => 'es',

packages/php/composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "gabepri/auto-dom-i18n",
2+
"name": "gabepri/auto-html-i18n",
33
"description": "Server-side automatic translation for PHP-rendered HTML. Walks markup, masks variables, and resolves translations via a user-supplied backend. ICU MessageFormat supported.",
44
"type": "library",
55
"license": "MIT",
@@ -18,12 +18,12 @@
1818
},
1919
"autoload": {
2020
"psr-4": {
21-
"AutoDomI18n\\": "src/"
21+
"AutoHtmlI18n\\": "src/"
2222
}
2323
},
2424
"autoload-dev": {
2525
"psr-4": {
26-
"AutoDomI18n\\Tests\\": "tests/"
26+
"AutoHtmlI18n\\Tests\\": "tests/"
2727
}
2828
},
2929
"config": {

0 commit comments

Comments
 (0)