https://github.com/quasarapp/qtnativetr
This is library that contains all native qt translation files
https://github.com/quasarapp/qtnativetr
qt translations
Last synced: 2 months ago
JSON representation
This is library that contains all native qt translation files
- Host: GitHub
- URL: https://github.com/quasarapp/qtnativetr
- Owner: QuasarApp
- License: gpl-3.0
- Created: 2022-04-27T14:29:40.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-17T07:37:24.000Z (about 4 years ago)
- Last Synced: 2025-12-31T00:29:10.001Z (6 months ago)
- Topics: qt, translations
- Language: C++
- Homepage: https://quasarapp.ddns.net:3031/docs/QuasarApp/QtNativeTr/latest/
- Size: 80.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Qt Native Translations library
This is a simple cmake script that generate and build C++ library with all qm translations file of qt.
This is may need to static qt builds and builds for mobile devices like a Android or ios.
## Build and Incude
* cd yourRepo
* git submodule add https://github.com/QuasarApp/QtNativeTr # add the repository of QtNativeTr into your repo like submodule
* git submodule update --init --recursive
* Include in your CMakeLists.txt file the main CMakeLists.txt file of QtNativeTr library
``` cmake
add_subdirectory(QtNativeTr)
```
* link the QtNativeTr library to your target
```cmake
target_link_libraries(yourLib PUBLIC QtNativeTr)
```
* rebuild yuor project
## Usage
Simple include resource to your project looks like this:
``` cpp
#include
int main () {
// init all included resources
QtNativeTr::init();
return 0;
}
```
All qm files availabel to the **:/QtNativeTr/languages/** path.
For example:
* :/QtNativeTr/tr/assistant_cs.qm
If you want to add dynamic loading for qt translation you can user [QuasarAppLib::Locales](https://quasarapp.ddns.net:3031/docs/QuasarApp/QuasarAppLib/latest/classQuasarAppUtils_1_1Locales.html) class.
### Exmaple of use with QuasarAppLib::Locales
```cpp
#include
#include
int main () {
// init all included resources
QtNativeTr::init();
QuasarAppUtils::Locales::init(QLocale::system(), {":/QtNativeTr/languages/"});
return 0;
}
```