Skip to content

Commit d23fe39

Browse files
committed
add international language support
1 parent 82cfddb commit d23fe39

File tree

12 files changed

+189
-28
lines changed

12 files changed

+189
-28
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
3838

3939
contextMenus.Add(CreateOpenContainingFolderResult(record));
4040

41-
contextMenus.Add(CreateOpenWindowsIndexingOptions(record));
41+
contextMenus.Add(CreateOpenWindowsIndexingOptions());
4242

4343
if (record.ShowIndexState)
4444
contextMenus.Add(new Result {Title = "From index search: " + (record.WindowsIndexed ? "Yes" : "No"),
@@ -49,7 +49,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
4949
var fileOrFolder = (record.Type == ResultType.File) ? "file" : "folder";
5050
contextMenus.Add(new Result
5151
{
52-
Title = "Copy path",
52+
Title = Context.API.GetTranslation("plugin_explorer_copypath"),
5353
SubTitle = $"Copy the current {fileOrFolder} path to clipboard",
5454
Action = (context) =>
5555
{
@@ -71,7 +71,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
7171

7272
contextMenus.Add(new Result
7373
{
74-
Title = $"Copy {fileOrFolder}",
74+
Title = Context.API.GetTranslation("plugin_explorer_copyfilefolder") + $" {fileOrFolder}",
7575
SubTitle = $"Copy the {fileOrFolder} to clipboard",
7676
Action = (context) =>
7777
{
@@ -95,8 +95,8 @@ public List<Result> LoadContextMenus(Result selectedResult)
9595
if (record.Type == ResultType.File || record.Type == ResultType.Folder)
9696
contextMenus.Add(new Result
9797
{
98-
Title = $"Delete {fileOrFolder}",
99-
SubTitle = $"Delete the selected {fileOrFolder}",
98+
Title = Context.API.GetTranslation("plugin_explorer_deletefilefolder") + $" {fileOrFolder}",
99+
SubTitle = Context.API.GetTranslation("plugin_explorer_deletefilefolder_subtitle") + $" {fileOrFolder}",
100100
Action = (context) =>
101101
{
102102
try
@@ -122,7 +122,8 @@ public List<Result> LoadContextMenus(Result selectedResult)
122122
if (record.Type == ResultType.File && CanRunAsDifferentUser(record.FullPath))
123123
contextMenus.Add(new Result
124124
{
125-
Title = "Run as different user",
125+
Title = Context.API.GetTranslation("plugin_explorer_runasdifferentuser"),
126+
SubTitle = Context.API.GetTranslation("plugin_explorer_runasdifferentuser_subtitle"),
126127
Action = (context) =>
127128
{
128129
try
@@ -149,8 +150,8 @@ private Result CreateOpenContainingFolderResult(SearchResult record)
149150
{
150151
return new Result
151152
{
152-
Title = "Open containing folder",
153-
SubTitle = "Opens the location that contains the file or folder",
153+
Title = Context.API.GetTranslation("plugin_explorer_opencontainingfolder"),
154+
SubTitle = Context.API.GetTranslation("plugin_explorer_opencontainingfolder_subtitle"),
154155
Action = _ =>
155156
{
156157
try
@@ -173,9 +174,11 @@ private Result CreateOpenContainingFolderResult(SearchResult record)
173174

174175
private Result CreateOpenWithEditorResult(SearchResult record)
175176
{
176-
string editorPath = "notepad.exe"; // TODO add the ability to create a custom editor
177+
string editorPath = "Notepad.exe"; // TODO add the ability to create a custom editor
178+
179+
var name = Context.API.GetTranslation("plugin_explorer_openwitheditor")
180+
+ " " + Path.GetFileNameWithoutExtension(editorPath);
177181

178-
var name = "Open With Editor: " + Path.GetFileNameWithoutExtension(editorPath);
179182
return new Result
180183
{
181184
Title = name,
@@ -202,8 +205,8 @@ private Result CreateAddToIndexSearchExclusionListResult(SearchResult record)
202205
{
203206
return new Result
204207
{
205-
Title = "Exclude current and sub-directories from index search",
206-
SubTitle = "Path: " + record.FullPath,
208+
Title = Context.API.GetTranslation("plugin_explorer_excludefromindexsearch"),
209+
SubTitle = Context.API.GetTranslation("plugin_explorer_path") + " " + record.FullPath,
207210
Action = _ =>
208211
{
209212
if(!Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => x.Path == record.FullPath))
@@ -215,7 +218,9 @@ private Result CreateAddToIndexSearchExclusionListResult(SearchResult record)
215218

216219
Task.Run(() =>
217220
{
218-
Context.API.ShowMsg("Excluded from Index Search", "Path: " + record.FullPath, iconPath);
221+
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_excludedfromindexsearch_msg"),
222+
Context.API.GetTranslation("plugin_explorer_path") +
223+
" " + record.FullPath, iconPath);
219224

220225
// so the new path can be persisted to storage and not wait till next ViewModel save.
221226
Context.API.SaveAppAllSettings();
@@ -227,12 +232,12 @@ private Result CreateAddToIndexSearchExclusionListResult(SearchResult record)
227232
};
228233
}
229234

230-
private Result CreateOpenWindowsIndexingOptions(SearchResult record)
235+
private Result CreateOpenWindowsIndexingOptions()
231236
{
232237
return new Result
233238
{
234-
Title = "Open Windows Indexing Options",
235-
SubTitle = "Manage indexed files and folders",
239+
Title = Context.API.GetTranslation("plugin_explorer_openindexingoptions"),
240+
SubTitle = Context.API.GetTranslation("plugin_explorer_openindexingoptions_subtitle"),
236241
Action = _ =>
237242
{
238243
try
@@ -249,7 +254,7 @@ private Result CreateOpenWindowsIndexingOptions(SearchResult record)
249254
}
250255
catch (Exception e)
251256
{
252-
var message = $"Failed to open Windows Indexing Options";
257+
var message = Context.API.GetTranslation("plugin_explorer_openindexingoptions_errormsg");
253258
LogException(message, e);
254259
Context.API.ShowMsg(message);
255260
return false;

Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,42 @@
6060
<None Include="Images\windowsindexingoptions.png">
6161
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
6262
</None>
63+
64+
<Content Include="Languages\en.xaml">
65+
<Generator>MSBuild:Compile</Generator>
66+
<SubType>Designer</SubType>
67+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
68+
</Content>
69+
70+
<Content Include="Languages\zh-cn.xaml">
71+
<Generator>MSBuild:Compile</Generator>
72+
<SubType>Designer</SubType>
73+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
74+
</Content>
75+
76+
<Content Include="Languages\zh-tw.xaml">
77+
<Generator>MSBuild:Compile</Generator>
78+
<SubType>Designer</SubType>
79+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
80+
</Content>
81+
82+
<Content Include="Languages\de.xaml">
83+
<Generator>MSBuild:Compile</Generator>
84+
<SubType>Designer</SubType>
85+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
86+
</Content>
87+
88+
<Content Include="Languages\pl.xaml">
89+
<Generator>MSBuild:Compile</Generator>
90+
<SubType>Designer</SubType>
91+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
92+
</Content>
93+
94+
<Content Include="Languages\tr.xaml">
95+
<Generator>MSBuild:Compile</Generator>
96+
<SubType>Designer</SubType>
97+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
98+
</Content>
6399
</ItemGroup>
64100

65101
<ItemGroup>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:system="clr-namespace:System;assembly=mscorlib">
4+
5+
<!--Controls-->
6+
<system:String x:Key="plugin_explorer_delete">Löschen</system:String>
7+
<system:String x:Key="plugin_explorer_edit">Bearbeiten</system:String>
8+
<system:String x:Key="plugin_explorer_add">Hinzufügen</system:String>
9+
10+
<!--Dialogues-->
11+
<system:String x:Key="plugin_explorer_select_folder_link_warning">Bitte wähle eine Ordnerverknüpfung</system:String>
12+
<system:String x:Key="plugin_explorer_delete_folder_link">Bist du sicher {0} zu löschen?</system:String>
13+
14+
</ResourceDictionary>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:system="clr-namespace:System;assembly=mscorlib">
4+
5+
<!--Dialogues-->
6+
<system:String x:Key="plugin_explorer_select_folder_link_warning">Please select a folder link</system:String>
7+
<system:String x:Key="plugin_explorer_delete_folder_link">Are you sure you want to delete {0}?</system:String>
8+
9+
<!--Controls-->
10+
<system:String x:Key="plugin_explorer_delete">Delete</system:String>
11+
<system:String x:Key="plugin_explorer_edit">Edit</system:String>
12+
<system:String x:Key="plugin_explorer_add">Add</system:String>
13+
<system:String x:Key="plugin_explorer_quickfolderaccess_header">Quick Folder Access Paths</system:String>
14+
<system:String x:Key="plugin_explorer_indexsearchexcludedpaths_header">Index Search Excluded Paths</system:String>
15+
<system:String x:Key="plugin_explorer_manageindexoptions">Indexing Options</system:String>
16+
17+
18+
<!--Plugin Infos-->
19+
<system:String x:Key="plugin_explorer_plugin_name">Explorer</system:String>
20+
<system:String x:Key="plugin_explorer_plugin_description">Search and manage files and folders. Explorer utilises Windows Index Search</system:String>
21+
22+
<!--Context menu items-->
23+
<system:String x:Key="plugin_explorer_copypath">Copy path</system:String>
24+
<system:String x:Key="plugin_explorer_copyfilefolder">Copy</system:String>
25+
<system:String x:Key="plugin_explorer_deletefilefolder">Delete</system:String>
26+
<system:String x:Key="plugin_explorer_path">Path:</system:String>
27+
<system:String x:Key="plugin_explorer_deletefilefolder_subtitle">Delete the selected</system:String>
28+
<system:String x:Key="plugin_explorer_runasdifferentuser">Run as different user</system:String>
29+
<system:String x:Key="plugin_explorer_runasdifferentuser_subtitle">Run the selected using a different user account</system:String>
30+
<system:String x:Key="plugin_explorer_opencontainingfolder">Open containing folder</system:String>
31+
<system:String x:Key="plugin_explorer_opencontainingfolder_subtitle">Opens the location that contains the file or folder</system:String>
32+
<system:String x:Key="plugin_explorer_openwitheditor">Open With Editor:</system:String>
33+
<system:String x:Key="plugin_explorer_excludefromindexsearch">Exclude current and sub-directories from index search</system:String>
34+
<system:String x:Key="plugin_explorer_excludedfromindexsearch_msg">Excluded from Index Search</system:String>
35+
<system:String x:Key="plugin_explorer_openindexingoptions">Open Windows Indexing Options</system:String>
36+
<system:String x:Key="plugin_explorer_openindexingoptions_subtitle">Manage indexed files and folders</system:String>
37+
<system:String x:Key="plugin_explorer_openindexingoptions_errormsg">Failed to open Windows Indexing Options</system:String>
38+
39+
</ResourceDictionary>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:system="clr-namespace:System;assembly=mscorlib">
4+
5+
<!--Controls-->
6+
<system:String x:Key="plugin_explorer_delete">Usuń</system:String>
7+
<system:String x:Key="plugin_explorer_edit">Edytuj</system:String>
8+
<system:String x:Key="plugin_explorer_add">Dodaj</system:String>
9+
10+
<!--Dialogues-->
11+
<system:String x:Key="plugin_explorer_select_folder_link_warning">Musisz wybrać któryś folder z listy</system:String>
12+
<system:String x:Key="plugin_explorer_delete_folder_link">Czy jesteś pewien że chcesz usunąć {0}?</system:String>
13+
14+
</ResourceDictionary>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:system="clr-namespace:System;assembly=mscorlib">
4+
5+
<!--Controls-->
6+
<system:String x:Key="plugin_explorer_delete">Sil</system:String>
7+
<system:String x:Key="plugin_explorer_edit">Düzenle</system:String>
8+
<system:String x:Key="plugin_explorer_add">Ekle</system:String>
9+
10+
<!--Dialogues-->
11+
<system:String x:Key="plugin_explorer_select_folder_link_warning">Lütfen bir klasör bağlantısı seçin</system:String>
12+
<system:String x:Key="plugin_explorer_delete_folder_link">{0} bağlantısını silmek istediğinize emin misiniz?</system:String>
13+
14+
</ResourceDictionary>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:system="clr-namespace:System;assembly=mscorlib">
4+
5+
<!--Controls-->
6+
<system:String x:Key="plugin_explorer_delete">删除</system:String>
7+
<system:String x:Key="plugin_explorer_edit">编辑</system:String>
8+
<system:String x:Key="plugin_explorer_add">添加</system:String>
9+
10+
<!--Dialogues-->
11+
<system:String x:Key="plugin_explorer_select_folder_link_warning">请选择一个文件夹</system:String>
12+
<system:String x:Key="plugin_explorer_delete_folder_link">你确定要删除{0}吗?</system:String>
13+
14+
</ResourceDictionary>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:system="clr-namespace:System;assembly=mscorlib">
4+
5+
<!--Controls-->
6+
<system:String x:Key="plugin_explorer_delete">刪除</system:String>
7+
<system:String x:Key="plugin_explorer_edit">編輯</system:String>
8+
<system:String x:Key="plugin_explorer_add">新增</system:String>
9+
10+
<!--Dialogues-->
11+
<system:String x:Key="plugin_explorer_select_folder_link_warning">請選擇一個資料夾</system:String>
12+
<system:String x:Key="plugin_explorer_delete_folder_link">你確認要刪除{0}嗎?</system:String>
13+
14+
</ResourceDictionary>

Plugins/Flow.Launcher.Plugin.Explorer/Main.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Flow.Launcher.Plugin.Explorer
99
{
10-
public class Main : ISettingProvider, IPlugin, ISavable, IContextMenu //, IPluginI18n <=== do later
10+
public class Main : ISettingProvider, IPlugin, ISavable, IContextMenu, IPluginI18n
1111
{
1212
internal PluginInitContext Context { get; set; }
1313

@@ -49,5 +49,15 @@ public void Save()
4949
{
5050
viewModel.Save();
5151
}
52+
53+
public string GetTranslatedPluginTitle()
54+
{
55+
return Context.API.GetTranslation("plugin_explorer_plugin_name");
56+
}
57+
58+
public string GetTranslatedPluginDescription()
59+
{
60+
return Context.API.GetTranslation("plugin_explorer_plugin_description");
61+
}
5262
}
5363
}

Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525
</Grid.RowDefinitions>
2626
<ScrollViewer Margin="20 35 0 0" HorizontalScrollBarVisibility="Hidden" Grid.Row="0" VerticalScrollBarVisibility="Auto">
2727
<StackPanel>
28-
<Expander Name="expFolderLinks" Header="Quick Folder Access Paths"
28+
<Expander Name="expFolderLinks" Header="{DynamicResource plugin_explorer_quickfolderaccess_header}"
2929
Expanded="expFolderLinks_Click" Collapsed="expFolderLinks_Click">
3030
<ListView
3131
x:Name="lbxFolderLinks" AllowDrop="True"
3232
Drop="lbxFolders_Drop"
3333
DragEnter="lbxFolders_DragEnter"
3434
ItemTemplate="{StaticResource ListViewTemplateFolderLinks}"/>
3535
</Expander>
36-
<Expander x:Name="expExcludedPaths" Header="Index Search Excluded Paths"
36+
<Expander x:Name="expExcludedPaths" Header="{DynamicResource plugin_explorer_indexsearchexcludedpaths_header}"
3737
Expanded="expExcludedPaths_Click" Collapsed="expExcludedPaths_Click"
3838
Margin="0 10 0 0">
3939
<ListView
@@ -50,12 +50,13 @@
5050
<ColumnDefinition Width="350"/>
5151
</Grid.ColumnDefinitions>
5252
<StackPanel Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" Orientation="Horizontal">
53-
<Button x:Name="btnIndexingOptions" Click="btnOpenIndexingOptions_Click" Width="130" Margin="10" Content="Indexing Options"/>
53+
<Button x:Name="btnIndexingOptions" Click="btnOpenIndexingOptions_Click" Width="130" Margin="10"
54+
Content="{DynamicResource plugin_explorer_manageindexoptions}"/>
5455
</StackPanel>
5556
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
56-
<Button x:Name="btnDelete" Click="btnDelete_Click" Width="100" Margin="10" Content="{DynamicResource flowlauncher_plugin_folder_delete}"/>
57-
<Button x:Name="btnEdit" Click="btnEdit_Click" Width="100" Margin="10" Content="{DynamicResource flowlauncher_plugin_folder_edit}"/>
58-
<Button x:Name="btnAdd" Click="btnAdd_Click" Width="100" Margin="10" Content="{DynamicResource flowlauncher_plugin_folder_add}"/>
57+
<Button x:Name="btnDelete" Click="btnDelete_Click" Width="100" Margin="10" Content="{DynamicResource plugin_explorer_delete}"/>
58+
<Button x:Name="btnEdit" Click="btnEdit_Click" Width="100" Margin="10" Content="{DynamicResource plugin_explorer_edit}"/>
59+
<Button x:Name="btnAdd" Click="btnAdd_Click" Width="100" Margin="10" Content="{DynamicResource plugin_explorer_add}"/>
5960
</StackPanel>
6061
</Grid>
6162
</Grid>

0 commit comments

Comments
 (0)