From 0761c794bc7d5bdf0ab0bf5e64ce47007432a126 Mon Sep 17 00:00:00 2001 From: Michael Gordeev Date: Mon, 1 Jul 2019 23:14:40 +0300 Subject: [PATCH] Updated locales --- FoxTube.Background/BackgroundProcessor.cs | 2 +- FoxTube/App.xaml.cs | 2 ++ FoxTube/Classes/SettingsStorage.cs | 16 +++++++++++++--- FoxTube/Pages/SettingsPages/Inbox.xaml.cs | 15 ++++++++++++--- FoxTube/Strings/en-US/CommentsPage.resw | 4 ++-- FoxTube/Strings/en-US/Downloads.resw | 2 +- FoxTube/Strings/en-US/VideoPage.resw | 2 +- 7 files changed, 32 insertions(+), 11 deletions(-) diff --git a/FoxTube.Background/BackgroundProcessor.cs b/FoxTube.Background/BackgroundProcessor.cs index 34b55d2..83ff2c7 100644 --- a/FoxTube.Background/BackgroundProcessor.cs +++ b/FoxTube.Background/BackgroundProcessor.cs @@ -107,7 +107,7 @@ namespace FoxTube.Background foreach (Subscription item in subscriptions) { SearchResource.ListRequest request = service.Search.List("snippet"); - request.PublishedAfter = lastCheck.Subtract(TimeSpan.FromDays(1)); + request.PublishedAfter = lastCheck; request.ChannelId = item.Snippet.ResourceId.ChannelId; request.Type = "video"; request.MaxResults = 5; diff --git a/FoxTube/App.xaml.cs b/FoxTube/App.xaml.cs index 81ef8e7..09122f7 100644 --- a/FoxTube/App.xaml.cs +++ b/FoxTube/App.xaml.cs @@ -22,6 +22,8 @@ namespace FoxTube { sealed partial class App : Application { + public static string[] AvailableLanguages => new[] { "en-US", "ru-RU" }; + Stopwatch sw = new Stopwatch(); public App() { diff --git a/FoxTube/Classes/SettingsStorage.cs b/FoxTube/Classes/SettingsStorage.cs index db64941..1c68b7a 100644 --- a/FoxTube/Classes/SettingsStorage.cs +++ b/FoxTube/Classes/SettingsStorage.cs @@ -24,9 +24,9 @@ namespace FoxTube public bool autoplay = true; public double volume = 100; - public string language = (new[] { "ua", "ru", "by", "kz", "kg", "md", "lv", "ee" }).Contains(CultureInfo.InstalledUICulture.TwoLetterISOLanguageName) ? "ru-RU" : "en-US"; - public string relevanceLanguage = (new[] { "ua", "ru", "by", "kz", "kg", "md", "lv", "ee" }).Contains(CultureInfo.InstalledUICulture.TwoLetterISOLanguageName) ? "ru" : "en"; - public string region = (new[] { "ua", "ru", "by", "kz", "kg", "md", "lv", "ee" }).Contains(CultureInfo.InstalledUICulture.TwoLetterISOLanguageName) ? "ru" : "us"; + public string language = GetLanguage(); + public string relevanceLanguage = CultureInfo.InstalledUICulture.TwoLetterISOLanguageName; + public string region = CultureInfo.InstalledUICulture.Name.Split('-')[1]; public int safeSearch = 0; public bool hasAccount = false; @@ -38,6 +38,16 @@ namespace FoxTube public bool processClipboard = true; public bool minimizeCommandbar = false; + + private static string GetLanguage() + { + if (App.AvailableLanguages.Contains(CultureInfo.InstalledUICulture.Name)) + return CultureInfo.InstalledUICulture.Name; + else if ((new[] { "ua", "ru", "by", "kz", "kg", "md", "lv", "ee" }).Contains(CultureInfo.InstalledUICulture.TwoLetterISOLanguageName)) + return "ru-RU"; + else + return "en-US"; + } } public static class SettingsStorage diff --git a/FoxTube/Pages/SettingsPages/Inbox.xaml.cs b/FoxTube/Pages/SettingsPages/Inbox.xaml.cs index de60f58..41804b9 100644 --- a/FoxTube/Pages/SettingsPages/Inbox.xaml.cs +++ b/FoxTube/Pages/SettingsPages/Inbox.xaml.cs @@ -8,6 +8,7 @@ using FoxTube.Classes; using Windows.Storage; using System.Xml; using Microsoft.AppCenter.Analytics; +using System.Globalization; namespace FoxTube.Pages.SettingsPages { @@ -23,6 +24,14 @@ namespace FoxTube.Pages.SettingsPages InitializeComponent(); } + string GetLanguage() + { + if ((new[] { "ua", "ru", "by", "kz", "kg", "md", "lv", "ee" }).Contains(CultureInfo.InstalledUICulture.TwoLetterISOLanguageName)) + return "ru-RU"; + else + return "en-US"; + } + public async void LoadItems(string id = null) { try @@ -34,14 +43,14 @@ namespace FoxTube.Pages.SettingsPages foreach (XmlElement e in doc["items"].ChildNodes) items.Add(new InboxItem( e.GetAttribute("version"), - e["content"][SettingsStorage.Language].InnerText, + e["content"][GetLanguage()].InnerText, DateTime.Parse(e.GetAttribute("time"), System.Globalization.CultureInfo.GetCultureInfo("en-US").DateTimeFormat))); doc.Load("http://foxgame-studio.000webhostapp.com/foxtube-messages.xml"); foreach (XmlElement e in doc["posts"].ChildNodes) items.Add(new InboxItem( - e["header"][SettingsStorage.Language].InnerText, - e["content"][SettingsStorage.Language].InnerText, + e["header"][GetLanguage()].InnerText, + e["content"][GetLanguage()].InnerText, DateTime.Parse(e.GetAttribute("time"), System.Globalization.CultureInfo.GetCultureInfo("en-US").DateTimeFormat), e["id"].InnerText, e["contentHeader"].InnerText)); diff --git a/FoxTube/Strings/en-US/CommentsPage.resw b/FoxTube/Strings/en-US/CommentsPage.resw index be9ffda..3c3da4c 100644 --- a/FoxTube/Strings/en-US/CommentsPage.resw +++ b/FoxTube/Strings/en-US/CommentsPage.resw @@ -145,10 +145,10 @@ Submit - Failed to delete your commentary. Please, try again later. + Failed to delete your comment. Please, try again later. - Failed to edit your commentary. Please, try again later. + Failed to edit your comment. Please, try again later. Failed to send your reply. Please, try again later. diff --git a/FoxTube/Strings/en-US/Downloads.resw b/FoxTube/Strings/en-US/Downloads.resw index 930816e..9e6a9b1 100644 --- a/FoxTube/Strings/en-US/Downloads.resw +++ b/FoxTube/Strings/en-US/Downloads.resw @@ -142,7 +142,7 @@ Bug report has been sent - Error occured while dowloading a video + Error occurred while downloading a video Go to original diff --git a/FoxTube/Strings/en-US/VideoPage.resw b/FoxTube/Strings/en-US/VideoPage.resw index 64bfb73..a0ae3f0 100644 --- a/FoxTube/Strings/en-US/VideoPage.resw +++ b/FoxTube/Strings/en-US/VideoPage.resw @@ -175,7 +175,7 @@ Go to live broadcast - This content may be not apropriate for children under 18 + This content may be not appropriate for children under 18 Maximize