我正在尝试使用 MiddlemanApp 来本地化网站,遵循此http://middlemanapp.com/guides/localization指南。
我在项目的根目录下有一个 locales/ 文件夹,里面有 en.yml 和 it.yml。文件如下所示:
en.yml
---
en:
rooms: "rooms"
restaurant: "restaurant"
bar: "bar"
contacts: "contacts"
gallery: "gallery"
about: "about the website"
press: "press"
它.yml
---
it:
rooms: "stanze"
restaurant: "ristorante"
bar: "bar"
contacts: "contatti"
gallery: "galleria"
about: "il sito web"
press: "stampa"
本地化文件似乎已加载,当我启动服务器时,我得到:
Using inline Guardfile.
Guard is now watching at '...'
LiveReload 1.6 is waiting for a browser to connect.
== Locales: en, it
== The Middleman is standing watch on port 4567
当我浏览站点根目录http://localhost:4567/时,页面加载并且本地化字符串取自 it.yml 本地化。它不应该去en.yml吗?根据文档,如果没有不同的指定,它应该按字母顺序排列语言环境。
当我导航到http://localhost:4567/en/index.html或http://localhost:4567/it/index.html时,我得到一个:
File Not Found
/it/index.html
我尝试重新启动服务器,更改 config.rb 中 localize 函数的参数(路径和 mount_to_root),但没有任何不同。有人有想法吗?