focus-readerv0.5.0

Docs · 06

Labels and languages

Every word the panel shows or says can be changed, and it reads in the language of the page.

Labels

The panel’s words are in English by default. The labels attribute changes them, as JSON, and only the ones given change:

<focus-reader
  for="article-body"
  lang="fr"
  labels='{"play": "Lire", "reading": "Lecture", "wordsPerFrame": ["{n} mot par cadre", "{n} mots par cadre"]}'
></focus-reader>

The labels property does the same from a script, over the attribute; null goes back to the attribute’s.

reader.labels = { play: 'Lire', reading: 'Lecture' };

Two things to know about the values:

  • a mark like {wpm} or {n} is filled in with a value;
  • a pair is [one, other], picked by the plural rules of the reader’s language.

Labels include what a screen reader hears: the name of each control, and what is said on play, pause and each change of setting. A reader translated only where it shows is half translated.

With Astro, the integration’s labels option sets them for the whole site. Two of them are the component’s own: open, the text of its button, and noScript, the line a reader in the page shows without JavaScript.

Languages

A reader reads in the language of its lang, or of the nearest lang above it, else English. The language decides three things:

  • how numbers are written (the rate, the words read);
  • which of a pair of labels is used, by its plural rules;
  • how a text written without spaces is cut into words.

Words are cut at spaces. A run in a script written without them (Chinese, Japanese, Thai, Lao, Khmer, Burmese) is cut by Intl.Segmenter for that language, its punctuation kept with the word before it and an opening bracket or quote with the word after.

<focus-reader lang="ja">
  <template>
    <p>吾輩は猫である。名前はまだ無い。</p>
  </template>
</focus-reader>

Every label

The 80 keys and their English defaults, read from LABELS when this page is built.

KeyDefault
nameFocus reader
settingsSettings
viewView
sequenceSequence
flowFlow
speedSpeed
slowerSlower
fasterFaster
wordsWords
fewerWordsFewer words per frame
moreWordsMore words per frame
sizeSize
smallerSmaller text
largerLarger text
alignAlign
alignLeftLeft
alignCenterCentre
alignPivotPivot
underlineUnderline
underlineLabelUnderline the words being read
highlightHighlight
highlightLabelDim the words read and the words ahead
onOn
offOff
bandReading band. Space to play or pause, left and right arrows to move by frame, up and down arrows for speed, scroll to move by frame.
flowAreaReading flow. Space to play or pause, left and right arrows to move by frame, up and down arrows for speed.
rateRate
wpmwpm
readRead
remainingLeft
minutesmin
hoursh
progressProgress
progressLabelKeep the figures and the progress bar while it plays
positionPosition in the text
positionValueWord {word} of {total}, {left} {unit} left
playPlay
readingReading
againRead again
keySpaceSpace
keyPlayplay
keyArrows← →
keyFrameframe
keyScrollScroll
keyScrollSequenceframe
keyScrollFlowtext
keyUpDown↑ ↓
keySpeedspeed
keyEscapeEsc
keyCloseclose
touchKeysTap to play or pause, swipe for a word
barsHintSwipe up to hide the browser bars
fullScreenFull screen
fullScreenLabelOpen the reader full screen
closeClose
closeLabelClose the reader
startKeysPress Space or click the band to start.
startTouchTap the band to start.
playingPlaying at {wpm} words per minute
pausedPaused, word {word} of {total}
endEnd of the text
wpmSaid{wpm} words per minute
wordsPerFrame{n} word per frame
{n} words per frame
wordsAtATime{n} word at a time
{n} words at a time
paragraphA paragraph at a time
sizeSaidSize {size}
viewSaid{view} view
viewLabelView: {view}. Change
alignSaidAligned {align}
alignLabelAlignment: {align}. Change
underlineOnUnderline on
underlineOffUnderline off
highlightOnHighlight on
highlightOffHighlight off, the whole text in ink
progressOnProgress shown while it plays
progressOffProgress hidden while it plays
settingsOnSettings shown
settingsOffSettings hidden
openFocus reader
noScriptThe focus reader needs JavaScript.

This page as MarkdownEdit this page on GitHub ↗