Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/multilang #88

Merged
merged 7 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/SmartCommander/Assets/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/SmartCommander/Assets/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,7 @@
<data name="TooLargeSize" xml:space="preserve">
<value>Too large file size for viewing.</value>
</data>
<data name="Reboot" xml:space="preserve">
<value>*Application restart required</value>
</data>
</root>
309 changes: 309 additions & 0 deletions src/SmartCommander/Assets/Resources.ru-RU.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,309 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema

Version 2.0

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>

There are any number of "resheader" rows that contain simple
name/value pairs.

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Alert" xml:space="preserve">
<value>Оповещение</value>
</data>
<data name="ArchiveExists" xml:space="preserve">
<value>Архив {0} уже существует.</value>
</data>
<data name="Cancel" xml:space="preserve">
<value>Отмена</value>
</data>
<data name="CantCopyFileToItself" xml:space="preserve">
<value>Невозможно скопировать файлы в ту же директорию</value>
</data>
<data name="CantEditFolder" xml:space="preserve">
<value>Невозможно редактировать папку</value>
</data>
<data name="CantMoveFileToItself" xml:space="preserve">
<value>Невозможно переместить файлы в ту же директорию</value>
</data>
<data name="CantMoveFolderHere" xml:space="preserve">
<value>Невозможно переместить папку сюда</value>
</data>
<data name="CantMoveFolderToItself" xml:space="preserve">
<value>Невозможно переместить папку в саму себя</value>
</data>
<data name="CantViewFolder" xml:space="preserve">
<value>Невозможно просмотреть папку</value>
</data>
<data name="CopyTo" xml:space="preserve">
<value>Скопировать {0} в:</value>
</data>
<data name="CreateNewFolder" xml:space="preserve">
<value>Создать новую папку</value>
</data>
<data name="CurrentDirectoryName" xml:space="preserve">
<value>Текущее имя директории</value>
</data>
<data name="CurrentDirInfo" xml:space="preserve">
<value>Файлов: {0}, папок: {1}.</value>
</data>
<data name="DarkTheme" xml:space="preserve">
<value>Тёмная тема</value>
</data>
<data name="Date" xml:space="preserve">
<value>Дата</value>
</data>
<data name="DeleteConfirmation" xml:space="preserve">
<value>Вы уверены, что хотите удалить {0}?</value>
</data>
<data name="DeleteConfirmationNonEmpty" xml:space="preserve">
<value>Папка не пуста. Вы уверены, что хотите удалить {0}?</value>
</data>
<data name="DisplayCommandLine" xml:space="preserve">
<value>Отобразить командную строку</value>
</data>
<data name="DisplayCurrentDirectory" xml:space="preserve">
<value>Отобразить текущую директорию</value>
</data>
<data name="DisplayFunctionKeys" xml:space="preserve">
<value>Отобразить функциональные клавиши</value>
</data>
<data name="DriveNotAvailable" xml:space="preserve">
<value>Диск недоступен</value>
</data>
<data name="Edit" xml:space="preserve">
<value>Редактировать</value>
</data>
<data name="ErrorNoPane" xml:space="preserve">
<value>Ошибка: панель не выбрана</value>
</data>
<data name="Extension" xml:space="preserve">
<value>Расширение</value>
</data>
<data name="F3View" xml:space="preserve">
<value>F3 Просмотр</value>
</data>
<data name="F4Edit" xml:space="preserve">
<value>F4 Редактирование</value>
</data>
<data name="F5Copy" xml:space="preserve">
<value>F5 Копировать</value>
</data>
<data name="F6Move" xml:space="preserve">
<value>F6 Переместить</value>
</data>
<data name="F7CreateNewFolder" xml:space="preserve">
<value>F7 Создать папку</value>
</data>
<data name="F8Delete" xml:space="preserve">
<value>F8 Удалить</value>
</data>
<data name="FileExistsRewrite" xml:space="preserve">
<value>Файл уже существует. Вы уверены, что хотите перезаписать {0}?</value>
</data>
<data name="Folder" xml:space="preserve">
<value>Папка</value>
</data>
<data name="FolderExists" xml:space="preserve">
<value>Папка уже существует</value>
</data>
<data name="ItemsNumber" xml:space="preserve">
<value>{0} элементов</value>
</data>
<data name="LightTheme" xml:space="preserve">
<value>Светлая тема</value>
</data>
<data name="MenuConfiguration" xml:space="preserve">
<value>_Конфигурация</value>
</data>
<data name="MenuExit" xml:space="preserve">
<value>_Выход</value>
</data>
<data name="MenuFile" xml:space="preserve">
<value>_Файл</value>
</data>
<data name="MenuOptions" xml:space="preserve">
<value>_Опции</value>
</data>
<data name="MenuSortByDate" xml:space="preserve">
<value>Сортировать по _дате</value>
</data>
<data name="MenuSortByExtension" xml:space="preserve">
<value>Сортировать по _расширению</value>
</data>
<data name="MenuSortByName" xml:space="preserve">
<value>Сортировать по _имени</value>
</data>
<data name="MenuSortBySize" xml:space="preserve">
<value>Сортировать по _размеру</value>
</data>
<data name="MenuView" xml:space="preserve">
<value>_Вид</value>
</data>
<data name="MoveTo" xml:space="preserve">
<value>Переместить {0} в:</value>
</data>
<data name="Name" xml:space="preserve">
<value>Имя</value>
</data>
<data name="NotFound" xml:space="preserve">
<value>Не найдено: </value>
</data>
<data name="OK" xml:space="preserve">
<value>ОК</value>
</data>
<data name="OperationInProgress" xml:space="preserve">
<value>Операция в процессе:</value>
</data>
<data name="Options" xml:space="preserve">
<value>Опции</value>
</data>
<data name="Save" xml:space="preserve">
<value>Сохранить</value>
</data>
<data name="SaveSettingsOnExit" xml:space="preserve">
<value>Сохранить настройки при выходе</value>
</data>
<data name="SaveWindowPositionSize" xml:space="preserve">
<value>Сохранить положение и размер окна</value>
</data>
<data name="ShowHiddenFiles" xml:space="preserve">
<value>Показать скрытые/системные файлы</value>
</data>
<data name="ShowNonEmptyConfirmation" xml:space="preserve">
<value>Показать подтверждение при удалении непустой папки</value>
</data>
<data name="Size" xml:space="preserve">
<value>Размер</value>
</data>
<data name="StopBackground" xml:space="preserve">
<value>Хотите остановить фоновую операцию?</value>
</data>
<data name="View" xml:space="preserve">
<value>Просмотр</value>
</data>
<data name="Zip" xml:space="preserve">
<value>Архивировать</value>
</data>
<data name="Unzip" xml:space="preserve">
<value>Разархивировать</value>
</data>
<data name="DirectoryExists" xml:space="preserve">
<value>Директория {0} уже существует.</value>
</data>
<data name="TooLargeSize" xml:space="preserve">
<value>Слишком большой размер файла для просмотра.</value>
</data>
<data name="Reboot" xml:space="preserve">
<value>*Требуется перезапуск приложения</value>
</data>
</root>
3 changes: 2 additions & 1 deletion src/SmartCommander/Models/OptionsModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static OptionsModel()
}
}
}
public void Save() => File.WriteAllText(_settingsPath, JsonConvert.SerializeObject(this));
public void Save() => File.WriteAllText(_settingsPath, JsonConvert.SerializeObject(this, Formatting.Indented));


public bool IsCurrentDirectoryDisplayed { get; set; } = true;
Expand Down Expand Up @@ -53,6 +53,7 @@ static OptionsModel()
public string RightPanePath { get; set; } = "";

public bool IsDarkThemeEnabled { get; set; }
public string Language { get; set; } = "en-US";

}
}
1 change: 1 addition & 0 deletions src/SmartCommander/SmartCommander.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<ItemGroup>
<AvaloniaResource Include="Assets\**" />
<AvaloniaResource Remove="Assets\Resources.resx" />
<AvaloniaResource Remove="Assets\Resources.ru-RU.resx" />
<None Remove=".gitignore" />
</ItemGroup>
<ItemGroup>
Expand Down
11 changes: 11 additions & 0 deletions src/SmartCommander/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using SmartCommander.Models;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Reactive;
Expand All @@ -19,7 +20,7 @@
{
public class MainWindowViewModel : ViewModelBase
{
public MainWindowViewModel()

Check warning on line 23 in src/SmartCommander/ViewModels/MainWindowViewModel.cs

View workflow job for this annotation

GitHub Actions / build-ubuntu-latest

Non-nullable property 'TabCommand' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 23 in src/SmartCommander/ViewModels/MainWindowViewModel.cs

View workflow job for this annotation

GitHub Actions / build-ubuntu-latest

Non-nullable property 'SelectedPane' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 23 in src/SmartCommander/ViewModels/MainWindowViewModel.cs

View workflow job for this annotation

GitHub Actions / build-windows-latest

Non-nullable property 'TabCommand' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 23 in src/SmartCommander/ViewModels/MainWindowViewModel.cs

View workflow job for this annotation

GitHub Actions / build-windows-latest

Non-nullable property 'SelectedPane' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
{
ShowCopyDialog = new Interaction<CopyMoveViewModel, CopyMoveViewModel?>();
ShowOptionsDialog = new Interaction<OptionsViewModel, OptionsViewModel?>();
Expand Down Expand Up @@ -52,9 +53,19 @@
{
RightFileViewModel.CurrentDirectory = OptionsModel.Instance.RightPanePath;
}
SetLanguage();
SetTheme();
_progress = new Progress<int>(v => Progress_Show(v));
}

private void SetLanguage()
{
var cultureName = OptionsModel.Instance.Language;
var culture = new CultureInfo(cultureName);
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
}

private void OnFocusChanged(object? sender, EventArgs e)
{
if (sender is FilesPaneViewModel)
Expand Down
Loading
Loading