Hacker News new | ask | show | jobs
by Diti 4 days ago
Not sure about HTML, but you can use `<switch>` [1] in SVG and it will display localized text based on the `system’anguage` property.

[1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/E...

1 comments

Switch has some gnarly options with it, and I do want to find an excuse to use it in my 'SVG embroidery sampler'.

Flags are a possibility, although I only have the UK flag in my SVG sprite sheet thus far.

I will have to see if I can build a usefully stylish locale switcher that gets it right the first time due to browser locale, yet is changeable, with option stored in local storage, all inside the SVG Shadow DOM...