<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:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:globalization="using:System.Globalization"
    mc:Ignorable="d">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <StackPanel Orientation="Vertical" Margin="10">
            <TextBlock x:Uid="/Translate/header" Text="Help us translate this app" FontSize="28"/>
            <TextBlock x:Uid="/Translate/description" TextWrapping="WrapWholeWords" Text="You can help us make this app even better by contributing to its development by translating this app" Margin="0,0,0,10"/>
            <TextBlock x:Uid="/Translate/guide0" Text="It's quite simple:" Margin="0,0,0,10"/>

            <ComboBox x:Uid="/Translate/guide1" Header="1. Choose language you want to translate" PlaceholderText="Choose language..." Name="LangList" Margin="0,0,0,10" MinWidth="350" SelectionChanged="LangList_SelectionChanged">
                <ComboBox.ItemTemplate>
                    <DataTemplate x:DataType="globalization:CultureInfo">
                        <TextBlock Text="{Binding DisplayName}" Tag="{Binding ThreeLetterISOLanguageName}"/>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>

            <TextBlock x:Uid="/Translate/guide2" Text="2. Save language pack file to your PC" Margin="0,0,0,10"/>

            <Button x:Uid="/Translate/export" Content="Export to PC (.zip)" Margin="0,0,0,10" Name="export" Click="export_Click" IsEnabled="False"/>

            <TextBlock x:Uid="/Translate/guide3" TextWrapping="WrapWholeWords" Text="3. Open archive's files with any text editor you want (Notepad, Wordpad, Notepad++, VS Code, etc.)" Margin="0,0,0,10"/>
            <TextBlock x:Uid="/Translate/guide4" TextWrapping="WrapWholeWords" Text="4. Edit file by translating nececcary words and sentences" Margin="0,0,0,10"/>
            <TextBlock x:Uid="/Translate/guide5" TextWrapping="WrapWholeWords" 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 x:Uid="/Translate/upload" Content="Choose file to upload" Margin="-1,0,0,10" HorizontalAlignment="Left" VerticalAlignment="Top" Name="upload" IsEnabled="False" Click="upload_Click"/>

            <Border Background="{ThemeResource SystemChromeMediumLowColor}" CornerRadius="10" Padding="10" HorizontalAlignment="Left" Name="certification" Visibility="Collapsed">
                <StackPanel>
                    <TextBlock x:Uid="/Translate/certHeader" FontWeight="Bold" Text="Package certification result"/>

                    <StackPanel Orientation="Horizontal" Margin="0,5" Name="certificationStatus">
                        <FontIcon Glyph="&#xEC61;" Foreground="Green"/>
                        <TextBlock Text="Passed" Margin="5,0"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Visibility="Visible">
                        <Button x:Uid="/Translate/submit" Content="Upload" Name="submit" Click="Submit_Click"/>
                        <Button x:Uid="/Translate/log" Content="View log" Name="log" Click="Log_Click"/>
                        <Button x:Uid="/Translate/choose" Content="Choose another file" Margin="10,0,0,0" Name="chooseFile" Click="upload_Click"/>
                    </StackPanel>
                    <ProgressBar HorizontalAlignment="Stretch" IsIndeterminate="True" Name="uploadingProgress" Visibility="Visible"/>
                </StackPanel>
            </Border>

            <TextBlock x:Uid="/Translate/info" TextWrapping="WrapWholeWords">
It takes about 2-3 weeks to process new language pack and include it to the next updateThank you for your help &#x1F61A;<LineBreak/>
Best wishes,</TextBlock>
            <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="&#xE76E;" FontSize="40" Foreground="Green" Margin="5"/>
                <StackPanel>
                    <TextBlock x:Uid="/Translate/success" Text="Your language pack has been sent!" Foreground="Green" FontWeight="Bold" FontSize="20"/>
                    <TextBlock x:Uid="/Translate/successSub" Text="Thank you! It's very imortant for us. You help us making the app better" Foreground="Green"/>
                </StackPanel>
            </StackPanel>
        </StackPanel>
    </Grid>
</Page>
