C
Qt Quick Ultralite translation Example
cmake_minimum_required (VERSION 3.15) project(translation VERSION 0.0.1 LANGUAGES C CXX ASM) if (NOT TARGET Qul::Core) find_package(Qul) endif() # Set up a target that includes all bundled languages qul_add_target(translation_all) qul_add_resource(translation_all FILES japan-flag-small.png saudi-arabia-flag-small.png thai-flag-small.png latvia-flag-small.png usa-flag-small.png norway-flag-small.png ) qul_target_qml_sources(translation_all translation.qml) app_target_setup_os(translation_all) app_target_default_entrypoint(translation_all translation) qul_target_embed_translations(translation_all translation.nb_NO.ts translation.lv_LV.ts translation.ja_JP.ts translation.ar_SA.ts translation.th_TH.ts) # Set up a lv_LV-only target qul_add_target(translation_lv) qul_add_resource(translation_lv FILES japan-flag-small.png saudi-arabia-flag-small.png thai-flag-small.png latvia-flag-small.png usa-flag-small.png norway-flag-small.png ) qul_target_qml_sources(translation_lv translation.qml) app_target_setup_os(translation_lv) app_target_default_entrypoint(translation_lv translation) target_compile_definitions(translation_lv PRIVATE APP_DEFAULT_UILANGUAGE="lv_LV") qul_target_embed_translations(translation_lv translation.lv_LV.ts OMIT_SOURCE_LANGUAGE) # Qul ships some default fonts. Since they don't contain glyphs for # all the characters that are needed for this application, set the # QUL_FONT_FILES target property to add some fonts. set(FONT_FILES "${CMAKE_CURRENT_SOURCE_DIR}/fonts/Kosugi-Regular.ttf" "${CMAKE_CURRENT_SOURCE_DIR}/fonts/monotype/ArabicOTS Spark 12-29b.ttf" "${CMAKE_CURRENT_SOURCE_DIR}/fonts/monotype/Neue Frutiger Thai Mod Spark.ttf" ) set_property(TARGET translation_all translation_lv APPEND PROPERTY QUL_FONT_FILES "${FONT_FILES}") # Note: Monotype is currently not supported on mimxrt1170-evk string(TOLOWER ${QUL_PLATFORM} QUL_PLATFORM) if(TARGET Qul::MonotypeSpark) # Set up Spark target qul_add_target(translation_spark) qul_add_resource(translation_spark FILES japan-flag-small.png saudi-arabia-flag-small.png thai-flag-small.png latvia-flag-small.png usa-flag-small.png norway-flag-small.png ) set_target_properties(translation_spark PROPERTIES QUL_FONT_ENGINE "Spark" QUL_DEFAULT_FONT_FAMILY "regular" QUL_FONT_CACHE_SIZE 1 # Disable the cache QUL_FONT_FILES "${CMAKE_CURRENT_SOURCE_DIR}/fonts/monotype/TranslationsSampleFontmap.fmp") qul_target_qml_sources(translation_spark translation.qml) app_target_setup_os(translation_spark) app_target_default_entrypoint(translation_spark translation) qul_target_embed_translations(translation_spark translation.nb_NO.ts translation.lv_LV.ts translation.ja_JP.ts translation.ar_SA.ts translation.th_TH.ts) endif()