I was asked to do the Internalization of an app. So I did my research and found i8next which basically answers my needs.

"i18next is a full-featured i18n javascript library for translating your webapplication. runs in browser, under node.js, rhino and other javascript runtimes." i18next.com

And then I remember that you have an option in html, the lang attribute, to set the language of html.

What's the difference? Was I correct or that I used 18next or the attrbute lang can solve my problem easily?

有帮助吗?

解决方案

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. 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. 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; you just need to find the standardized language code for the content language.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top