2

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.

4

2 に答える 2

2

このlang属性は、テキストの翻訳を強制するためには使用されません。メタデータを提供するための一般的な属性です ( http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang )。

理論的には、ブラウザはこれをいくつかのコンテキストで使用して翻訳を行うことができますが、そうなるとは思いません。おそらく、送信ボタンの言語は、コンピューターまたはおそらくブラウザーにインストールされている言語またはそれに類似したものと関係があります。

あなたのサイトが一般的に多言語に対応している場合は、同じ翻訳コードを使用して明示的に翻訳することをお勧めします。多言語でない場合は、ブラウザ/ユーザーに心配させてください。

于 2012-07-30T10:00:02.533 に答える