Skip to content

Strings & i18n

Every word the list shows — and every label it gives a screen reader — comes from one table, so a site can translate it. Pass the ones you want to change; the rest stay English.

new WaveformSounds('#pack', {
manifest: '/previews/sounds.json',
strings: {
searchPlaceholder: 'Geluiden zoeken…',
count: '{count} geluiden',
countOne: '1 geluid',
countFiltered: '{count} van {total} geluiden',
},
});

As markup, data-strings takes the same object as JSON:

<div data-waveform-sounds data-manifest="/previews/sounds.json"
data-strings='{"count":"{count} geluiden","countOne":"1 geluid"}'></div>

Placeholders in braces are filled in: {title} (the sound’s title), {count} and {total} (and, in seekValue, {time} and {duration}; in the row read-out strings, {bpm}, {key}, {duration} and {note}). An unknown placeholder is left as written. The server renderer takes the same strings option, so server-rendered markup is translated too — pass the same object to the runtime.

The defaults are WaveformSounds.DEFAULT_STRINGS (also a named export of the main and /render entries).

Key Default Where
search Search sounds The search box’s accessible label.
searchPlaceholder Search sounds… The search box’s placeholder.
all All The first type chip.
types Type The type chips’ group label, and the Type menu’s label.
key Key The key menu’s label.
anyKey Any key The key menu’s “no filter” option.
allTypes All types The Type menu’s “no filter” option.
findType Find a type… The Type menu’s search field.
findKey Find a key… The key menu’s search field.
noMatches No matches A menu whose search matches nothing.
bpm BPM The BPM menu’s accessible name.
bpmMin Min BPM The lower handle’s label.
bpmMax Max BPM The upper handle’s label.
anyBpm Any BPM The BPM menu with no limit set, and its reset link.
bpmRange {min}–{max} BPM The BPM menu’s label and readout once a range is set.
sort Sort The sort menu’s accessible label.
sortBy Sort by The sort menu’s visible lead-in.
sortDefault Default Sort order default.
sortTitle Name Sort order title.
sortBpm BPM Sort order bpm.
sortKey Key Sort order key.
sortDuration Length Sort order duration.
loop Loop The Loop toggle.
loopFilter Loops or one-shots The Loops / One-shots control’s accessible name.
loops Loops Its Loops button.
oneShots One-shots Its One-shots button (the All button uses all).
isLoop Loop A loop’s icon tooltip, and the last part of a loop’s row read-out.
play Play {title} A row’s play button label.
pause Pause {title} A playing row’s button label.
seek Seek {title} The seek slider’s label (the current sound’s waveform — the only one that is a slider, 2.2.0+).
seekValue {time} of {duration} The seek slider’s spoken value (aria-valuetext, “0:12 of 0:30”). 2.1.0+.
download Download {title} A row’s download link label.
count {count} sounds The count.
countOne 1 sound The count, for a single sound.
countFiltered {count} of {total} sounds The count while a filter is on.
showMore Show {count} more The paging button.
empty No sounds match. Nothing passes the filter.
clear Clear filters The button beside it.
nowPlaying Playing {title} Announced (in a polite live region) when a sound starts.
playError Could not play {title} Announced when a sound fails to load or play (a 404, an undecodable file, a dropped connection). 2.1.0+.
loadError Could not load the sounds. Shown (role="alert") where the list would be when it can’t be built — the manifest 404s or isn’t a manifest. Fallback content you put in the container stays instead. 2.1.0+.
noSounds No sounds. An empty pack (nothing to filter, so no Clear button). 2.1.0+.
rowBpm {bpm} BPM A row’s BPM in its read-out. 2.2.0+.
rowKey key {key} A row’s key in its read-out; {key} is the spoken key (below). 2.2.0+.
rowDuration {duration} A row’s length in its read-out (0:07). 2.2.0+.
keyMajor {note} major A major key, spoken. 2.2.0+.
keyMinor {note} minor A minor key, spoken. 2.2.0+.
noteSharp {note} sharp A sharp root, spoken (F# → “F sharp”). 2.2.0+.
noteFlat {note} flat A flat root, spoken (Bb → “B flat”). 2.2.0+.
listSeparator , Between the parts of a row’s read-out. 2.2.0+.

2.2.0+. A screen reader hears a row as one sentence — its visible cells are aria-hidden, and a hidden .ws-sr span (which the play button is aria-describedby) reads the columns the row shows, in order, with the values it has:

Bass loops, 130 BPM, key B minor, 0:07, Loop

The type is said as written; the BPM is rowBpm; the key is rowKey around the key spoken in words — keyMajor / keyMinor around the root, the root’s sharp or flat through noteSharp / noteFlat (so F#m is “key F sharp minor”, not “F number m”); the length is rowDuration; a loop ends with isLoop; and the parts are joined with listSeparator. In noteSharp / noteFlat, {note} is the root’s letter (F); in keyMajor / keyMinor it’s the spoken root (“F sharp”).

The types, titles and tags come from your data, so they’re already in whatever language you wrote them in. Keys are shown in their short form (Fm, C#) and spoken through the strings above.