Skip to content

feat: opt-in locale formatting, setValue, GitHub Pages demo site#1

Merged
jlc488 merged 1 commit into
mainfrom
feature/locale-pages-metadata
Jul 17, 2026
Merged

feat: opt-in locale formatting, setValue, GitHub Pages demo site#1
jlc488 merged 1 commit into
mainfrom
feature/locale-pages-metadata

Conversation

@jlc488

@jlc488 jlc488 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What / 무엇

Opt-in locale formattinglocale: 'auto' | 'de-DE' | … option and data-numkey-locale attribute derive the group separator and decimal mark from Intl.NumberFormat.

Deliberately opt-in: by default the display stays deterministic (1,234,567.89) no matter the visitor's browser — business forms need the same rendering for every user, and server-side parsing must not depend on client locale. Explicit separator/decimalPoint win over the locale. Invalid tags and non-Intl environments fall back to the deterministic defaults.

옵트인 로케일 포맷팅 — 기본값은 방문자 브라우저와 무관하게 고정 표시 (업무 폼 요구사항), data-numkey-locale="auto" 또는 "de-DE" 지정 시에만 Intl에서 구분자 유도. 명시한 separator/decimalPoint가 우선.

setValue(el, canonical)getValue의 쓰기 대응. canonical을 el.value에 직접 넣으면 미포맷 표시가 되고, 비-. 소수점 하에서 재파싱하면 값이 깨지기 때문에 필요 (데모의 locale 스위처가 첫 소비자).

GitHub Pages 데모 사이트site/ 이중언어 데모 (라이브 인풋, 붙여넣기 정제, 로케일 스위처) + kokey 패턴의 pages.yml (main push마다 site/ + 신선한 dist 글로벌 배포). package.json homepage → Pages URL.

README — en↔ko 언어 스위처 링크, scoped 패키지 뱃지 URL 인코딩 수정 (%40devslab%2Fnumkey — raw @devslab/numkey는 shields.io에서 깨짐), locale/setValue 문서.

Verification / 검증

  • typecheck ✓ · 49 tests ✓ (8 new: de-DE/ko-KR derivation, override precedence, invalid-tag fallback, setValue round-trip across locale switch) · build ✓
  • Real-browser (demo page): default → de-DE 전환 시 1,234,567.891.234.567,89, canonical "1234567.89" 유지, 원복 정상; 소수 자릿수 초과 입력 거부; 서버 렌더링 값 자동 포맷 확인

- locale option ('auto' | BCP 47 tag) / data-numkey-locale: derives
  separator/decimalPoint via Intl.NumberFormat. Opt-in by design — the
  default display stays deterministic (','/'.') regardless of the visitor's
  browser, which business forms need; explicit separator/decimalPoint win
- setValue(el, canonical) — programmatic canonical writes, the counterpart
  of getValue (writing canonical straight to el.value would show it
  unformatted, and re-parsing under a non-. decimal mark corrupts it)
- site/: bilingual demo page (live inputs, paste sanitizing, locale
  switcher) + pages.yml deploying site/ + fresh dist global on main push
  (kokey pattern); package.json homepage → Pages URL
- README: en↔ko language switcher links, scoped-package badge URL encoding
  fix, locale/setValue docs
- tests: 49 (locale derivation de-DE/ko-KR, override precedence, invalid-tag
  fallback, setValue round-trip across a locale switch)
@jlc488
jlc488 merged commit 4226be3 into main Jul 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant