and @localizer/format 1.1.1
The and
formats a list of elements by joining them with the word "and," creating a natural and readable output. It is particularly useful for generating human-friendly text from arrays of localized strings or other elements.
Usage
typescript
import { loc } from '@localizer/core';
import { and } from '@localizer/format';
const values = [loc`A`, loc`B`, loc`C`, loc`D`];
const result = and(values);
Demo
Locale | Localized value |
---|---|
en-US | A, B, C, and D |
fr-FR | A, B, C et D |
de-DE | A, B, C und D |
fi-FI | A, B, C ja D |
sv-FI | A, B, C och D |
ko-KR | A, B, C 및 D |
hi-IN | A, B, C, और D |