Localize CSV viewer search panel

This commit is contained in:
ema
2026-04-23 19:06:58 +08:00
parent 906bd804c1
commit 5493ab8cd9
3 changed files with 237 additions and 11 deletions
@@ -13,26 +13,26 @@
CornerRadius="4"
SnapsToDevicePixels="True">
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
<!-- Search -->
<TextBox x:Name="searchTextBox"
Width="180"
Margin="0,0,8,0"
VerticalContentAlignment="Center"
FocusVisualStyle="{x:Null}"
KeyDown="SearchTextBox_KeyDown"
TextChanged="SearchTextBox_TextChanged"
ToolTip="Search" />
TextChanged="SearchTextBox_TextChanged" />
<!-- Match case -->
<CheckBox x:Name="matchCaseToggle"
Margin="0,0,8,0"
VerticalAlignment="Center"
Checked="MatchCaseToggle_Checked"
Content="Match case"
Unchecked="MatchCaseToggle_Checked" />
<!-- Previous matches -->
<Button x:Name="previousButton"
Margin="0,0,4,0"
Click="PreviousButton_Click"
ToolTip="Previous match">
Click="PreviousButton_Click">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
@@ -40,10 +40,10 @@
Text="&#xe76b;" />
</Button>
<!-- Next matches -->
<Button x:Name="nextButton"
Margin="0,0,8,0"
Click="NextButton_Click"
ToolTip="Next match">
Click="NextButton_Click">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
@@ -51,15 +51,15 @@
Text="&#xe76c;" />
</Button>
<!-- No matches -->
<TextBlock x:Name="matchCountTextBlock"
VerticalAlignment="Center"
Foreground="{DynamicResource WindowTextForeground}"
Text="No matches" />
Text="" />
<Button x:Name="closeButton"
Margin="8,0,0,0"
Click="CloseButton_Click"
ToolTip="Close">
Click="CloseButton_Click">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
@@ -1,4 +1,8 @@
using QuickLook.Common.Helpers;
using System;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@@ -7,6 +11,8 @@ namespace QuickLook.Plugin.CsvViewer;
public partial class SearchPanel : UserControl
{
private readonly string _translationFile;
public event EventHandler<string> SearchTextChanged;
public event EventHandler<bool> MatchCaseChanged;
@@ -20,6 +26,15 @@ public partial class SearchPanel : UserControl
public SearchPanel()
{
InitializeComponent();
_translationFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Translations.config");
searchTextBox.ToolTip = TranslationHelper.Get("Search_Placeholder", _translationFile, failsafe: "Search...");
matchCaseToggle.Content = TranslationHelper.Get("Search_MatchCase", _translationFile, failsafe: "Match case");
previousButton.ToolTip = TranslationHelper.Get("Search_PreviousMatch", _translationFile, failsafe: "Previous match");
nextButton.ToolTip = TranslationHelper.Get("Search_NextMatch", _translationFile, failsafe: "Next match");
matchCountTextBlock.Text = TranslationHelper.Get("Search_NoMatches", _translationFile, failsafe: "No matches");
closeButton.ToolTip = TranslationHelper.Get("Search_Close", _translationFile, failsafe: "Close");
}
public string SearchText
@@ -38,7 +53,15 @@ public partial class SearchPanel : UserControl
public void SetMatchCount(int current, int total)
{
matchCountTextBlock.Text = total == 0 ? "No matches" : $"{current} of {total}";
if (total == 0)
{
matchCountTextBlock.Text = TranslationHelper.Get("Search_NoMatches", _translationFile, failsafe: "No matches");
}
else
{
var fmt = TranslationHelper.Get("Search_MatchCount", _translationFile, failsafe: "{0} of {1}");
matchCountTextBlock.Text = string.Format(CultureInfo.CurrentCulture, fmt, current, total);
}
}
private void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e)
@@ -3,89 +3,292 @@
<Translations>
<ar>
<MW_ReopenAsTextPreview>إعادة فتح كمعاينة نص</MW_ReopenAsTextPreview>
<Search_Placeholder>بحث...</Search_Placeholder>
<Search_MatchCase>مطابقة حالة الأحرف</Search_MatchCase>
<Search_PreviousMatch>التطابق السابق</Search_PreviousMatch>
<Search_NextMatch>التطابق التالي</Search_NextMatch>
<Search_NoMatches>لا توجد تطابقات</Search_NoMatches>
<Search_MatchCount>{0} من {1}</Search_MatchCount>
<Search_Close>إغلاق</Search_Close>
</ar>
<ca>
<MW_ReopenAsTextPreview>Torna a obrir com a previsualització de text</MW_ReopenAsTextPreview>
<Search_Placeholder>Cercar...</Search_Placeholder>
<Search_MatchCase>Distingir majúscules</Search_MatchCase>
<Search_PreviousMatch>Coincidència anterior</Search_PreviousMatch>
<Search_NextMatch>Coincidència següent</Search_NextMatch>
<Search_NoMatches>Sense coincidències</Search_NoMatches>
<Search_MatchCount>{0} de {1}</Search_MatchCount>
<Search_Close>Tancar</Search_Close>
</ca>
<de>
<MW_ReopenAsTextPreview>Als Text-Vorschau erneut öffnen</MW_ReopenAsTextPreview>
<Search_Placeholder>Suchen...</Search_Placeholder>
<Search_MatchCase>Groß-/Kleinschreibung beachten</Search_MatchCase>
<Search_PreviousMatch>Vorheriger Treffer</Search_PreviousMatch>
<Search_NextMatch>Nächster Treffer</Search_NextMatch>
<Search_NoMatches>Keine Treffer</Search_NoMatches>
<Search_MatchCount>{0} von {1}</Search_MatchCount>
<Search_Close>Schließen</Search_Close>
</de>
<en>
<MW_ReopenAsTextPreview>Reopen as text preview</MW_ReopenAsTextPreview>
<Search_Placeholder>Search...</Search_Placeholder>
<Search_MatchCase>Match case</Search_MatchCase>
<Search_PreviousMatch>Previous match</Search_PreviousMatch>
<Search_NextMatch>Next match</Search_NextMatch>
<Search_NoMatches>No matches</Search_NoMatches>
<Search_MatchCount>{0} of {1}</Search_MatchCount>
<Search_Close>Close</Search_Close>
</en>
<es>
<MW_ReopenAsTextPreview>Reabrir como vista previa de texto</MW_ReopenAsTextPreview>
<Search_Placeholder>Buscar...</Search_Placeholder>
<Search_MatchCase>Distinguir mayúsculas</Search_MatchCase>
<Search_PreviousMatch>Coincidencia anterior</Search_PreviousMatch>
<Search_NextMatch>Siguiente coincidencia</Search_NextMatch>
<Search_NoMatches>No hay coincidencias</Search_NoMatches>
<Search_MatchCount>{0} de {1}</Search_MatchCount>
<Search_Close>Cerrar</Search_Close>
</es>
<fr>
<MW_ReopenAsTextPreview>Rouvrir en aperçu texte</MW_ReopenAsTextPreview>
<Search_Placeholder>Rechercher...</Search_Placeholder>
<Search_MatchCase>Respecter la casse</Search_MatchCase>
<Search_PreviousMatch>Correspondance précédente</Search_PreviousMatch>
<Search_NextMatch>Correspondance suivante</Search_NextMatch>
<Search_NoMatches>Aucune correspondance</Search_NoMatches>
<Search_MatchCount>{0} sur {1}</Search_MatchCount>
<Search_Close>Fermer</Search_Close>
</fr>
<it>
<MW_ReopenAsTextPreview>Riapri come anteprima testo</MW_ReopenAsTextPreview>
<Search_Placeholder>Cerca...</Search_Placeholder>
<Search_MatchCase>Rispetta maiuscole/minuscole</Search_MatchCase>
<Search_PreviousMatch>Corrispondenza precedente</Search_PreviousMatch>
<Search_NextMatch>Corrispondenza successiva</Search_NextMatch>
<Search_NoMatches>Nessuna corrispondenza</Search_NoMatches>
<Search_MatchCount>{0} di {1}</Search_MatchCount>
<Search_Close>Chiudi</Search_Close>
</it>
<ja-JP>
<MW_ReopenAsTextPreview>テキストとして再度開く</MW_ReopenAsTextPreview>
<Search_Placeholder>検索...</Search_Placeholder>
<Search_MatchCase>大文字と小文字を区別</Search_MatchCase>
<Search_PreviousMatch>前の一致</Search_PreviousMatch>
<Search_NextMatch>次の一致</Search_NextMatch>
<Search_NoMatches>一致する項目はありません</Search_NoMatches>
<Search_MatchCount>{0} / {1}</Search_MatchCount>
<Search_Close>閉じる</Search_Close>
</ja-JP>
<ko>
<MW_ReopenAsTextPreview>텍스트 미리보기로 다시 열기</MW_ReopenAsTextPreview>
<Search_Placeholder>검색...</Search_Placeholder>
<Search_MatchCase>대소문자 구분</Search_MatchCase>
<Search_PreviousMatch>이전 항목</Search_PreviousMatch>
<Search_NextMatch>다음 항목</Search_NextMatch>
<Search_NoMatches>일치하는 항목 없음</Search_NoMatches>
<Search_MatchCount>{0} / {1}</Search_MatchCount>
<Search_Close>닫기</Search_Close>
</ko>
<nb-NO>
<MW_ReopenAsTextPreview>Åpne på nytt som tekst-forhåndsvisning</MW_ReopenAsTextPreview>
<Search_Placeholder>Søk...</Search_Placeholder>
<Search_MatchCase>Skille mellom store/små bokstaver</Search_MatchCase>
<Search_PreviousMatch>Forrige treff</Search_PreviousMatch>
<Search_NextMatch>Neste treff</Search_NextMatch>
<Search_NoMatches>Ingen treff</Search_NoMatches>
<Search_MatchCount>{0} av {1}</Search_MatchCount>
<Search_Close>Lukk</Search_Close>
</nb-NO>
<nl-NL>
<MW_ReopenAsTextPreview>Opnieuw openen als tekst-voorbeeld</MW_ReopenAsTextPreview>
<Search_Placeholder>Zoeken...</Search_Placeholder>
<Search_MatchCase>Hoofdlettergevoelig</Search_MatchCase>
<Search_PreviousMatch>Vorige overeenkomst</Search_PreviousMatch>
<Search_NextMatch>Volgende overeenkomst</Search_NextMatch>
<Search_NoMatches>Geen overeenkomsten</Search_NoMatches>
<Search_MatchCount>{0} van {1}</Search_MatchCount>
<Search_Close>Sluiten</Search_Close>
</nl-NL>
<pl>
<MW_ReopenAsTextPreview>Otwórz ponownie jako podgląd tekstu</MW_ReopenAsTextPreview>
<Search_Placeholder>Szukaj...</Search_Placeholder>
<Search_MatchCase>Rozróżniaj wielkość liter</Search_MatchCase>
<Search_PreviousMatch>Poprzednie dopasowanie</Search_PreviousMatch>
<Search_NextMatch>Następne dopasowanie</Search_NextMatch>
<Search_NoMatches>Brak dopasowań</Search_NoMatches>
<Search_MatchCount>{0} z {1}</Search_MatchCount>
<Search_Close>Zamknij</Search_Close>
</pl>
<pt-BR>
<MW_ReopenAsTextPreview>Reabrir como visualização de texto</MW_ReopenAsTextPreview>
<Search_Placeholder>Pesquisar...</Search_Placeholder>
<Search_MatchCase>Diferenciar maiúsculas/minúsculas</Search_MatchCase>
<Search_PreviousMatch>Resultado anterior</Search_PreviousMatch>
<Search_NextMatch>Próximo resultado</Search_NextMatch>
<Search_NoMatches>Sem resultados</Search_NoMatches>
<Search_MatchCount>{0} de {1}</Search_MatchCount>
<Search_Close>Fechar</Search_Close>
</pt-BR>
<pt-PT>
<MW_ReopenAsTextPreview>Reabrir como pré-visualização de texto</MW_ReopenAsTextPreview>
<Search_Placeholder>Pesquisar...</Search_Placeholder>
<Search_MatchCase>Diferenciar maiúsculas/minúsculas</Search_MatchCase>
<Search_PreviousMatch>Correspondência anterior</Search_PreviousMatch>
<Search_NextMatch>Próxima correspondência</Search_NextMatch>
<Search_NoMatches>Sem correspondências</Search_NoMatches>
<Search_MatchCount>{0} de {1}</Search_MatchCount>
<Search_Close>Fechar</Search_Close>
</pt-PT>
<ro>
<MW_ReopenAsTextPreview>Redeschideți ca previzualizare text</MW_ReopenAsTextPreview>
<Search_Placeholder>Căutare...</Search_Placeholder>
<Search_MatchCase>Diferențiază majuscule/minuscule</Search_MatchCase>
<Search_PreviousMatch>Potrivire anterioară</Search_PreviousMatch>
<Search_NextMatch>Următoarea potrivire</Search_NextMatch>
<Search_NoMatches>Nicio potrivire</Search_NoMatches>
<Search_MatchCount>{0} din {1}</Search_MatchCount>
<Search_Close>Închide</Search_Close>
</ro>
<ru-RU>
<MW_ReopenAsTextPreview>Переоткрыть как предварительный просмотр текста</MW_ReopenAsTextPreview>
<Search_Placeholder>Поиск...</Search_Placeholder>
<Search_MatchCase>Учитывать регистр</Search_MatchCase>
<Search_PreviousMatch>Предыдущее совпадение</Search_PreviousMatch>
<Search_NextMatch>Следующее совпадение</Search_NextMatch>
<Search_NoMatches>Совпадений не найдено</Search_NoMatches>
<Search_MatchCount>{0} из {1}</Search_MatchCount>
<Search_Close>Закрыть</Search_Close>
</ru-RU>
<tr-TR>
<MW_ReopenAsTextPreview>Metin önizlemesi olarak yeniden aç</MW_ReopenAsTextPreview>
<Search_Placeholder>Ara...</Search_Placeholder>
<Search_MatchCase>Büyük/küçük harfe duyarlı</Search_MatchCase>
<Search_PreviousMatch>Önceki eşleşme</Search_PreviousMatch>
<Search_NextMatch>Sonraki eşleşme</Search_NextMatch>
<Search_NoMatches>Eşleşme yok</Search_NoMatches>
<Search_MatchCount>{0} / {1}</Search_MatchCount>
<Search_Close>Kapat</Search_Close>
</tr-TR>
<uk-UA>
<MW_ReopenAsTextPreview>Перевідкрити як попередній перегляд тексту</MW_ReopenAsTextPreview>
<Search_Placeholder>Пошук...</Search_Placeholder>
<Search_MatchCase>Враховувати регістр</Search_MatchCase>
<Search_PreviousMatch>Попереднє співпадіння</Search_PreviousMatch>
<Search_NextMatch>Наступне співпадіння</Search_NextMatch>
<Search_NoMatches>Співпадінь не знайдено</Search_NoMatches>
<Search_MatchCount>{0} з {1}</Search_MatchCount>
<Search_Close>Закрити</Search_Close>
</uk-UA>
<vi>
<MW_ReopenAsTextPreview>Mở lại dưới dạng xem trước văn bản</MW_ReopenAsTextPreview>
<Search_Placeholder>Tìm...</Search_Placeholder>
<Search_MatchCase>Phân biệt chữ hoa/thường</Search_MatchCase>
<Search_PreviousMatch>Kết quả trước</Search_PreviousMatch>
<Search_NextMatch>Kết quả tiếp theo</Search_NextMatch>
<Search_NoMatches>Không có kết quả</Search_NoMatches>
<Search_MatchCount>{0} / {1}</Search_MatchCount>
<Search_Close>Đóng</Search_Close>
</vi>
<zh-CN>
<MW_ReopenAsTextPreview>重新作为文本预览打开</MW_ReopenAsTextPreview>
<Search_Placeholder>搜索...</Search_Placeholder>
<Search_MatchCase>区分大小写</Search_MatchCase>
<Search_PreviousMatch>上一个匹配项</Search_PreviousMatch>
<Search_NextMatch>下一个匹配项</Search_NextMatch>
<Search_NoMatches>没有匹配项</Search_NoMatches>
<Search_MatchCount>{0} / {1}</Search_MatchCount>
<Search_Close>关闭</Search_Close>
</zh-CN>
<zh-TW>
<MW_ReopenAsTextPreview>重新作為文本預覽開啟</MW_ReopenAsTextPreview>
<Search_Placeholder>搜尋...</Search_Placeholder>
<Search_MatchCase>區分大小寫</Search_MatchCase>
<Search_PreviousMatch>上一個匹配項</Search_PreviousMatch>
<Search_NextMatch>下一個匹配項</Search_NextMatch>
<Search_NoMatches>沒有匹配項</Search_NoMatches>
<Search_MatchCount>{0} / {1}</Search_MatchCount>
<Search_Close>關閉</Search_Close>
</zh-TW>
<mr>
<MW_ReopenAsTextPreview>पुनः टेक्स्ट पूर्वावलोकन म्हणून उघडा</MW_ReopenAsTextPreview>
<Search_Placeholder>शोधा...</Search_Placeholder>
<Search_MatchCase>मोठे/लहान अक्षर वेगळे ओळखा</Search_MatchCase>
<Search_PreviousMatch>मागील जुळणी</Search_PreviousMatch>
<Search_NextMatch>पुढील जुळणी</Search_NextMatch>
<Search_NoMatches>जुळणी नाही</Search_NoMatches>
<Search_MatchCount>{0} / {1}</Search_MatchCount>
<Search_Close>बंद करा</Search_Close>
</mr>
<hi>
<MW_ReopenAsTextPreview>टेक्स्ट पूर्वावलोकन के रूप में फिर से खोलें</MW_ReopenAsTextPreview>
<Search_Placeholder>खोजें...</Search_Placeholder>
<Search_MatchCase>बड़े/छोटे अक्षरों का मिलान</Search_MatchCase>
<Search_PreviousMatch>पिछला मिलान</Search_PreviousMatch>
<Search_NextMatch>अगला मिलान</Search_NextMatch>
<Search_NoMatches>कोई मिलान नहीं</Search_NoMatches>
<Search_MatchCount>{0} / {1}</Search_MatchCount>
<Search_Close>बंद करें</Search_Close>
</hi>
<he>
<MW_ReopenAsTextPreview>פתח מחדש כתצוגת טקסט</MW_ReopenAsTextPreview>
<Search_Placeholder>חיפוש...</Search_Placeholder>
<Search_MatchCase>התאמת אותיות רישיות/קטנות</Search_MatchCase>
<Search_PreviousMatch>התאמה קודמת</Search_PreviousMatch>
<Search_NextMatch>התאמה הבאה</Search_NextMatch>
<Search_NoMatches>אין התאמות</Search_NoMatches>
<Search_MatchCount>{0} מתוך {1}</Search_MatchCount>
<Search_Close>סגור</Search_Close>
</he>
<hu-HU>
<MW_ReopenAsTextPreview>Újranyitás szöveg előnézetként</MW_ReopenAsTextPreview>
<Search_Placeholder>Keresés...</Search_Placeholder>
<Search_MatchCase>Kis-/nagybetű megkülönböztetés</Search_MatchCase>
<Search_PreviousMatch>Előző találat</Search_PreviousMatch>
<Search_NextMatch>Következő találat</Search_NextMatch>
<Search_NoMatches>Nincs találat</Search_NoMatches>
<Search_MatchCount>{0} / {1}</Search_MatchCount>
<Search_Close>Bezárás</Search_Close>
</hu-HU>
<id-ID>
<MW_ReopenAsTextPreview>Buka ulang sebagai pratinjau teks</MW_ReopenAsTextPreview>
<Search_Placeholder>Cari...</Search_Placeholder>
<Search_MatchCase>Bedakan huruf besar/kecil</Search_MatchCase>
<Search_PreviousMatch>Hasil sebelumnya</Search_PreviousMatch>
<Search_NextMatch>Hasil berikutnya</Search_NextMatch>
<Search_NoMatches>Tidak ada kecocokan</Search_NoMatches>
<Search_MatchCount>{0} dari {1}</Search_MatchCount>
<Search_Close>Tutup</Search_Close>
</id-ID>
<sk>
<MW_ReopenAsTextPreview>Znova otvoriť ako náhľad textu</MW_ReopenAsTextPreview>
<Search_Placeholder>Hľadať...</Search_Placeholder>
<Search_MatchCase>Rozlišovať veľké a malé písmená</Search_MatchCase>
<Search_PreviousMatch>Predchádzajúce zhodovanie</Search_PreviousMatch>
<Search_NextMatch>Nasledujúce zhodovanie</Search_NextMatch>
<Search_NoMatches>Žiadne zhody</Search_NoMatches>
<Search_MatchCount>{0} z {1}</Search_MatchCount>
<Search_Close>Zavrieť</Search_Close>
</sk>
<el>
<MW_ReopenAsTextPreview>Επανανοίξτε ως προεπισκόπηση κειμένου</MW_ReopenAsTextPreview>
<Search_Placeholder>Αναζήτηση...</Search_Placeholder>
<Search_MatchCase>Διακρίνει πεζά/κεφαλαία</Search_MatchCase>
<Search_PreviousMatch>Προηγούμενη αντιστοιχία</Search_PreviousMatch>
<Search_NextMatch>Επόμενη αντιστοιχία</Search_NextMatch>
<Search_NoMatches>Καμία αντιστοιχία</Search_NoMatches>
<Search_MatchCount>{0} από {1}</Search_MatchCount>
<Search_Close>Κλείσιμο</Search_Close>
</el>
<sv>
<MW_ReopenAsTextPreview>Öppna på nytt som textförhandsgranskning</MW_ReopenAsTextPreview>
<Search_Placeholder>Sök...</Search_Placeholder>
<Search_MatchCase>Skiftlägeskänslig</Search_MatchCase>
<Search_PreviousMatch>Föregående träff</Search_PreviousMatch>
<Search_NextMatch>Nästa träff</Search_NextMatch>
<Search_NoMatches>Inga träffar</Search_NoMatches>
<Search_MatchCount>{0} av {1}</Search_MatchCount>
<Search_Close>Stäng</Search_Close>
</sv>
</Translations>