@@ -294,18 +294,29 @@ The `<html>` opening tag becomes `<html lang="{{locale}}">`.
294294
295295## Navigation — Language Selector
296296
297- A ` <select> ` dropdown in the nav bar lets users switch locales.
298- The list of locales is rendered at build time from ` locales.properties ` :
297+ A globe icon button (🌐) is placed in the nav bar immediately next to the
298+ dark/light theme toggle button. Clicking it opens a dropdown list of available
299+ locales. The list is rendered at build time from ` locales.properties ` .
299300
300301``` html
301- <select id =" localePicker" aria-label =" Select language" >
302- <option value =" en" >English</option >
303- <option value =" pt-BR" selected >Português (Brasil)</option >
304- </select >
302+ <!-- inside .nav-right, adjacent to the existing theme-toggle button -->
303+ <div class =" locale-picker" id =" localePicker" >
304+ <button class =" locale-toggle" aria-haspopup =" listbox" aria-expanded =" false"
305+ aria-label =" Select language" >🌐</button >
306+ <ul role =" listbox" aria-label =" Language" >
307+ <li role =" option" data-locale =" en" aria-selected =" true" >English</li >
308+ <li role =" option" data-locale =" pt-BR" aria-selected =" false" >Português (Brasil)</li >
309+ </ul >
310+ </div >
305311```
306312
307- ` app.js ` rewrites the current URL path to the equivalent page in the selected
308- locale when the user changes the selection.
313+ When the user selects a locale, ` app.js ` rewrites the current URL path to the
314+ equivalent page for that locale and persists the choice to ` localStorage ` so
315+ subsequent page loads open in the correct language automatically.
316+
317+ The dropdown is hidden by default and toggled via the ` .locale-toggle ` button.
318+ Clicking outside the dropdown or pressing ` Escape ` closes it. The currently
319+ active locale's ` <li> ` receives ` aria-selected="true" ` and a visual highlight.
309320
310321---
311322
0 commit comments