Reputation: 39298
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.
Upvotes: 3
Views: 5693
Reputation: 2148
You can customize the content by using the value
attribute.
see more: https://www.w3schools.com/tags/att_button_value.asp
Upvotes: 0
Reputation: 27627
The lang
attribute is not used to force translation of text. It is a general attribute to provide metadata (http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang).
In theory a browser could use this in some contexts to do translation but I don't think it ever does. More probably the language of your submit button is to do with the installed language of your computeror possibly browser or something similar like that.
If your site is generally multilingual then I would suggest using the same translation code to translate this explicitly. If it is not multilingual then just let the browser/user worry about it.
Upvotes: 2
Reputation: 201886
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" />
.
Upvotes: 4