From 4e88a66083979a282e0cd001c7ee00b13a18ec8d Mon Sep 17 00:00:00 2001 From: Simon-Pierre LeBel Date: Thu, 19 Mar 2015 16:20:19 -0400 Subject: [PATCH] Added support for complete path localization --- .../lib/middleman-more/core_extensions/i18n.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/middleman-core/lib/middleman-more/core_extensions/i18n.rb b/middleman-core/lib/middleman-more/core_extensions/i18n.rb index a3d842ad..f8a679da 100644 --- a/middleman-core/lib/middleman-more/core_extensions/i18n.rb +++ b/middleman-core/lib/middleman-more/core_extensions/i18n.rb @@ -178,6 +178,15 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension ::I18n.locale = lang localized_page_id = ::I18n.t("paths.#{page_id}", default: page_id, fallback: []) + localized_path = "" + + File.dirname(path).split('/').each do |path_sub| + next if path_sub == "" + localized_path = "#{localized_path}/#{(::I18n.t("paths.#{path_sub}", default: path_sub).to_s)}" + end + + path = "#{localized_path}/#{File.basename(path)}" + prefix = if (options[:mount_at_root] == lang) || (options[:mount_at_root].nil? && langs[0] == lang) '/' else