Defect #39755
closedCommonMark Markdown help page does not reflect user's language setting
0%
Description
The CommonMark Markdown help should open the translated version if one exists, but in fact it always opens the English version.
Step to reproduce:
1. Change the text formatting to CommonMark markdown in Administration > Settings > General
2. Change the language to German in the "My account"
3. Open the issue creation page and click "[?]" in the toolbar
Expected Behavior:
The help should open in the selected interface language, which in this case is German.
Actual Behavior:
Despite the language setting being German and the file public/help/de/wiki_syntax_common_mark.html exists, the help page opens in English.
Files
Related issues
Updated by Go MAEDA about 1 year ago
The cause of this issue is that the condition for unless
in the following code (at source:tags/5.1.1/lib/redmine/wiki_formatting/common_mark/helper.rb#L29) always returns false. The leading slash in the path value of help_file
variable causes the problem.
help_file = "/help/#{current_language.to_s.downcase}/wiki_syntax_common_mark.html"
# fall back to the english help page if there is none for the current
# language
unless File.readable? Rails.public_path.join(help_file)
help_file = "/help/en/wiki_syntax_common_mark.html"
end
end
The following change fixes the issue.
diff --git a/lib/redmine/wiki_formatting/common_mark/helper.rb b/lib/redmine/wiki_formatting/common_mark/helper.rb
index 28e2fe10a..c14fe3f6a 100644
--- a/lib/redmine/wiki_formatting/common_mark/helper.rb
+++ b/lib/redmine/wiki_formatting/common_mark/helper.rb
@@ -23,13 +23,13 @@ module Redmine
module Helper
def wikitoolbar_for(field_id, preview_url = preview_text_path)
heads_for_wiki_formatter
- help_file = "/help/#{current_language.to_s.downcase}/wiki_syntax_common_mark.html"
+ help_file = "help/#{current_language.to_s.downcase}/wiki_syntax_common_mark.html"
# fall back to the english help page if there is none for the current
# language
- unless File.readable? Rails.public_path.join(help_file)
- help_file = "/help/en/wiki_syntax_common_mark.html"
+ unless Rails.public_path.join(help_file).readable?
+ help_file = "help/en/wiki_syntax_common_mark.html"
end
- url = "#{Redmine::Utils.relative_url_root}#{help_file}"
+ url = File.join(Redmine::Utils.relative_url_root, help_file)
javascript_tag(
"var wikiToolbar = new jsToolBar(document.getElementById('#{field_id}')); " \
"wikiToolbar.setHelpLink('#{escape_javascript url}'); " \
Updated by Go MAEDA about 1 year ago
- File 39755.patch 39755.patch added
Here is a patch to fix the issue.
Updated by Go MAEDA about 1 year ago
- Blocks Patch #39751: Additional translation for Tamil language added
Updated by Go MAEDA about 1 year ago
- Target version set to 5.1.2
Setting the target version to 5.1.2.
Updated by Go MAEDA about 1 year ago
- Status changed from New to Resolved
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the patch in r22496.