Skip to content

Localization

Every string the canvas reads out or labels itself with comes from one BlowAriaLabels object, and the control bar and the minimap take theirs as parameters, so a flow can be translated without reimplementing its accessibility. Switch language and use the flow from the keyboard: the panel shows what a screen reader hears.

next
Start
Review
Publish
Arrow keys move the view, Home shows the whole flow.
Announced
-
bit Blow

Try it

  • Pick English, Deutsch or فارسی. Persian also lays the text in the flow out right to left.
  • Click the background, Tab to a node and press Enter: the panel shows the selection announced in that language. Move the node with the arrow keys and the move is announced too.
  • On Start, press C to start a connection, then Tab on: on Review you hear why it cannot connect - the two are already joined - and on Publish that Enter would connect. Press Enter there.
  • Tab to the edge and press C to pick up its end, Tab to another node and press Enter to move it there.
  • Select something and press Delete: the deletion is announced with its counts.
  • Hover the control bar's buttons for their translated tooltips, and press the lock button: dragging, connecting and selecting stop, and its tooltip offers to unlock.
  • With a screen reader on, each node is also read with its translated role ("Knoten"), its state ("Nicht verbunden.") and the keys it answers to; the minimap and the control bar are read by their translated names.

How it works

  • AriaLabels takes a BlowAriaLabels: role descriptions, names, states, every announcement and the keyboard instructions. A member left out keeps its English default (BlowAriaLabels.Default). The page builds a new set when the language changes rather than on every render, since the canvas redraws every node and edge whenever it is handed a different set.
  • The members are functions rather than format strings - NodeSelected = name => $"{name} ausgewählt" - so a translation can reorder or drop the values it is handed.
  • The panel sees what the live region gets because Record wraps each announcement function to copy its result there. SelectionCleared and the two "cancelled" messages are plain strings, so they reach the live region without passing through the panel.
  • The canvas's own AriaLabel is the app's to translate, and attributes it does not set itself - aria-roledescription, dir - pass straight through to its element.
  • BlowControls takes AriaLabel, ZoomInLabel, ZoomOutLabel, FitViewLabel, LockLabel and UnlockLabel. The lock button shows with ShowInteractive, and @bind-Interactive drives NodesDraggable, NodesConnectable and ElementsSelectable.
  • BlowMiniMap takes AriaLabel, RoleDescription and KeyboardInstructions; left null, the instructions describe its keys in English.
  • DefaultViewport sets the pan and zoom the flow opens at, where other examples fit the graph instead.
An unhandled error has occurred. Reload 🗙