chore(localization): added translate support to theme name, description and screenshots
All checks were successful
Code check / Check code (push) Successful in 1m6s
All checks were successful
Code check / Check code (push) Successful in 1m6s
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
@@ -31,7 +31,7 @@ mkdir -p ~/.local/share/PortProtonQT/themes/my_custom_theme
|
||||
|
||||
## 🎨 Style File (`styles.py`)
|
||||
|
||||
Create a `styles.py` in the theme root. It should define variables or functions that return QSS (Qt Style Sheets). For better organization, you can split your theme into multiple submodules by creating a `styles` subdirectory with separate Python files for different components, and import them in `styles.py`.
|
||||
Create a `styles.py` in the theme root. It should define variables or functions that return QSS (Qt Style Sheets). For better organization, you can split your theme into multiple submodules by creating a subdirectory (e.g., `styles`, `components`, etc.) with separate Python files for different components, and import them in `styles.py`.
|
||||
|
||||
**Example of modular structure:**
|
||||
```
|
||||
@@ -40,7 +40,7 @@ my_custom_theme/
|
||||
├── metainfo.ini
|
||||
├── fonts/
|
||||
├── images/
|
||||
└── styles/
|
||||
└── styles/ # This can be named anything (e.g., components, modules, etc.)
|
||||
├── __init__.py # This empty file makes the directory a Python package
|
||||
├── constants.py
|
||||
├── base.py
|
||||
@@ -54,7 +54,7 @@ my_custom_theme/
|
||||
**Main styles.py file:**
|
||||
```python
|
||||
# Import from the theme's submodules using absolute paths relative to the package
|
||||
# Replace 'my_custom_theme' with your actual theme folder name
|
||||
# Replace 'my_custom_theme' with your actual theme folder name and 'styles' with your subdirectory name
|
||||
from portprotonqt.themes.my_custom_theme.styles.constants import *
|
||||
from portprotonqt.themes.my_custom_theme.styles.base import *
|
||||
from portprotonqt.themes.my_custom_theme.styles.game_card import *
|
||||
@@ -239,18 +239,52 @@ GAME_CARD_ANIMATION = {
|
||||
|
||||
```ini
|
||||
[Metainfo]
|
||||
name = My Custom Theme
|
||||
name_en = My Custom Theme
|
||||
name_ru = Моя пользовательская тема
|
||||
author = Your Name
|
||||
author_link = https://example.com
|
||||
description = Description of your theme.
|
||||
description_en = Description of your theme.
|
||||
description_ru = Описание вашей темы.
|
||||
```
|
||||
|
||||
### Translation Support
|
||||
|
||||
You must provide translations for your theme's name and description by adding language-specific fields:
|
||||
- `name_en`, `name_ru`, etc. for theme names
|
||||
- `description_en`, `description_ru`, etc. for theme descriptions
|
||||
|
||||
The application will automatically select the appropriate translation based on the user's system language, falling back to English if translations are not available for the user's language.
|
||||
|
||||
---
|
||||
|
||||
## 🖼 Screenshots
|
||||
|
||||
Folder: `images/screenshots/` — place UI screenshots there.
|
||||
|
||||
### Screenshot Translation Support
|
||||
|
||||
You can provide translations for screenshot captions by adding entries to the `[Screenshots]` section in your `metainfo.ini` file:
|
||||
|
||||
```ini
|
||||
[Screenshots]
|
||||
auto_installs_en = Auto-installs
|
||||
auto_installs_ru = Автоустановки
|
||||
library_en = Library
|
||||
library_ru = Библиотека
|
||||
game_card_en = Game Card
|
||||
game_card_ru = Карточка
|
||||
context_menu_en = Context Menu
|
||||
context_menu_ru = Контекстное меню
|
||||
portproton_settings_en = PortProton Settings
|
||||
portproton_settings_ru = Настройки PortProton
|
||||
wine_settings_en = Wine Settings
|
||||
wine_settings_ru = Настройки Wine
|
||||
themes_en = Themes
|
||||
themes_ru = Темы
|
||||
```
|
||||
|
||||
Screenshot files should be named in English (without spaces), and the application will display the appropriate translated caption based on the user's system language, falling back to English if translations are not available.
|
||||
|
||||
---
|
||||
|
||||
## 🔡 Fonts and Icons (optional)
|
||||
|
||||
@@ -31,7 +31,7 @@ mkdir -p ~/.local/share/PortProtonQT/themes/my_custom_theme
|
||||
|
||||
## 🎨 Файл стилей (`styles.py`)
|
||||
|
||||
Создайте `styles.py` в корне темы. В нём определите переменные и/или функции, возвращающие QSS-оформление (Qt Style Sheets). Для лучшей организации кода, вы можете разделить тему на несколько подмодулей, создав поддиректорию `styles` с отдельными Python-файлами для разных компонентов, и импортировать их в `styles.py`.
|
||||
Создайте `styles.py` в корне темы. В нём определите переменные и/или функции, возвращающие QSS-оформление (Qt Style Sheets). Для лучшей организации кода, вы можете разделить тему на несколько подмодулей, создав поддиректорию (например, `styles`, `components` и т.д.) с отдельными Python-файлами для разных компонентов, и импортировать их в `styles.py`.
|
||||
|
||||
**Пример модульной структуры:**
|
||||
```
|
||||
@@ -40,7 +40,7 @@ my_custom_theme/
|
||||
├── metainfo.ini
|
||||
├── fonts/
|
||||
├── images/
|
||||
└── styles/
|
||||
└── styles/ # Это может быть названо как угодно (например, components, modules и т.д.)
|
||||
├── __init__.py # Этот пустой файл делает директорию Python-пакетом
|
||||
├── constants.py
|
||||
├── base.py
|
||||
@@ -54,7 +54,7 @@ my_custom_theme/
|
||||
**Основной файл styles.py:**
|
||||
```python
|
||||
# Импорт из подмодулей темы с использованием абсолютных путей относительно пакета
|
||||
# Замените 'my_custom_theme' на фактическое имя папки вашей темы
|
||||
# Замените 'my_custom_theme' на фактическое имя папки вашей темы и 'styles' на имя вашей поддиректории
|
||||
from portprotonqt.themes.my_custom_theme.styles.constants import *
|
||||
from portprotonqt.themes.my_custom_theme.styles.base import *
|
||||
from portprotonqt.themes.my_custom_theme.styles.game_card import *
|
||||
@@ -239,18 +239,52 @@ GAME_CARD_ANIMATION = {
|
||||
|
||||
```ini
|
||||
[Metainfo]
|
||||
name = My Custom Theme
|
||||
name_en = My Custom Theme
|
||||
name_ru = Моя пользовательская тема
|
||||
author = Ваше имя
|
||||
author_link = https://example.com
|
||||
description = Описание вашей темы.
|
||||
description_en = Description of your theme.
|
||||
description_ru = Описание вашей темы.
|
||||
```
|
||||
|
||||
### Поддержка переводов
|
||||
|
||||
Вы должны предоставить переводы для названия и описания вашей темы, добавив поля с указанием языка:
|
||||
- `name_en`, `name_ru` и т.д. для названий тем
|
||||
- `description_en`, `description_ru` и т.д. для описаний тем
|
||||
|
||||
Приложение автоматически выберет соответствующий перевод на основе языка системы пользователя, с откатом к английскому языку, если переводы недоступны для языка пользователя.
|
||||
|
||||
---
|
||||
|
||||
## 🖼 Скриншоты
|
||||
|
||||
Папка: `images/screenshots/` — любые изображения оформления темы.
|
||||
|
||||
### Поддержка перевода скриншотов
|
||||
|
||||
Вы можете предоставить переводы для подписей к скриншотам, добавив записи в секцию `[Screenshots]` в файле `metainfo.ini`:
|
||||
|
||||
```ini
|
||||
[Screenshots]
|
||||
auto_installs_en = Auto-installs
|
||||
auto_installs_ru = Автоустановки
|
||||
library_en = Library
|
||||
library_ru = Библиотека
|
||||
game_card_en = Game Card
|
||||
game_card_ru = Карточка
|
||||
context_menu_en = Context Menu
|
||||
context_menu_ru = Контекстное меню
|
||||
portproton_settings_en = PortProton Settings
|
||||
portproton_settings_ru = Настройки PortProton
|
||||
wine_settings_en = Wine Settings
|
||||
wine_settings_ru = Настройки Wine
|
||||
themes_en = Themes
|
||||
themes_ru = Темы
|
||||
```
|
||||
|
||||
Файлы скриншотов должны быть названы на английском языке (без пробелов), и приложение будет отображать соответствующую переведенную подпись в зависимости от языка системы пользователя, с откатом к английскому языку, если переводы недоступны.
|
||||
|
||||
---
|
||||
|
||||
## 🔡 Шрифты и иконки (опционально)
|
||||
|
||||
Reference in New Issue
Block a user