简体   繁体   English

i18next和HTML的lang属性的区别?

[英]difference of i18next and lang attribute of HTML?

I was asked to do the Internalization of an app. 我被要求做一个应用程序的内部化。 So I did my research and found i8next which basically answers my needs. 因此,我进行了研究,发现i8next基本上可以满足我的需求。

" i18next is a full-featured i18n javascript library for translating your webapplication. runs in browser, under node.js, rhino and other javascript runtimes." i18next是用于翻译您的Web应用程序的功能齐全的i18n javascript库。它在浏览器中的node.js,rhino和其他javascript运行时下运行。” i18next.com i18next.com

And then I remember that you have an option in html, the lang attribute, to set the language of html. 然后我记得您在html属性中有一个lang属性,可以设置html语言。

What's the difference? 有什么不同? Was I correct or that I used 18next or the attrbute lang can solve my problem easily? 我是对的还是使用18next或attrbute lang可以轻松解决我的问题?

They have nothing in common, beyond being things associated with (human) languages. 除了与(人类)语言相关的事物外,它们没有共同之处。

i18next is, as the quote says, a library for translating things or, rather, setting things up so that you can generate translated content using translated pieces of text. 正如引文所说, i18next是一个用于翻译事物或进行设置的库,以便您可以使用翻译后的文本生成翻译后的内容。 It is surely meant to address needs like internationalizing an app; 它肯定是为了解决诸如将应用程序国际化的需求; whether it is a good tool, or the best tool, for that is a different issue. 无论是好的工具还是最好的工具,这都是另外一个问题。

The lang attribute is declarative: it tells what the language of the content is. lang属性是声明性的:它告诉内容的语言是什么。 It is ignored by search engines, as far as we know, and mostly ignored by browsers, too, but may affect a few things, like automatic hyphenation if it takes place. 据我们所知,它被搜索引擎所忽略,并且也被浏览器所忽略,但是可能会影响一些事情,例如自动连字(如果发生)。 It is generally advisable, and advised by the W3C, to use the lang attribute, and it is very simple to do that for an HTML document as a whole; 通常建议使用W3C并由W3C建议使用lang属性,对于整个HTML文档来说,这样做非常简单; you just need to find the standardized language code for the content language. 您只需要找到内容语言的标准语言代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM