中间人本地化给出 404

发布于 2024-12-23 17:40:27 字数 1430 浏览 6 评论 0原文

我正在尝试使用 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"

it.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

当我导航站点根目录时< a href="http://localhost:4567/" rel="nofollow">http://localhost:4567/ 页面加载,本地化字符串取自 it.yml 本地化。它不应该去 en.yml 吗?根据文档,如果没有不同指定,它应该按字母顺序排列区域设置。

当我导航到 http://localhost:4567/en/index.htmlhttp://localhost:4567/it/index.html,相反,我得到:

File Not Found

/it/index.html

我尝试重新启动服务器,更改 localize 函数的参数config.rb(路径和mount_to_root),但没有什么不同。有人有想法吗?

I'm trying to user MiddlemanApp to localize a website, following this http://middlemanapp.com/guides/localization guide.

I have a locales/ folder under the project's root, with en.yml and it.yml inside. The files looks like this:

en.yml

---
en:
    rooms: "rooms"
    restaurant: "restaurant"
    bar: "bar"
    contacts: "contacts"
    gallery: "gallery"
    about: "about the website"
    press: "press"

it.yml

---
it:
    rooms: "stanze"
    restaurant: "ristorante"
    bar: "bar"
    contacts: "contatti"
    gallery: "galleria"
    about: "il sito web"
    press: "stampa"

The localization files seem to be loaded, when i start the server i get:

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

when i navigate the the site root http://localhost:4567/ the page loads and the localization strings are taken from the it.yml localizazion. Shouldn't it go to the en.yml? According to the documentation it should take the locales in alphabetic order if not differently specified.

When i navigate to http://localhost:4567/en/index.html or http://localhost:4567/it/index.html, instead, i get a:

File Not Found

/it/index.html

I tried to restart the server, change the parameters of the localize function in config.rb (path and mount_to_root), but got nothing different. Anyone have ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

少年亿悲伤 2024-12-30 17:40:27

这将取决于 /source/localized 文件夹的内容。只有此文件夹中的模板才能访问 i18n 值。

如果您仍然遇到问题,请提交错误报告。

This will depend on the contents of your /source/localizable folder. Only templates in this folder will have access to i18n values.

If you're still having issues, please submit a bug report.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文