feat: opt-in locale formatting, setValue, GitHub Pages demo site#1
Merged
Conversation
- 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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What / 무엇
Opt-in locale formatting —
locale: 'auto' | 'de-DE' | …option anddata-numkey-localeattribute derive the group separator and decimal mark fromIntl.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. Explicitseparator/decimalPointwin 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.jsonhomepage → Pages URL.README — en↔ko 언어 스위처 링크, scoped 패키지 뱃지 URL 인코딩 수정 (
%40devslab%2Fnumkey— raw@devslab/numkey는 shields.io에서 깨짐), locale/setValue 문서.Verification / 검증
1,234,567.89→1.234.567,89, canonical"1234567.89"유지, 원복 정상; 소수 자릿수 초과 입력 거부; 서버 렌더링 값 자동 포맷 확인