From 9e1cca27a0091420dd53e3035afa5811cc403214 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Tue, 6 Oct 2020 23:46:55 -0400 Subject: [PATCH] Polish WPF previewer and update translations --- CHANGELOG.md | 14 +++--- scripts/i18n_download.py | 2 +- scripts/i18n_gettext.py | 2 +- src/Localization.cs | 9 ++-- src/ThemeDialog.cs | 14 +++++- src/WPF/ThemePreviewer.xaml | 38 ++++++---------- src/WPF/ThemePreviewer.xaml.cs | 6 ++- src/WPF/ThemePreviewerViewModel.cs | 69 +++++++++++++++++++++++------ src/locale/bg.mo | Bin 14130 -> 13392 bytes src/locale/bn.mo | Bin 13224 -> 12589 bytes src/locale/cs.mo | Bin 7839 -> 9915 bytes src/locale/de.mo | Bin 10817 -> 10648 bytes src/locale/el.mo | Bin 6781 -> 0 bytes src/locale/es.mo | Bin 11037 -> 11053 bytes src/locale/fr.mo | Bin 11313 -> 11256 bytes src/locale/hi.mo | Bin 12344 -> 11670 bytes src/locale/id.mo | Bin 10432 -> 9931 bytes src/locale/it.mo | Bin 8031 -> 8073 bytes src/locale/ja.mo | Bin 11745 -> 11862 bytes src/locale/ko.mo | Bin 0 -> 10975 bytes src/locale/mk.mo | Bin 10666 -> 13434 bytes src/locale/nl.mo | Bin 0 -> 10084 bytes src/locale/pl.mo | Bin 8026 -> 7587 bytes src/locale/pt-br.mo | Bin 10106 -> 9560 bytes src/locale/ro.mo | Bin 10230 -> 9695 bytes src/locale/ru.mo | Bin 10229 -> 9630 bytes src/locale/tr.mo | Bin 10137 -> 9640 bytes src/locale/zh-Hans.mo | Bin 9912 -> 9910 bytes uwp/Package.appxmanifest | 2 +- 29 files changed, 101 insertions(+), 55 deletions(-) delete mode 100644 src/locale/el.mo create mode 100644 src/locale/ko.mo create mode 100644 src/locale/nl.mo diff --git a/CHANGELOG.md b/CHANGELOG.md index 35c87b6..4872ccb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,13 @@ ## `4.3.0` -* Redesign theme selector dialog to show carousel that autocycles through images (thanks @cjvaughter) -* Add Indonesian translation (thanks @ChrisG661) -* Fix error when Windows 10 default wallpaper missing +* Redesigned theme selector dialog to show carousel that autocycles through images (thanks @cjvaughter) +* Added Dutch, Korean, and Indonesian translations (thanks Samuel, jihwan_bong, and @ChrisG661) +* Fixed error when Windows 10 default wallpaper missing ## `4.2.0` -* Add Big Sur and Big Sur Abstract themes -* Add Bulgarian and Japanese translations (thanks Marin and Syoyusensation) -* Improve error checking for theme JSON when new themes are installed -* Fix check for updates failing on Windows 7 +* Added Big Sur and Big Sur Abstract themes +* Added Bulgarian and Japanese translations (thanks Marin and Syoyusensation) +* Improved error checking for theme JSON when new themes are installed +* Fixed check for updates failing on Windows 7 diff --git a/scripts/i18n_download.py b/scripts/i18n_download.py index 885bdc9..9143863 100644 --- a/scripts/i18n_download.py +++ b/scripts/i18n_download.py @@ -20,7 +20,7 @@ projects = client.list_projects() project_id = [p for p in projects if p["name"] == "WinDynamicDesktop"][0]["id"] languages = client.list_project_languages(project_id) -language_codes = [l["code"] for l in languages if l["translations"]] +language_codes = [l["code"] for l in languages if l["percentage"] >= 50] for lc in language_codes: print(f"Downloading translation for {lc}") diff --git a/scripts/i18n_gettext.py b/scripts/i18n_gettext.py index 3e1a0c7..7cf6287 100644 --- a/scripts/i18n_gettext.py +++ b/scripts/i18n_gettext.py @@ -21,7 +21,7 @@ def add_to_pot_data(msgid, filename, lineno): pot_data[msgid].append((filename, lineno)) -for filename in glob.glob("../src/*.cs"): +for filename in glob.glob("../src/**/*.cs", recursive=True): with open(filename, 'r', encoding="utf8") as cs_file: if not filename.endswith(".Designer.cs"): msg_history = [] diff --git a/src/Localization.cs b/src/Localization.cs index aebeb68..63d3876 100644 --- a/src/Localization.cs +++ b/src/Localization.cs @@ -123,24 +123,25 @@ public static void TranslateForm(Form form) private static void LoadLanguages() { AddLanguage("Bahasa Indonesia", "id"); // Indonesian - AddLanguage("Čeština", "cs"); // Czech AddLanguage("Deutsch", "de"); // German AddLanguage("English", "en"); // English AddLanguage("Español", "es"); // Spanish AddLanguage("Français", "fr"); // French - AddLanguage("Eλληνικά", "el"); // Greek AddLanguage("Italiano", "it"); // Italian - AddLanguage("Македонски", "mk"); // Macedonian + AddLanguage("Nederlands", "nl"); // Dutch AddLanguage("Polski", "pl"); // Polish AddLanguage("Português (do Brasil)", "pt-br"); // Portuguese (BR) - AddLanguage("Română", "ro"); // Romanian AddLanguage("Pусский", "ru"); // Russian + AddLanguage("Română", "ro"); // Romanian AddLanguage("Türkçe", "tr"); // Turkish + AddLanguage("Čeština", "cs"); // Czech AddLanguage("Български", "bg"); // Bulgarian + AddLanguage("Македонски", "mk"); // Macedonian AddLanguage("हिन्दी", "hi"); // Hindi AddLanguage("বাংলা", "bn"); // Bengali AddLanguage("中文 (简体)", "zh-Hans"); // Chinese (Simplified) AddLanguage("日本語", "ja"); // Japanese + AddLanguage("한국어", "ko"); // Korean } private static void AddLanguage(string languageName, string languageCode) diff --git a/src/ThemeDialog.cs b/src/ThemeDialog.cs index 770975c..2e316f7 100644 --- a/src/ThemeDialog.cs +++ b/src/ThemeDialog.cs @@ -38,9 +38,14 @@ public ThemeDialog() Rectangle bounds = Screen.FromControl(this).Bounds; Size thumbnailSize = ThemeThumbLoader.GetThumbnailSize(this); - int newWidth = thumbnailSize.Width + SystemInformation.VerticalScrollBarWidth + 46; + int newWidth = thumbnailSize.Width + SystemInformation.VerticalScrollBarWidth; int oldWidth = this.listView1.Size.Width; + using (Graphics g = this.CreateGraphics()) + { + newWidth += (int)Math.Ceiling(46 * g.DpiX / 96); + } + this.previewerHost.Anchor &= ~AnchorStyles.Left; this.listView1.Width = newWidth; this.downloadButton.Left += (newWidth - oldWidth) / 2; @@ -48,7 +53,12 @@ public ThemeDialog() this.closeButton.Left += (newWidth - oldWidth) / 2; this.Width += (newWidth - oldWidth); this.previewerHost.Anchor |= AnchorStyles.Left; - this.Size = new Size(bounds.Width * 5 / 8, bounds.Height * 5 / 8); + + int heightDiff = this.Height - this.previewerHost.Height; + int widthDiff = this.Width - this.previewerHost.Width; + int bestHeight = bounds.Height * 5 / 8; + int bestWidth = (bestHeight - heightDiff) * bounds.Width / bounds.Height + widthDiff; + this.Size = new Size(bestWidth, bestHeight); this.CenterToScreen(); } diff --git a/src/WPF/ThemePreviewer.xaml b/src/WPF/ThemePreviewer.xaml index 597e9f1..f2b5bae 100644 --- a/src/WPF/ThemePreviewer.xaml +++ b/src/WPF/ThemePreviewer.xaml @@ -5,7 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="720" d:DesignWidth="1280" SnapsToDevicePixels="True" UseLayoutRounding="True" - Foreground="White" Background="Gray" BorderBrush="#828790" BorderThickness="1"> + Foreground="White" Background="Gray"> pack://application:,,,/resources/fonts/fontawesome-webfont.ttf#FontAwesome