Add English and Chinese translations

This commit is contained in:
Paddy Xu
2017-07-14 22:25:44 +03:00
parent 751bd6e28e
commit 77b973ef7b
16 changed files with 215 additions and 37 deletions

View File

@@ -70,7 +70,7 @@ namespace QuickLook.Plugin.TextViewer
public void View(string path, ContextObject context)
{
_tvp = new TextViewerPanel(path);
_tvp = new TextViewerPanel(path, context);
context.ViewerContent = _tvp;
context.Title = $"{Path.GetFileName(path)}";

View File

@@ -90,5 +90,11 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<None Include="Translations.lang">
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -10,8 +10,7 @@
d:DesignWidth="448.79"
UseLayoutRounding="True">
<Grid>
<avalonEdit:TextEditor x:Name="viewer" Background="#00FFFFFF" FontFamily="Consolas" FontSize="14"
ShowLineNumbers="True"
<avalonEdit:TextEditor x:Name="viewer" Background="#00FFFFFF" FontSize="14" ShowLineNumbers="True"
WordWrap="True" IsReadOnly="True" />
</Grid>
</UserControl>

View File

@@ -16,8 +16,10 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.IO;
using System.Reflection;
using System.Text;
using System.Windows.Controls;
using System.Windows.Media;
using ICSharpCode.AvalonEdit.Highlighting;
using QuickLook.Plugin.TextViewer.SimpleHelpers;
@@ -28,10 +30,15 @@ namespace QuickLook.Plugin.TextViewer
/// </summary>
public partial class TextViewerPanel : UserControl
{
public TextViewerPanel(string path)
public TextViewerPanel(string path, ContextObject context)
{
InitializeComponent();
viewer.FontFamily =
new FontFamily(context.GetString(
Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Translations.lang"),
"Editor_FontFamily", failsafe: "Consolas"));
LoadFile(path);
}

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Translations>
<en>
<Editor_FontFamily>Consolas</Editor_FontFamily>
</en>
<zh-CN>
<Editor_FontFamily>Consolas,Microsoft Yahei UI,Microsoft Yahei,SimSun</Editor_FontFamily>
</zh-CN>
<ja-JP>
<Editor_FontFamily>Consolas,Meiryo UI,MS UI Gothic,MS Gothic</Editor_FontFamily>
</ja-JP>
</Translations>