Everything is fucked up
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
<Page
|
||||
x:Class="FoxTube.Pages.SettingsPages.Translate"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:FoxTube"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<StackPanel Orientation="Vertical" Margin="10">
|
||||
<TextBlock Text="Help us translate this app" FontSize="28"/>
|
||||
<TextBlock TextWrapping="WrapWholeWords" Text="You can help us make this app even better by contributing to its development by translating this app. You can choose a brand new language to translate or edit mistakes in existing translations." Margin="0,0,0,10"/>
|
||||
<StackPanel BorderThickness="2" BorderBrush="OrangeRed" MaxWidth="500" HorizontalAlignment="Left" Margin="0,0,0,10" Padding="0,0,0,3">
|
||||
<TextBlock Foreground="OrangeRed" FontWeight="SemiBold" TextWrapping="WrapWholeWords" Text="Attention! This tool is used to help us to provide our app to more people from other countries. Please, don't send not done language packs. Thanks in advance ;)" Margin="5"/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="It's quite simple:" Margin="0,0,0,10"/>
|
||||
|
||||
<ComboBox Header="1. Choose language you want to translate" PlaceholderText="Choose language..." Name="LangList" Margin="0,0,0,10" MinWidth="350" SelectionChanged="LangList_SelectionChanged"/>
|
||||
|
||||
<TextBlock Text="2. Import language pack file to your PC" Margin="0,0,0,10"/>
|
||||
|
||||
<Button Content="Export to PC (.xml)" Margin="0,0,0,10" Name="export" Click="export_Click" IsEnabled="False"/>
|
||||
|
||||
<TextBlock TextWrapping="WrapWholeWords" Text="3. Open file with any text editor you want (Notepad, Wordpad, Notepad++, VS Code, etc.)" Margin="0,0,0,10"/>
|
||||
<TextBlock TextWrapping="WrapWholeWords" Text="4. Edit file by translating nececcary words and sentences" Margin="0,0,0,10"/>
|
||||
<TextBlock Text="5. Upload final package to our servers" Margin="0,0,0,10"/>
|
||||
|
||||
<StackPanel Name="submitNotification" Visibility="Collapsed" BorderThickness="2" BorderBrush="OrangeRed" Width="350" HorizontalAlignment="Left" Margin="0,0,0,10" Padding="0,0,0,3">
|
||||
<TextBlock Foreground="OrangeRed" FontWeight="SemiBold" Text="Attention! Once you submitted this language pack you won't be able to contribute to the language anymore. Think twice before continuing" TextWrapping="WrapWholeWords" Margin="5"/>
|
||||
</StackPanel>
|
||||
<Button Content="Choose file to upload" Margin="-1,0,0,10" HorizontalAlignment="Left" VerticalAlignment="Top" Name="upload" IsEnabled="False" Click="upload_Click"/>
|
||||
<ProgressBar Width="250" HorizontalAlignment="Left" IsIndeterminate="True" Name="uploadingProgress" Visibility="Collapsed"/>
|
||||
<TextBlock TextWrapping="WrapWholeWords" Text="It takes about 2-3 weeks to process new language pack and include it to the next update" Margin="0,0,0,10"/>
|
||||
<TextBlock Text="Thank you for your help 😚"/>
|
||||
<TextBlock Text="Best wishes,"/>
|
||||
<TextBlock Text=" XFox"/>
|
||||
<StackPanel Orientation="Horizontal" BorderBrush="Green" BorderThickness="5" Margin="0,10,30,0" Visibility="Collapsed" Name="greenResult">
|
||||
<TextBlock FontFamily="Segoe MDL2 Assets" Text="" FontSize="40" Foreground="Green" Margin="5"/>
|
||||
<StackPanel>
|
||||
<TextBlock Text="Your language pack has been sent!" Foreground="Green" FontWeight="Bold" FontSize="20"/>
|
||||
<TextBlock Text="Thank you! It's very imortant for us. Thank you for helping us making the app better" Foreground="Green"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" BorderBrush="OrangeRed" BorderThickness="5" Margin="0,10,30,0" Visibility="Collapsed" Name="denied">
|
||||
<TextBlock FontFamily="Segoe MDL2 Assets" Text="" FontSize="40" Foreground="OrangeRed" Margin="5"/>
|
||||
<StackPanel>
|
||||
<TextBlock Text="You have already contributed to this language" Foreground="OrangeRed" FontWeight="Bold" FontSize="20"/>
|
||||
<TextBlock Text="To prevent spaming our mailbox we allow our users to contribute to each language only 1 time" Foreground="OrangeRed"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -1,125 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using Windows.Storage.Pickers;
|
||||
using Windows.Storage;
|
||||
using System.Net.Mail;
|
||||
using System.Net;
|
||||
using Windows.UI.Popups;
|
||||
|
||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace FoxTube.Pages.SettingsPages
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class Translate : Page
|
||||
{
|
||||
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
|
||||
int selectedLanguage;
|
||||
public Translate()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.AllCultures))
|
||||
LangList.Items.Add(culture.DisplayName);
|
||||
}
|
||||
|
||||
private async void export_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FileSavePicker picker = new FileSavePicker();
|
||||
picker.CommitButtonText = "Export";
|
||||
picker.DefaultFileExtension = ".xml";
|
||||
picker.SuggestedFileName = "foxtube_langpack_" + CultureInfo.GetCultures(CultureTypes.AllCultures)[selectedLanguage];
|
||||
picker.SuggestedStartLocation = PickerLocationId.Desktop;
|
||||
picker.FileTypeChoices.Add("Language pack scheme", new List<string>() { ".xml" });
|
||||
|
||||
StorageFile file = await picker.PickSaveFileAsync();
|
||||
if(file != null)
|
||||
await FileIO.WriteTextAsync(file, GetPackage(selectedLanguage));
|
||||
}
|
||||
|
||||
private void LangList_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
selectedLanguage = LangList.SelectedIndex;
|
||||
|
||||
greenResult.Visibility = Visibility.Collapsed;
|
||||
denied.Visibility = Visibility.Collapsed;
|
||||
|
||||
if (settings.Values[CultureInfo.GetCultures(CultureTypes.AllCultures)[selectedLanguage] + "_sent"] == null)
|
||||
{
|
||||
export.IsEnabled = true;
|
||||
upload.IsEnabled = true;
|
||||
submitNotification.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
export.IsEnabled = false;
|
||||
upload.IsEnabled = false;
|
||||
denied.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
private async void upload_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FileOpenPicker picker = new FileOpenPicker()
|
||||
{
|
||||
CommitButtonText = "Upload",
|
||||
SuggestedStartLocation = PickerLocationId.Desktop
|
||||
};
|
||||
picker.FileTypeFilter.Clear();
|
||||
picker.FileTypeFilter.Add(".xml");
|
||||
|
||||
StorageFile file = await picker.PickSingleFileAsync();
|
||||
if (file != null)
|
||||
{
|
||||
MailMessage msg = new MailMessage();
|
||||
msg.To.Add("foxgameofficial+foxtube@gmail.com");
|
||||
msg.From = new MailAddress("foxgameofficial+foxtube@gmail.com");
|
||||
msg.Subject = "FoxTube language pack contribution";
|
||||
msg.Body = string.Format("Language: {0}\nLanguage code: {1}", CultureInfo.GetCultures(CultureTypes.AllCultures)[selectedLanguage].EnglishName, CultureInfo.GetCultures(CultureTypes.AllCultures)[selectedLanguage]);
|
||||
msg.Attachments.Add(new Attachment(file.Path));
|
||||
|
||||
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
|
||||
client.EnableSsl = true;
|
||||
client.Credentials = SecretsVault.EmailCredential;
|
||||
|
||||
upload.IsEnabled = false;
|
||||
export.IsEnabled = false;
|
||||
uploadingProgress.Visibility = Visibility.Visible;
|
||||
try
|
||||
{
|
||||
client.Send(msg);
|
||||
greenResult.Visibility = Visibility.Visible;
|
||||
submitNotification.Visibility = Visibility.Collapsed;
|
||||
settings.Values.Add(CultureInfo.GetCultures(CultureTypes.AllCultures)[selectedLanguage] + "_sent", true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageDialog message = new MessageDialog("We were unable to send your feedback due to connection problems or internal server error. Please, try again later.", "Failed to send your feedback");
|
||||
await message.ShowAsync();
|
||||
export.IsEnabled = true;
|
||||
upload.IsEnabled = true;
|
||||
}
|
||||
uploadingProgress.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetPackage(int cultureIndex)
|
||||
{
|
||||
return "langpack";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user