Search code examples
htmltextinputsubmitlang

How to specify the language of an input button using lang?


I get a Swedish "send"-button on a site build in English on my Swedish Win7. My English users won't probably even notice that once it's uploaded but Santa Clause knows it and keeps a list of when I've been bad. So I went and added "lang" attribute as follows.

<input id="submit" type="submit" lang="en" />

And guess what, it still shows in Swedish. Why?! And how to force the desired text?

Should I explicitly specify the string to be displayed? I'd prefer to set the text given the current (or by me specified) language.


Solution

  • As @Chris explains, the lang attribute is declarative: it tells what language the content and the attributes of an element are, instead of translating anything.

    You can, and generally should, set the text to be displayed in a submit button using the value attribute, e.g. <input id="submit" type="submit" value="Send" />.