메시지 값: 평문 문자열('{name}' 보간) 또는 함수(복수형·조사 등 "문법이 데이터인" 케이스의 탈출구).
왜 함수까지 허용하나: "사과 1개/사과 2개"처럼 복수형 규칙이 언어마다 다른데, ICU/CLDR 같은
범용 복수형 엔진을 넣으면 zero-dependency 원칙이 깨진다. 그래서 그 규칙 자체를 로케일 파일
안의 함수로 옮겨, 각 언어가 자기 문법을 직접 결정하게 한다.
/ A message value: a plain string ('{name}' interpolation) or a function (escape hatch for
plurals/particles where "grammar is data"). Why allow a function at all: plural rules differ
per language, and pulling in a general ICU/CLDR plural engine would break the
zero-dependency principle — so the rule itself moves into a function inside the locale file,
letting each language own its own grammar.
Example
constcountBadge: MessageValue = (p) =>`${p.n}건`; // 한국어는 복수형이 없음 / Korean has no plural form
메시지 값: 평문 문자열('{name}' 보간) 또는 함수(복수형·조사 등 "문법이 데이터인" 케이스의 탈출구). 왜 함수까지 허용하나: "사과 1개/사과 2개"처럼 복수형 규칙이 언어마다 다른데, ICU/CLDR 같은 범용 복수형 엔진을 넣으면 zero-dependency 원칙이 깨진다. 그래서 그 규칙 자체를 로케일 파일 안의 함수로 옮겨, 각 언어가 자기 문법을 직접 결정하게 한다. / A message value: a plain string ('{name}' interpolation) or a function (escape hatch for plurals/particles where "grammar is data"). Why allow a function at all: plural rules differ per language, and pulling in a general ICU/CLDR plural engine would break the zero-dependency principle — so the rule itself moves into a function inside the locale file, letting each language own its own grammar.