1
0
mirror of https://github.com/chylex/Backup-Essentials.git synced 2025-06-02 06:34:08 +02:00

Everything should be translateable now

This commit is contained in:
chylex 2015-05-01 15:19:58 +02:00
parent bf956de18e
commit 51d3e45586
9 changed files with 58 additions and 25 deletions

View File

@ -55,7 +55,7 @@ namespace BackupEssentials{
if (parser.HasFlag("nohide"))window.WindowState = WindowState.Normal; if (parser.HasFlag("nohide"))window.WindowState = WindowState.Normal;
window.Show(); window.Show();
} }
else throw new ArgumentException("Backup could not begin, destination is empty. Program arguments: "+string.Join(" ",args.Args)); else throw new ArgumentException(Sys.Settings.Default.Language["General.App.DestinationMissing",string.Join(" ",args.Args)]);
} }
else if (parser.HasFlag("runcompat")){ else if (parser.HasFlag("runcompat")){
MainWindow window = new MainWindow(); MainWindow window = new MainWindow();

View File

@ -1,4 +1,5 @@
using BackupEssentials.Utils; using BackupEssentials.Sys;
using BackupEssentials.Utils;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -57,8 +58,8 @@ namespace BackupEssentials.Backup{
} }
void StringDictionarySerializer.IObjectToDictionary.FromDictionary(SafeDictionary<string,string> dict){ void StringDictionarySerializer.IObjectToDictionary.FromDictionary(SafeDictionary<string,string> dict){
Name = dict["Name"] ?? "<unknown>"; Name = dict["Name"] ?? Settings.Default.Language["Backup.Location.UnknownName"];
Directory = dict["Dir"] ?? "<unknown>"; Directory = dict["Dir"] ?? Settings.Default.Language["Backup.Location.UnknownDirectory"];
} }
public enum DirectoryStatus{ public enum DirectoryStatus{

View File

@ -69,11 +69,11 @@ namespace BackupEssentials.Backup{
// Verify source files // Verify source files
if (srcParent == null){ if (srcParent == null){
throw new Exception("Cannot backup multiple locations!"); throw new Exception(Settings.Default.Language["BackupWindow.Error.MultipleLocations"]);
} }
for(int a = 1; a < src.Length; a++){ for(int a = 1; a < src.Length; a++){
if (!Directory.GetParent(src[a]).FullName.Equals(srcParent))throw new Exception("Cannot backup multiple locations!"); if (!Directory.GetParent(src[a]).FullName.Equals(srcParent))throw new Exception(Settings.Default.Language["BackupWindow.Error.MultipleLocations"]);
} }
if (srcParent[srcParent.Length-1] == '\\')srcParent = srcParent.Substring(0,srcParent.Length-1); if (srcParent[srcParent.Length-1] == '\\')srcParent = srcParent.Substring(0,srcParent.Length-1);

View File

@ -4,6 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:system="clr-namespace:BackupEssentials.Sys"
xmlns:custom="clr-namespace:BackupEssentials.Controls" xmlns:custom="clr-namespace:BackupEssentials.Controls"
xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
mc:Ignorable="d" x:Class="BackupEssentials.BackupWindow" mc:Ignorable="d" x:Class="BackupEssentials.BackupWindow"
@ -21,12 +22,12 @@
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label x:Name="LabelInfo" Content="Preparing backup..." HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="#FFDDDDDD" FontSize="18"/> <Label x:Name="LabelInfo" Content="" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="#FFDDDDDD" FontSize="18"/>
<ProgressBar x:Name="ProgressBar" Margin="8,0" Grid.Row="1"/> <ProgressBar x:Name="ProgressBar" Margin="8,0" Grid.Row="1"/>
<WrapPanel Grid.Row="2" Orientation="Horizontal" Margin="8,12,8,0" HorizontalAlignment="Right"> <WrapPanel Grid.Row="2" Orientation="Horizontal" Margin="8,12,8,0" HorizontalAlignment="Right" DataContext="{Binding Source={x:Static system:Settings.Default}}">
<Button x:Name="ButtonShowReport" Template="{StaticResource ButtonStyleDefault}" Content="Show report" IsEnabled="False" Margin="0,0,8,0" FontSize="16" Click="ButtonShowReportClick" Width="115"/> <Button x:Name="ButtonShowReport" Template="{StaticResource ButtonStyleDefault}" Content="{Binding Language[BackupWindow.Button.ShowReport]}" IsEnabled="False" Margin="0,0,8,0" FontSize="16" Click="ButtonShowReportClick"/>
<Button x:Name="ButtonEnd" Template="{StaticResource ButtonStyleRedDefault}" Content="Cancel" FontSize="16" Click="ButtonEndClick" Width="85"/> <Button x:Name="ButtonEnd" Template="{StaticResource ButtonStyleRedDefault}" Content="{Binding Language[BackupWindow.Button.Cancel]}" FontSize="16" Click="ButtonEndClick"/>
</WrapPanel> </WrapPanel>
</Grid> </Grid>
</DockPanel> </DockPanel>

View File

@ -4,6 +4,7 @@ using BackupEssentials.Sys;
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using System.Windows; using System.Windows;
using System.Windows.Shell; using System.Windows.Shell;
using System.Windows.Threading; using System.Windows.Threading;
@ -22,7 +23,7 @@ namespace BackupEssentials{
TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Indeterminate; TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Indeterminate;
ProgressBar.IsIndeterminate = true; ProgressBar.IsIndeterminate = true;
LabelInfo.Content = "Preparing backup..."; LabelInfo.Content = Settings.Default.Language["BackupWindow.Run.Preparing"];
runner.EventProgressUpdate = WorkerProgressUpdate; runner.EventProgressUpdate = WorkerProgressUpdate;
runner.EventCompleted = WorkerCompleted; runner.EventCompleted = WorkerCompleted;
@ -39,7 +40,7 @@ namespace BackupEssentials{
Closing += (sender, args) => { Closing += (sender, args) => {
if (HistoryGenWorker != null){ if (HistoryGenWorker != null){
if (MessageBox.Show(App.Window,"The history entry has not been generated yet, do you want to close the window anyways?","History entry is generating",MessageBoxButton.YesNo,MessageBoxImage.Warning) == MessageBoxResult.No){ if (MessageBox.Show(App.Window,Settings.Default.Language["BackupWindow.HistoryGenWarning"],Settings.Default.Language["BackupWindow.HistoryGenWarning.Title"],MessageBoxButton.YesNo,MessageBoxImage.Warning) != MessageBoxResult.Yes){
args.Cancel = true; args.Cancel = true;
} }
} }
@ -56,7 +57,7 @@ namespace BackupEssentials{
ProgressBar.Value = e.ProgressPercentage; ProgressBar.Value = e.ProgressPercentage;
} }
LabelInfo.Content = "Processing the files and folders..."; LabelInfo.Content = Settings.Default.Language["BackupWindow.Run.Processing"];
if (e.ProgressPercentage == 0 && e.UserState is int){ if (e.ProgressPercentage == 0 && e.UserState is int){
ActionCount = (int)e.UserState; ActionCount = (int)e.UserState;
@ -66,7 +67,7 @@ namespace BackupEssentials{
private void WorkerCompleted(object sender, RunWorkerCompletedEventArgs e){ private void WorkerCompleted(object sender, RunWorkerCompletedEventArgs e){
ButtonShowReport.IsEnabled = true; ButtonShowReport.IsEnabled = true;
ButtonEnd.Content = "Close"; ButtonEnd.Content = Settings.Default.Language["BackupWindow.Button.Close"];
Report = e.Result as BackupReport; Report = e.Result as BackupReport;
Settings settings = Settings.Default; Settings settings = Settings.Default;
@ -76,7 +77,7 @@ namespace BackupEssentials{
HistoryGenWorker = null; HistoryGenWorker = null;
if (historyArgs.Result == null){ if (historyArgs.Result == null){
App.LogException(historyArgs.Error == null ? new Exception("History generation failed (no stack trace)") : new Exception("History generation failed",historyArgs.Error)); App.LogException(historyArgs.Error == null ? new Exception(Settings.Default.Language["BackupWindow.Error.HistoryGenFailedNoTrace"]) : new Exception(Settings.Default.Language["History generation failed"],historyArgs.Error));
} }
}); });
} }
@ -94,7 +95,7 @@ namespace BackupEssentials{
ProgressBar.Value = 100; ProgressBar.Value = 100;
ProgressBar.Value = 99; // progress bar animation hack ProgressBar.Value = 99; // progress bar animation hack
ProgressBar.Value = 100; ProgressBar.Value = 100;
LabelInfo.Content = "Finished! Updated "+ActionCount+" files and folders."; LabelInfo.Content = Settings.Default.Language["BackupWindow.Run.Finished.",ActionCount,ActionCount.ToString(CultureInfo.InvariantCulture)];
int closeTime = Settings.Default.WindowCloseTime.Value; int closeTime = Settings.Default.WindowCloseTime.Value;
if (closeTime == -1)return; if (closeTime == -1)return;

View File

@ -1,4 +1,5 @@
using BackupEssentials.Backup.History; using BackupEssentials.Backup.History;
using BackupEssentials.Sys;
using BackupEssentials.Utils; using BackupEssentials.Utils;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -86,8 +87,8 @@ namespace BackupEssentials.Backup.Data{
} }
public static void Save(bool force){ public static void Save(bool force){
if (!IsSetupForSaving)throw new NotSupportedException("DataStorage was not initialized for saving!"); if (!IsSetupForSaving)throw new NotSupportedException(Settings.Default.Language["General.Storage.ErrorSaving"]);
else if (SaveTimer == null && !force)throw new NotSupportedException("DataStorage was not initialized for scheduled saving!"); else if (SaveTimer == null && !force)throw new NotSupportedException(Settings.Default.Language["General.Storage.ErrorScheduledSaving"]);
if (!force){ if (!force){
SaveTimer.NeedsUpdate = true; SaveTimer.NeedsUpdate = true;

View File

@ -16,10 +16,12 @@ namespace BackupEssentials.Pages{
StringBuilder build = new StringBuilder(); StringBuilder build = new StringBuilder();
OperatingSystem os = Environment.OSVersion; OperatingSystem os = Environment.OSVersion;
build.Append("You are using ").Append(WindowsVersion.Get()).Append(' '); build.Append(WindowsVersion.Get()).Append(' ').Append(Environment.Is64BitOperatingSystem ? "x64" : "x86").Append(' ').Append(os.ServicePack.Replace("Service Pack ","SP"));
build.Append(Environment.Is64BitOperatingSystem ? "x64" : "x86").Append(' '); string version = build.ToString();
build.Append(os.ServicePack.Replace("Service Pack ","SP")).Append(' ');
build.Append(WindowsVersion.IsFullySupported() ? "(supported)." : "(not supported)."); build.Clear();
build.Append(Sys.Settings.Default.Language["About.WinVersion.Using",version]).Append(' ');
build.Append(Sys.Settings.Default.Language[WindowsVersion.IsFullySupported() ? "About.WinVersion.Supported" : "About.WinVersion.Unsupported"]);
AboutTextOS.Text = build.ToString(); AboutTextOS.Text = build.ToString();
} }

View File

@ -5,6 +5,10 @@ General.App.AlreadyRunning = The application is already running, but is not resp
General.App.AlreadyRunning.Title = Application is already running General.App.AlreadyRunning.Title = Application is already running
General.App.CannotClose = Could not close the application: $0 General.App.CannotClose = Could not close the application: $0
General.App.CannotClose.Title = Error closing application General.App.CannotClose.Title = Error closing application
General.App.DestinationMissing = Backup could not begin, destination is empty. Program arguments: $0
General.Storage.ErrorSaving = DataStorage was not initialized for saving!
General.Storage.ErrorScheduledSaving = DataStorage was not initialized for scheduled saving!
General.UI.MenuButton.Home = Home General.UI.MenuButton.Home = Home
General.UI.MenuButton.Backup = Backup General.UI.MenuButton.Backup = Backup
@ -21,6 +25,9 @@ Backup.Button.Add = Add location
Backup.Button.Edit = Edit Backup.Button.Edit = Edit
Backup.Button.Remove = Remove Backup.Button.Remove = Remove
Backup.Location.UnknownName = (unknown)
Backup.Location.UnknownDirectory = (unknown)
BackupEdit.Label.Name = Name: BackupEdit.Label.Name = Name:
BackupEdit.Label.Directory = Directory: BackupEdit.Label.Directory = Directory:
BackupEdit.Label.AdvancedSettings = Show advanced settings BackupEdit.Label.AdvancedSettings = Show advanced settings
@ -118,10 +125,15 @@ Settings.Option.DateFormat.Detect = Detect ($0)
# PAGE - ABOUT # # PAGE - ABOUT #
#==============# #==============#
About.Version = Version About.Version = Version
About.Version.Unknown = <unknown> About.Version.Unknown = (unknown)
About.Author = Designed and programmed by chylex. About.Author = Designed and programmed by chylex.
About.License = Product license information About.License = Product license information
About.WinVersion.Using = You are using $0
About.WinVersion.Supported = (supported).
About.WinVersion.Unsupported (not supported).
About.WinVersion.Unknown = (unknown)
About.Support = Support: About.Support = Support:
About.Support.Link = Issues on GitHub About.Support.Link = Issues on GitHub
About.OfficialWebsite = Visit the official website: About.OfficialWebsite = Visit the official website:
@ -131,7 +143,21 @@ About.Twitter = Follow me on Twitter:
#=================# #=================#
# BACKUP - WINDOW # # BACKUP - WINDOW #
#=================# #=================#
BackupWindow.Button.ShowReport = Show report
BackupWindow.Button.Cancel = Cancel
BackupWindow.Button.Close = Close
BackupWindow.Run.Preparing = Preparing backup...
BackupWindow.Run.Processing = Processing the files and folders...
BackupWindow.Run.Finished.* = Finished! Updated $0 files and folder.
BackupWindow.Run.Finished.1 = Finished! Updated 1 file or folder.
BackupWindow.Error.MultipleLocations = Cannot backup multiple locations in different folders!
BackupWindow.Error.HistoryGenFailed = History generation failed
BackupWindow.Error.HistoryGenFailedNoTrace = History generation failed (unknown error)
BackupWindow.HistoryGenWarning.Title = History entry is generating
BackupWindow.HistoryGenWarning = The history entry has not been generated yet, do you want to close the window anyways?
#==================# #==================#
# BACKUP - REPORTS # # BACKUP - REPORTS #

View File

@ -1,4 +1,5 @@
using Microsoft.Win32; using BackupEssentials.Sys;
using Microsoft.Win32;
using System; using System;
namespace BackupEssentials.Utils{ namespace BackupEssentials.Utils{
@ -13,7 +14,7 @@ namespace BackupEssentials.Utils{
if (key != null)return CachedVersionName = (string)key.GetValue("ProductName"); if (key != null)return CachedVersionName = (string)key.GetValue("ProductName");
}catch{} }catch{}
return CachedVersionName = (GetFromEnvironment() ?? "(unknown)"); return CachedVersionName = (GetFromEnvironment() ?? Settings.Default.Language["About.WinVersion.Unknown"]);
} }
private static string GetFromEnvironment(){ private static string GetFromEnvironment(){