简体   繁体   English

Node.js Web应用程序的国际化(i18n)/本地化

[英]Internationalization (i18n) / Localization for Node.js web application

I have a web application build using Node.js. 我使用Node.js构建Web应用程序。 I wish to do internationalization and support english and Spanish language. 我希望国际化并支持英语和西班牙语。

Whenever the user selects the english link the static content of my 'index.ejs' page should be in english and when he selects Spanish it should change accordingly. 每当用户选择英文链接时,我的'index.ejs'页面的静态内容应该是英文的,当他选择西班牙语时,它应该相应地改变。

How can I do that? 我怎样才能做到这一点? What would be the simplest way to do that? 最简单的方法是什么? Also, How can I improve Search Engine Optimization (SEO)? 另外,我如何改进搜索引擎优化(SEO)?

Take a look at this one: https://github.com/i18next/i18next-node 看一下这个: https//github.com/i18next/i18next-node

Provides simple API on the application and template level. 在应用程序和模板级别上提供简单的API。 So you need to build a dictionary and use it whereever you want. 因此,您需要构建一个字典并随时使用它。

About SEO: take a look at this article: http://www.w3.org/International/questions/qa-http-and-lang . 关于SEO:看看这篇文章: http//www.w3.org/International/questions/qa-http-and-lang Shortcut: you need to render your language <meta> tags according to you current language (or the prefered one). 快捷方式:您需要根据当前语言(或首选语言)呈现语言<meta>标记。 Search Robot should not get the meta tags and the content in the different languages. 搜索机器人不应该使用不同语言获取元标记和内容。

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

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