mirror of
https://github.com/edisionnano/QDiskInfo.git
synced 2026-04-12 00:31:27 +03:00
Make translation easier
This commit is contained in:
6
.github/workflows/build.yaml
vendored
6
.github/workflows/build.yaml
vendored
@@ -30,17 +30,17 @@ jobs:
|
|||||||
- name: Install dependencies for glibc
|
- name: Install dependencies for glibc
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install -y qt6-base-dev qt6-svg-dev libgl1-mesa-dev libxkbcommon-dev libvulkan-dev qmake6 smartmontools
|
sudo apt install -y qt6-base-dev qt6-tools-dev qt6-svg-dev libgl1-mesa-dev libxkbcommon-dev libvulkan-dev qmake6 smartmontools
|
||||||
if: ${{ matrix.clib == 'glibc' }}
|
if: ${{ matrix.clib == 'glibc' }}
|
||||||
- name: Install dependencies for musl
|
- name: Install dependencies for musl
|
||||||
run: |
|
run: |
|
||||||
apk add git cmake make gcc g++ curl gcompat qt6-qtbase-dev qt6-qtbase-x11 qt6-qtsvg breeze smartmontools
|
apk add git cmake make gcc g++ curl gcompat qt6-qtbase-dev qt6-qttools-dev qt6-qtbase-x11 qt6-qtsvg breeze smartmontools
|
||||||
git config --global --add safe.directory '*'
|
git config --global --add safe.directory '*'
|
||||||
if: ${{ matrix.clib == 'musl' }}
|
if: ${{ matrix.clib == 'musl' }}
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
cmake -Bbuild -DCMAKE_BUILD_TYPE:STRING=MinSizeRel -DQT_VERSION_MAJOR=6
|
cmake -Bbuild -DCMAKE_BUILD_TYPE:STRING=MinSizeRel -DQT_VERSION_MAJOR=6 -DENABLE_TRANSLATIONS=ON
|
||||||
cmake --build build
|
cmake --build build
|
||||||
|
|
||||||
- name: Package AppImage
|
- name: Package AppImage
|
||||||
|
|||||||
@@ -14,35 +14,51 @@ if(NOT DEFINED QT_VERSION_MAJOR)
|
|||||||
set(QT_VERSION_MAJOR 6)
|
set(QT_VERSION_MAJOR 6)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
|
if(ENABLE_TRANSLATIONS)
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools)
|
||||||
|
else()
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(PROJECT_SOURCES
|
set(PROJECT_SOURCES
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
src/mainwindow.cpp
|
src/mainwindow.cpp
|
||||||
src/mainwindow.h
|
src/mainwindow.h
|
||||||
src/mainwindow.ui
|
src/mainwindow.ui
|
||||||
src/custombutton.h
|
src/custombutton.h
|
||||||
src/custombutton.cpp
|
src/custombutton.cpp
|
||||||
src/statusdot.h
|
src/statusdot.h
|
||||||
src/statusdot.cpp
|
src/statusdot.cpp
|
||||||
src/jsonparser.h
|
src/jsonparser.h
|
||||||
src/jsonparser.cpp
|
src/jsonparser.cpp
|
||||||
src/utils.h
|
src/utils.h
|
||||||
src/utils.cpp
|
src/utils.cpp
|
||||||
src/resources.qrc
|
src/resources.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
if (INCLUDE_OPTIONAL_RESOURCES)
|
if(INCLUDE_OPTIONAL_RESOURCES)
|
||||||
set(PROJECT_SOURCES ${PROJECT_SOURCES} dist/theme/theme_resources.qrc)
|
set(PROJECT_SOURCES ${PROJECT_SOURCES} dist/theme/theme_resources.qrc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(QDiskInfo
|
if(ENABLE_TRANSLATIONS)
|
||||||
${PROJECT_SOURCES}
|
file(GLOB TS_FILES "${CMAKE_SOURCE_DIR}/translations/*.ts")
|
||||||
)
|
qt_add_translation(QM_FILES ${TS_FILES})
|
||||||
|
set(TRANSLATIONS_QRC "${CMAKE_BINARY_DIR}/translations.qrc")
|
||||||
|
file(WRITE ${TRANSLATIONS_QRC} "<RCC>\n <qresource prefix=\"/translations\">\n")
|
||||||
|
foreach(QM_FILE ${QM_FILES})
|
||||||
|
get_filename_component(QM_FILE_NAME ${QM_FILE} NAME)
|
||||||
|
file(APPEND ${TRANSLATIONS_QRC} " <file>${QM_FILE_NAME}</file>\n")
|
||||||
|
endforeach()
|
||||||
|
file(APPEND ${TRANSLATIONS_QRC} " </qresource>\n</RCC>\n")
|
||||||
|
list(APPEND PROJECT_SOURCES ${TRANSLATIONS_QRC})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_executable(QDiskInfo ${PROJECT_SOURCES})
|
||||||
|
|
||||||
target_compile_definitions(QDiskInfo PRIVATE
|
target_compile_definitions(QDiskInfo PRIVATE
|
||||||
PROJECT_VERSION_MAJOR=${QDiskInfo_VERSION_MAJOR}
|
PROJECT_VERSION_MAJOR=${QDiskInfo_VERSION_MAJOR}
|
||||||
PROJECT_VERSION_MINOR=${QDiskInfo_VERSION_MINOR}
|
PROJECT_VERSION_MINOR=${QDiskInfo_VERSION_MINOR}
|
||||||
|
ENABLE_TRANSLATIONS=$<BOOL:${ENABLE_TRANSLATIONS}>
|
||||||
INCLUDE_OPTIONAL_RESOURCES=$<BOOL:${INCLUDE_OPTIONAL_RESOURCES}>
|
INCLUDE_OPTIONAL_RESOURCES=$<BOOL:${INCLUDE_OPTIONAL_RESOURCES}>
|
||||||
CHARACTER_IS_RIGHT=$<BOOL:${CHARACTER_IS_RIGHT}>
|
CHARACTER_IS_RIGHT=$<BOOL:${CHARACTER_IS_RIGHT}>
|
||||||
)
|
)
|
||||||
|
|||||||
24
README.md
24
README.md
@@ -1,5 +1,5 @@
|
|||||||
# QDiskInfo
|
# QDiskInfo
|
||||||
QDiskInfo is a frontend for smartctl (part of the smartmontools package). It provides a user experience similar to CrystalDiskInfo. It shows the SMART (Self-Monitoring, Analysis, and Reporting Technology) data of modern hard disk drives.
|
QDiskInfo is a frontend for smartctl (part of the smartmontools package). It provides a user experience similar to CrystalDiskInfo. It shows the SMART (Self-Monitoring, Analysis, and Reporting Technology) data of modern hard disk drives.
|
||||||

|

|
||||||
The icon is a modified version of the KDE Partition Manager logo which is available under GPL-3.0+.
|
The icon is a modified version of the KDE Partition Manager logo which is available under GPL-3.0+.
|
||||||
|
|
||||||
@@ -10,11 +10,11 @@ The icon is a modified version of the KDE Partition Manager logo which is availa
|
|||||||
### Compilation and Runtime Dependencies
|
### Compilation and Runtime Dependencies
|
||||||
Ubuntu and based distros (Mint, Pop!_OS, etc.)
|
Ubuntu and based distros (Mint, Pop!_OS, etc.)
|
||||||
```sh
|
```sh
|
||||||
sudo apt install build-essential cmake git libgl1-mesa-dev libxkbcommon-dev qt6-base-dev qt6-wayland smartmontools
|
sudo apt install build-essential cmake git libgl1-mesa-dev libxkbcommon-dev qt6-base-dev qt6-tools-dev qt6-wayland smartmontools
|
||||||
```
|
```
|
||||||
Fedora and derivatives (Nobara Project, etc.)
|
Fedora and derivatives (Nobara Project, etc.)
|
||||||
```
|
```
|
||||||
sudo dnf install cmake git mesa-libGL-devel libxkbcommon-devel qt6-qtbase-devel qt6-qtwayland-devel smartmontools
|
sudo dnf install cmake git mesa-libGL-devel libxkbcommon-devel qt6-qtbase-devel qt6-qttools-devel qt6-qtwayland-devel smartmontools
|
||||||
```
|
```
|
||||||
### Compilation Steps
|
### Compilation Steps
|
||||||
First you will need to clone the repository and cd inside
|
First you will need to clone the repository and cd inside
|
||||||
@@ -25,11 +25,11 @@ Then you must create a build directory and cd inside
|
|||||||
```sh
|
```sh
|
||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
```
|
```
|
||||||
After that use CMake to setup the project, Qt version can also be set to 5 (for example for Ubuntu)
|
After that use CMake to setup the project. Qt version can also be set to 5 (for example for Ubuntu), translations can also be disabled if you don't want to install the required tools package
|
||||||
```sh
|
```sh
|
||||||
cmake .. -DCMAKE_BUILD_TYPE:STRING=MinSizeRel -DQT_VERSION_MAJOR=6
|
cmake .. -DCMAKE_BUILD_TYPE:STRING=MinSizeRel -DQT_VERSION_MAJOR=6 -DENABLE_TRANSLATIONS=ON
|
||||||
```
|
```
|
||||||
And finally compile the project with all the threads
|
Finally, compile the project with all the threads using
|
||||||
```sh
|
```sh
|
||||||
make -j$(nproc)
|
make -j$(nproc)
|
||||||
```
|
```
|
||||||
@@ -47,22 +47,22 @@ Currently, QDiskInfo has support for the following languages:
|
|||||||
- 🇨🇳 Simplified Chinese (zh_CN)
|
- 🇨🇳 Simplified Chinese (zh_CN)
|
||||||
|
|
||||||
You can translate QDiskInfo to your language very easily using [Crowdin](https://crowdin.com/project/qdiskinfo). If your language isn't available on Crowdin, feel free to create a new issue.
|
You can translate QDiskInfo to your language very easily using [Crowdin](https://crowdin.com/project/qdiskinfo). If your language isn't available on Crowdin, feel free to create a new issue.
|
||||||
<br><br>Alternatively you can copy the qdiskinfo_en_US.ts, which can be found inside the translations folder, to the locale you want. For example to qdiskinfo_de_DE.ts for German. Then you can use the QT Linguist application to translate the strings, marking every finished one with a tick. Once you are finished you can compile the .ts file to a .qm file by running this command from the root of the project
|
<br><br>Alternatively you can copy the qdiskinfo_en_US.ts, which can be found inside the translations folder, to the locale you want. For example to qdiskinfo_de_DE.ts for German. Then you can use the QT Linguist application to translate the strings, marking every finished one with a tick. Compile the project with `-DENABLE_TRANSLATIONS=ON` to test your translation.
|
||||||
```sh
|
|
||||||
lrelease translations/qdiskinfo_de_DE.ts -qm translations/qdiskinfo_de_DE.qm
|
|
||||||
```
|
|
||||||
Once you do that, add the .qm file on `src/resources.qrc` and compile the project.
|
|
||||||
<br>If your system language differs from the one you are translating to, you can use
|
<br>If your system language differs from the one you are translating to, you can use
|
||||||
```sh
|
```sh
|
||||||
LC_ALL=de_DE.UTF-8 ./QDiskInfo
|
LC_ALL=de_DE.UTF-8 ./QDiskInfo
|
||||||
```
|
```
|
||||||
to force the app to use the language of your choice.
|
to force the app to use the language of your choice.
|
||||||
|
<br>If changes were made to the original strings you can use the `lupdate` command to update the .ts files, for example to update the German translation file you would run
|
||||||
|
```sh
|
||||||
|
lupdate src/ -ts translations/qdiskinfo_de_DE.ts -noobsolete
|
||||||
|
```
|
||||||
|
|
||||||
## Using CrystalDiskInfo Anime Themes
|
## Using CrystalDiskInfo Anime Themes
|
||||||
The process is similar to the one above with a few changes:<br>
|
The process is similar to the one above with a few changes:<br>
|
||||||
First you must download the edition of CrystalDiskInfo you want (Aoi for example) in ZIP format from [here](https://crystalmark.info/en/download/), from this archive you shall copy the light and dark backgrounds as well as the good, caution, bad, unknown icons to dist/theme with the same name as the templates there.<br>
|
First you must download the edition of CrystalDiskInfo you want (Aoi for example) in ZIP format from [here](https://crystalmark.info/en/download/), from this archive you shall copy the light and dark backgrounds as well as the good, caution, bad, unknown icons to dist/theme with the same name as the templates there.<br>
|
||||||
Once you do that compile like above but when running CMake do this instead:
|
Once you do that compile like above but when running CMake do this instead:
|
||||||
```sh
|
```sh
|
||||||
cmake .. -DCMAKE_BUILD_TYPE:STRING=MinSizeRel -DQT_VERSION_MAJOR=6 -DINCLUDE_OPTIONAL_RESOURCES=ON -DCHARACTER_IS_RIGHT=ON
|
cmake .. -DCMAKE_BUILD_TYPE:STRING=MinSizeRel -DQT_VERSION_MAJOR=6 -DINCLUDE_OPTIONAL_RESOURCES=ON -DCHARACTER_IS_RIGHT=ON -DENABLE_TRANSLATIONS=ON
|
||||||
```
|
```
|
||||||
Regarding the `-DCHARACTER_IS_RIGHT` set it to ON for themes where the character is right (like Aoi) or OFF for most other themes.
|
Regarding the `-DCHARACTER_IS_RIGHT` set it to ON for themes where the character is right (like Aoi) or OFF for most other themes.
|
||||||
|
|||||||
@@ -2,10 +2,4 @@
|
|||||||
<qresource prefix="/icons">
|
<qresource prefix="/icons">
|
||||||
<file alias="icon.svg">../dist/QDiskInfo.svg</file>
|
<file alias="icon.svg">../dist/QDiskInfo.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/translations">
|
|
||||||
<file alias="qdiskinfo_el_GR.qm">../translations/qdiskinfo_el_GR.qm</file>
|
|
||||||
<file alias="qdiskinfo_es_ES.qm">../translations/qdiskinfo_es_ES.qm</file>
|
|
||||||
<file alias="qdiskinfo_pt_BR.qm">../translations/qdiskinfo_pt_BR.qm</file>
|
|
||||||
<file alias="qdiskinfo_zh_CN.qm">../translations/qdiskinfo_zh_CN.qm</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user