如何本地化静态网站? [英] How to localise a static website?

查看:107
本文介绍了如何本地化静态网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我正在做的网站,我只使用静态内容,例如HTML,javascript,CSS,图像(没有PHP或服务器端语言).

For a website I'm doing, I'm only using static content such as HTML, javascript, CSS, images (no PHP or server-side language).

我希望能够以英语和法语进行本地化,但是我不确定哪种解决方案会很好. 到目前为止,我想到的是以下解决方案:

I want to be able to localize in English and French, but I'm unsure what would be a good solution. Here are the solutions I have in mind so far:

重复的HTML页面
优点:简单,对SEO友好
缺点:如果我决定更改任何内容,那将很痛苦,我总是必须做两次.

Duplicate HTML pages
Pros: simple, SEO friendly
Cons: a pain if I decide to change anything, I'll always have to do it twice

Dreamweaver模板
优点:SEO友好,更新友好
缺点:要添加区域的地方太多,这会使HTML大小加倍,代码混乱

Dreamweaver templates
Pros: SEO friendly, update friendly
Cons: so many places to add regions that it would double the HTML size, messy code

JST:javascript模板
优点:更新友好,代码友好
缺点:SEO吗?不是为此做的吗?

JST: javascript templating
Pros:update friendly, code friendly
Cons: SEO?, not made for this?

当前列表上还有其他想法或进一步的建议吗?

Any other ideas or further advice on the current list?

推荐答案

我一直是第一个选择(重复的HTML文件)的支持者,因为它往往是最简单,最友好的SEO,同时不需要使用任何JavaScript,但必须将所做的修改复制到多个文件中确实很烦人.为此,我的工作是使用静态站点生成器.创建布局并使用从本地化文件中检索到的文本填充它们可以消除此问题.这里有一些应该可以解决问题的选项.

I have always been a fan of the first option (duplicate HTML files) as it tends to be the easiest and most SEO-friendly while not requiring the use of any JavaScript, but having to copy your modifications over to several files can be really annoying. My work around for this has been to use static site generators. Creating layouts and populating them with text retrieved from localized files eliminates the problem. Here's a few different options that should do the trick.

Jekyll可能是想到静态站点生成器时想到的第一件事,因为它是目前最受欢迎的站点生成器.使用多语言插件,您可以使用博客框架构建多语言网站.

Jekyll is probably the first thing that comes to mind when thinking of static site generators as it's by far the most popular. Using the multiple languages plugin, you can build multilingual websites with the blog framework.

优点:是Jekyll,所以您可能会找到不错的支持.

Pros: It's Jekyll, so you'll likely find a decent amount of support.

缺点:Jekyll是一个博客框架,因此,如果您不构建博客,它可能不是最佳选择.

Cons: Jekyll is a blog framework, so it might not be the best option if you're not building a blog.

在最近在Google上进行搜索之前,我还不知道这一点,但是通过开箱即用地构建本地化网站的支持,这可能是有希望的.

I didn't know about this one before digging it up on Google recently, but it may be promising with support for building localized websites out of the box.

优点:正在积极开发中,无需任何插件即可支持近40种语言.它还具有许多其他有用的功能,例如增量重建,多种格式,友好的CLI和内容管理系统.

Pros: Actively being developed, supports almost 40 languages out of the box without any plugins. It also has lots of other useful features like incremental rebuilds, multiple formats, a friendly CLI, and a content management system.

缺点:没有Jekyll那样多的支持,也可能不适合您的构建.

Cons: Doesn't have as much support as Jekyll, also might not be as suitable depending on what you're building.

Hugo也可以用来建立多语言网站.

Hugo can also be used to build multilingual websites.

优点:Hugo还是一个非常流行的静态站点生成器,因此您也可以在该站点获得很多支持.但是,与Jekyll不同,您可以使用Hugo来构建多语言网站,而无需使用任何插件.

Pros: Hugo is also a very popular static site generator so you can expect lots of support there as well. Unlike Jekyll, however, you can use Hugo to build multilingual websites without the use of any plugins.

缺点:与Nikola不同,Hugo并不是在考虑本地化的情况下构建的.实现它更多是在配置文件中使用的技巧.

Cons: Unlike Nikola, Hugo wasn't built with localization in mind. Achieving it is more of a trick used in the configuration file.

尽管我不喜欢自我推广,但我一直在研究静态网站生成器,该网站主要致力于静态构建多语言网站.我认为,如果您选择使用它,可能会解决您的问题.

As much as I don't like self promotion, I've been working on a static site generator that's primary focus is building multilingual websites statically. I think it might help with your problem if you choose to use it.

优点:完全从本地化开始. "Ampersand"不是博客框架,因此几乎可以在任何Web开发项目中使用,而无需进行大量修改和跟踪模板文件.

Pros: Built from the ground up with localization in mind. Ampersand isn't a blog framework so it can be used in virtually any web development project without a ton of adaptation and chasing down template files.

缺点:尚处于开发的早期,经常出现向后不兼容的更新.

Cons: Still early in development where backwards-incompatible updates come often.

如果有人知道可以用来构建我上面没有提到的多语言网站的其他静态网站生成器,我建议您在评论中加以注意.

If anyone knows another static site generators which can be used to build multilingual websites that I haven't mentioned above, I encourage you to note it in the comments.

这篇关于如何本地化静态网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆