FIX: Relative links in translations should work with subfolder

This commit is contained in:
Gerhard Schlager
2018-11-07 17:59:42 +01:00
parent 5c845c5877
commit 24e5be3f0c
32 changed files with 217 additions and 116 deletions

View File

@@ -34,12 +34,18 @@ class ComposerMessagesFinder
end
if count < SiteSetting.educate_until_posts
education_posts_text = I18n.t('education.until_posts', count: SiteSetting.educate_until_posts)
return {
id: 'education',
templateName: 'education',
wait_for_typing: true,
body: PrettyText.cook(I18n.t(education_key, education_posts_text: education_posts_text, site_name: SiteSetting.title))
body: PrettyText.cook(
I18n.t(
education_key,
education_posts_text: I18n.t('education.until_posts', count: SiteSetting.educate_until_posts),
site_name: SiteSetting.title,
base_path: Discourse.base_path
)
)
}
end
@@ -173,7 +179,8 @@ class ComposerMessagesFinder
I18n.t(
'education.get_a_room',
count: SiteSetting.get_a_room_threshold,
reply_username: reply_username
reply_username: reply_username,
base_path: Discourse.base_path
)
)
}
@@ -191,7 +198,12 @@ class ComposerMessagesFinder
templateName: 'education',
wait_for_typing: false,
extraClass: 'education-message',
body: PrettyText.cook(I18n.t('education.reviving_old_topic', time_ago: FreedomPatches::Rails4.time_ago_in_words(@topic.last_posted_at, false, scope: :'datetime.distance_in_words_verbose')))
body: PrettyText.cook(
I18n.t(
'education.reviving_old_topic',
time_ago: FreedomPatches::Rails4.time_ago_in_words(@topic.last_posted_at, false, scope: :'datetime.distance_in_words_verbose')
)
)
}
end

View File

@@ -227,7 +227,11 @@ class PostDestroyer
message_type: :flags_agreed_and_post_deleted,
message_options: {
url: @post.url,
flag_reason: I18n.t("flag_reasons.#{@post.active_flags.last.post_action_type.name_key}", locale: SiteSetting.default_locale)
flag_reason: I18n.t(
"flag_reasons.#{@post.active_flags.last.post_action_type.name_key}",
locale: SiteSetting.default_locale,
base_path: Discourse.base_path
)
}
)
end

View File

@@ -229,7 +229,7 @@ module SiteSettingExtension
end
def description(setting)
I18n.t("site_settings.#{setting}")
I18n.t("site_settings.#{setting}", base_path: Discourse.base_path)
end
def placeholder(setting)

View File

@@ -91,9 +91,11 @@ task "topics:update_static", [:locale] => [:environment] do |_, args|
update_static_page_topic(locale, "tos_topic_id", "tos_topic.title", "tos_topic.body",
company_domain: SiteSetting.company_domain.presence || "company_domain",
company_full_name: SiteSetting.company_full_name.presence || "company_full_name",
company_name: SiteSetting.company_short_name.presence || "company_short_name")
company_name: SiteSetting.company_short_name.presence || "company_short_name",
base_path: Discourse.base_path)
update_static_page_topic(locale, "guidelines_topic_id", "guidelines_topic.title", "guidelines_topic.body")
update_static_page_topic(locale, "guidelines_topic_id", "guidelines_topic.title", "guidelines_topic.body",
base_path: Discourse.base_path)
update_static_page_topic(locale, "privacy_topic_id", "privacy_topic.title", "privacy_topic.body")
end