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::QuickUltralite)
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
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)
# Set up a lv_LV-only target
qul_add_target(translation_lv)
qul_add_resource(translation_lv
FILES
japan-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_FONTS_DIR target property to add another directory to the search path.
set_property(TARGET translation_all translation_lv APPEND PROPERTY QUL_FONTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/fonts)
#
# Note: Compiling for RH850-D1M1A results in:
# [elxr] (error #310) section .romAssetDataPreload (0x71d08-0x4e7dcb) doesn't fit in memory block iROM_0 (0x0-0x3fffff)
# therefore this example is disabled for the moment. Requires UL-2656.
string(TOLOWER ${QUL_PLATFORM} QUL_PLATFORM_LOWERCASE)
if(TARGET Qul::MonotypeSparkIntegration AND NOT (QUL_PLATFORM_LOWERCASE STREQUAL "rh850-d1m1a-baremetal" OR
QUL_PLATFORM_LOWERCASE STREQUAL "tviic2d6m-baremetal"))
# Set up Spark target
qul_add_target(translation_spark)
qul_add_resource(translation_spark
FILES
japan-flag-small.png
latvia-flag-small.png
usa-flag-small.png
norway-flag-small.png
)
set_target_properties(translation_spark
PROPERTIES
QUL_DEFAULT_FONT_FAMILY "regular"
QUL_MONOTYPE_SPARK_CACHE_SIZE 1 # Disable the cache
QUL_MONOTYPE_SPARK_FONT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/fonts/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)
endif()