我正在使用机车 CMS,我想翻译一些字符串。我的tanslations.yml文件中有以下数据:
general:
404:
title:
en: "404 Page Not Found"
fr: "404 - Page non trouvée"
de: "404 Seite nicht gefunden"
es: "404 Página no encontrada"
pt-BR: "404 Página não encontrada"
subtext_html:
en: 'The page you requested does not exist. Click <a href=\"/collections/all\">here</a> to continue shopping.'
fr: "Cette page n'est pas disponible. <a href= '/collections/all'>Retourner au magasin</a>"
de: 'Die von Ihnen angeforderte Seite existiert nicht. Klicken Sie <a href=\"/collections/all\">hier</a>, um den Einkauf fortzusetzen.'
es: 'La página que ha solicitado no existe. Haga clic <a href=\"/collections/all\">aquí</a> para continuar la compra.'
pt-BR: 'A página que você solicitou não existe. Clique <a href=\"/collections/all\">aqui</a> para voltar às compras.'
而且我无法在我的404.liquid页面中访问这些数据:
---
title: Page not found
published: false
---
{% extends theme %}
{% block 'content' %}
{{ 'general.404.title' | translate }}
{{ 'general.404.subtext_html' | t }}
{% endblock %}
在locomotive/mounter/translation.rb文件中只有 2 个字段:键和值
module Locomotive
module Mounter
module Models
class Translation < Base
## fields ##
field :key
field :values
## methods ##
def get(locale)
self.values[locale.to_s]
end
def to_params
{ key: self.key, values: self.values }
end
def to_s
"Translation #{self.key} (#{self.values.keys.join(', ')})"
end
end
end
end
end
这是否意味着我们不能像这样构建翻译数据?