我有一个德语名称为“kontakt”的页面,但访问权限是 /contact。我开始解决这个错误,思考翻译,并在以下方面进行了更改:
(控制器)查询-controller.rb:更改
def find_page
@page = ::Refinery::Page.find_by_link_url("/kontakt")
end
i18n.rb:
config.enabled = true
config.default_locale = :de
config.current_locale = :de
config.default_frontend_locale = :de
config.frontend_locales = [:en, :de]
config.locales = { :en => 'English', :de => 'Deutsch' }
我更改了(模型)setting.rb:
def confirmation_subject(locale="de")...
而不是“en”。
我将refinerycms 中的重定向更改为/kontakt。
我在浏览器中收到错误“页面未正确重定向”。
控制台:
在 2013-02-19 17:07:27 +0100 开始 GET "/kontakt" for 127.0.0.1 由 Refinery::PagesController#show as HTML 参数处理:{"path"=>"kontakt", "locale"=> :de} Refinery::Role Load (0.2ms) SELECT "refinery_roles".* FROM "refinery_roles" WHERE "refinery_roles"."title" = 'Refinery' LIMIT 1 Refinery::User Load (0.2ms) SELECT "refinery_users"。 * FROM "refinery_users" INNER JOIN "refinery_roles_users" ON "refinery_users"."id" = "refinery_roles_users"."user_id" WHERE "refinery_roles_users"."role_id" = 1 Refinery::Page Load (0.4ms) SELECT "refinery_pages"。 * FROM "refinery_pages" INNER JOIN "refinery_page_translations"ON "refinery_page_translations"."refinery_page_id" = "refinery_pages"."id" WHERE "refinery_page_translations"."locale" IN ('en', 'de') AND "refinery_page_translations"."slug" = 'kontakt' AND "refinery_pages" ."parent_id" IS NULL LIMIT 1 重定向到 ../kontakt Refinery::User Load (0.1ms) SELECT "refinery_users".* FROM "refinery_users" WHERE "refinery_users"."id" = 3 LIMIT 1 Refinery::Role Load (0.1ms) SELECT "refinery_roles".* FROM "refinery_roles" INNER JOIN "refinery_roles_users" ON "refinery_roles"."id" = "refinery_roles_users"."role_id" WHERE "refinery_roles_users"."user_id"= 3 完成 302 在 8 毫秒内找到(ActiveRecord:1.1 毫秒)缓存:[GET /kontakt] 未命中缓存:[GET /kontakt] 未命中
development.log 的日志:
在 2013-02-19 17:07:27 +0100 开始 GET "/kontakt" for 127.0.0.1 由 Refinery::PagesController#show as HTML 参数处理:{"path"=>"kontakt", "locale"=> :de} [1m[35mRefinery::Role Load (0.1ms)[0m SELECT "refinery_roles".* FROM "refinery_roles" WHERE "refinery_roles"."title" = 'Refinery' LIMIT 1
[1m[36mRefinery::User Load (0.2ms)[0m [1mSELECT "refinery_users".* FROM "refinery_users" INNER JOIN "refinery_roles_users" ON "refinery_users"."id" = "refinery_roles_users"."user_id" WHERE "refinery_roles_users" ."role_id" = 1[0m [1m[35mRefinery::Page Load (0.2ms)[0m SELECT "refinery_pages".* FROM "refinery_pages" INNER JOIN "refinery_page_translations" ON "refinery_page_translations"."refinery_page_id" = "refinery_pages"。 "id" WHERE "refinery_page_translations"."locale" IN ('en', 'de') AND "refinery_page_translations"."slug" = 'kontakt' AND "refinery_pages"."parent_id"IS NULL LIMIT 1 重定向到 //../kontakt [1m[36mRefinery::User Load (0.1ms)[0m [1mSELECT "refinery_users".* FROM "refinery_users" WHERE "refinery_users"."id" = 3 LIMIT 1[ 0m [1m[35mRefinery::Role Load (0.1ms)[0m SELECT "refinery_roles".* FROM "refinery_roles" INNER JOIN "refinery_roles_users" ON "refinery_roles"."id" = "refinery_roles_users"."role_id" WHERE "refinery_roles_users" ."user_id" = 3 Completed 302 Found in 6ms (ActiveRecord: 0.8ms)1ms)[0m SELECT "refinery_roles".* FROM "refinery_roles" INNER JOIN "refinery_roles_users" ON "refinery_roles"."id" = "refinery_roles_users"."role_id" WHERE "refinery_roles_users"."user_id" = 3 完成 302 发现时间为 6ms (活动记录:0.8ms)1ms)[0m SELECT "refinery_roles".* FROM "refinery_roles" INNER JOIN "refinery_roles_users" ON "refinery_roles"."id" = "refinery_roles_users"."role_id" WHERE "refinery_roles_users"."user_id" = 3 完成 302 发现时间为 6ms (活动记录:0.8ms)
我在文件中有翻译:en.yml 和 de.yml
我在http://refinerycms.com/edge-guides/translate-refinery中看到了信息, 但我找不到解决方案。
如果我尝试使用 /contact 输入,效果很好,即使进行了所有更改。
此外,在页面的公式中,验证正在读取英文值。