- Intl.PluralRules
- Intl.RelativeTimeFormat
- Intl.Segmenter
- locale data
Intl APIs provide locale-sensitive number, date, plural, relative-time, and text- segmentation behavior. Segmenting words by spaces fails for some writing systems; use Intl.Segmenter when supported and provide a deliberate fallback. Formatting is not translation: translated content is still needed.
String length and space splitting do not reliably count user-perceived characters or words across languages.
Format a relative time and segment a Japanese sentence into words; show a fallback message if Segmenter is unavailable.
Open example.html, inspect example.js, then edit and refresh. For APIs that need an origin, run a local server from the JavaScripts folder.
- Explain the behavior and its limits in your own words.
- Test a normal case and a failure or cleanup case.
- Record when this feature is useful and when a simpler approach is better.