Skip to content

Commit 0c098e3

Browse files
Перевод раздела «Ресурсы (Assets) и изображения» на русский язык (#702)
Co-authored-by: Terentev A. A. <[email protected]>
1 parent 0b4d2ce commit 0c098e3

File tree

1 file changed

+24
-24
lines changed
  • i18n/ru/docusaurus-plugin-content-docs/current/basics/user-interface

1 file changed

+24
-24
lines changed
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,83 @@
11
---
22
id: assets
3-
title: Assets and Images
3+
title: Ресурсы (Assets) и изображения
44
---
55

66
import AssetFileDiagram from '/img/basics/user-interface/asset-file.png';
77
import AssetLibraryDiagram from '/img/basics/user-interface/asset-library.png';
88

9-
# Assets
9+
# Ресурсы (Assets)
1010

11-
Many applications need to include assets such as bitmaps, styles and resource dictionaries. Resource dictionaries contain graphical fundamentals that can be declared in XAML. Styles can also be written in XAML, but bitmap assets are binary files, for example PNG and JPEG formats.
11+
Многим приложениям необходимо включать ресурсы, такие как растровые изображения, стили и словари ресурсов. Словари ресурсов содержат графические базовые элементы, которые могут быть объявлены в XAML. Стили также могут быть написаны в XAML, но растровые изображения - это бинарные файлы, например, форматы PNG и JPEG.
1212

13-
## Including assets
13+
## Включение ресурсов
1414

1515
<img src={AssetFileDiagram} alt=''/>
1616

17-
You include assets in an application by using the `<AvaloniaResource>` element in your project file.
17+
Вы включаете ресурсы (Assets) в приложение, используя элемент `<AvaloniaResource>` в файле проекта.
1818

19-
For example, the Avalonia .NET Core MVVM App solution template creates a folder called `Assets` (containing the `avalonia-logo.ico` file) and adds an element to the project file to include any files located there. As follows:
19+
Например, шаблон решения Avalonia .NET Core MVVM App создает папку с названием `Assets` (содержащую файл `avalonia-logo.ico`) и добавляет элемент в файл проекта для включения всех файлов, расположенных там. Следующим образом:
2020

2121
```xml
2222
<ItemGroup>
2323
<AvaloniaResource Include="Assets\**"/>
2424
</ItemGroup>
2525
```
2626

27-
You can include whatever files you want by adding additional `<AvaloniaResource>` elements in this item group.
27+
Вы можете включить любые файлы, добавив дополнительные элементы `<AvaloniaResource>` в эту группу элементов.
2828

2929
:::tip
30-
The element name `AvaloniaResource` here only indicates that the assets will be internally stored as .NET resources by the build. However, in _Avalonia UI_ terms, these files are called 'Assets' to distinguish them from 'XAML resources'.
30+
Имя элемента `AvaloniaResource` здесь только указывает, что ресурсы будут внутренне храниться как ресурсы .NET при сборке. Однако, в терминологии _Avalonia UI_, эти файлы называются 'Ресурсы' (Assets), чтобы отличать их от 'XAML-ресурсов'.
3131
:::
3232

3333

34-
### Referencing Included Assets
34+
### Ссылки на включенные ресурсы
3535

36-
Once asset files are included, they can be referenced as needed in the XAML that defines your UI. For example, these assets are referenced by specifying their relative path:
36+
После включения файлов ресурсов на них можно ссылаться по мере необходимости в XAML, определяющем ваш UI. Например, на эти ресурсы можно ссылаться, указав их относительный путь:
3737

3838
```xml
3939
<Image Source="icon.png"/>
4040
<Image Source="images/icon.png"/>
4141
<Image Source="../icon.png"/>
4242
```
4343

44-
As an alternative, you can use the rooted path:
44+
В качестве альтернативы можно использовать путь от корня:
4545

4646
```xml
4747
<Image Source="/Assets/icon.png"/>
4848
```
4949

50-
## Library Assets
50+
## Ресурсы библиотек
5151

5252
<img src={AssetLibraryDiagram} alt=''/>
5353

54-
If the asset is included in a different assembly from the XAML file, then you use the `avares:` URI scheme. For example, if the asset is contained in an assembly called `MyAssembly.dll` in a `Assets` folder, then you use:
54+
Если ресурс включен в другую сборку, отличную от файла XAML, тогда вы используете схему URI `avares:`. Например, если ресурс содержится в сборке с названием `MyAssembly.dll` в папке `Assets`, тогда вы используете:
5555

5656
```xml
5757
<Image Source="avares://MyAssembly/Assets/icon.png"/>
5858
```
5959

60-
### Asset Type Conversion
60+
### Преобразование типов ресурсов
6161

62-
Avalonia UI has built-in converters which can load assets for bitmaps, icons and fonts out of the box. So an assets Uri can be automatically converted to any of following:
62+
Avalonia UI имеет встроенные конвертеры, которые могут загружать ресурсы для растровых изображений, иконок и шрифтов «из коробки». Таким образом, URI ресурса может быть автоматически преобразован в любой из следующих типов:
6363

64-
* Image - `Image` type
65-
* Bitmap - `Bitmap` type
66-
* Window Icon - `WindowIcon` type
67-
* Font - `FontFamily` type
64+
* Изображение - тип `Image`
65+
* Растровое изображение - тип `Bitmap`
66+
* Иконка окна - тип `WindowIcon`
67+
* Шрифт - тип `FontFamily`
6868

69-
### Loading Assets in Code
69+
### Загрузка ресурсов в коде
7070

71-
You can write code to load assets using the `AssetLoader` static class. For example:
71+
Вы можете написать код для загрузки ресурсов, используя статический класс `AssetLoader`. Например:
7272

7373
```csharp
7474
var bitmap = new Bitmap(AssetLoader.Open(new Uri(uri)));
7575
```
7676

77-
The `uri` variable in the above code can contain any valid URI with `avares:` scheme (as described above).
77+
Переменная `uri` в приведенном выше коде может содержать любой действительный URI со схемой `avares:` (как описано выше).
7878

79-
_Avalonia UI_ does not provide support for `file://`, `http://`, or `https://` schemes. If you want to load files from disk or the Web, you must implement that functionality yourself or use community implementations.
79+
_Avalonia UI_ не предоставляет поддержку для схем `file://`, `http://` или `https://`. Если вы хотите загружать файлы с диска или из Интернета, вы должны реализовать эту функциональность самостоятельно или использовать реализации сообщества.
8080

8181
:::info
82-
Avalonia UI has a community implementation for an image loader at [https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia](https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia)
82+
Avalonia UI имеет реализацию загрузчика изображений от сообщества по адресу [https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia](https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia)
8383
:::

0 commit comments

Comments
 (0)