Remove unnecessary Translations.config and simplify RTL detection code

Co-authored-by: emako <24737061+emako@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-07-23 15:18:50 +00:00
committed by ema
parent 4840a87858
commit 83cfd2a3d8
3 changed files with 7 additions and 36 deletions

View File

@@ -23,7 +23,6 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using UtfUnknown;
@@ -81,28 +80,16 @@ public class MarkdownPanel : WebpagePanel
var template = ReadString("/md2html.html");
// Check for RTL support similar to TextViewer
// Support automatic RTL for markdown files
bool isRtl = false;
var extension = Path.GetExtension(path);
// Apply RTL support to all markdown-like extensions handled by this plugin
var supportedExtensions = new[]
if (CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft)
{
".md", ".markdown", ".mdx", ".mmd", ".mkd", ".mdwn", ".mdown",
".mdc", ".qmd", ".rmd", ".rmarkdown", ".apib", ".mdtxt", ".mdtext"
};
if (supportedExtensions.Any(ext => extension.Equals(ext, StringComparison.OrdinalIgnoreCase)))
{
if (CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft)
{
string isSupportRTL = TranslationHelper.Get("IsSupportRTL",
failsafe: bool.TrueString,
domain: Assembly.GetExecutingAssembly().GetName().Name);
string isSupportRTL = TranslationHelper.Get("IsSupportRTL",
failsafe: bool.TrueString,
domain: Assembly.GetExecutingAssembly().GetName().Name);
if (bool.TrueString.Equals(isSupportRTL, StringComparison.OrdinalIgnoreCase))
isRtl = true;
}
if (bool.TrueString.Equals(isSupportRTL, StringComparison.OrdinalIgnoreCase))
isRtl = true;
}
var html = template.Replace("{{content}}", content)

View File

@@ -83,9 +83,6 @@
<EmbeddedResource Include="Resources\**\*">
<LogicalName>QuickLook.Plugin.MarkdownViewer.Resources.%(RecursiveDir)%(Filename)%(Extension)</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="Translations.config">
<LogicalName>QuickLook.Plugin.MarkdownViewer.Translations.config</LogicalName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Translations>
<ar>
<IsSupportRTL>True</IsSupportRTL>
</ar>
<he>
<IsSupportRTL>True</IsSupportRTL>
</he>
<en>
<IsSupportRTL>False</IsSupportRTL>
</en>
</Translations>