Skip to content

QuasarApp/QtNativeTr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
    add_subdirectory(QtNativeTr)
  • link the QtNativeTr library to your target
    target_link_libraries(yourLib PUBLIC QtNativeTr)
  • rebuild yuor project

Usage

Simple include resource to your project looks like this:

#include <QtNativeTr.h>

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 class.

Exmaple of use with QuasarAppLib::Locales

#include <QtNativeTr.h>
#include <quasarapp.h>

int main () {

    // init all included resources
    QtNativeTr::init();
    QuasarAppUtils::Locales::init(QLocale::system(), {":/QtNativeTr/languages/"});
    
    return 0;
}

About

This is library that contains all native qt translation files

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Generated from QuasarApp/CMakeProject