# Olive - Non-Linear Video Editor
# Copyright (C) 2021 Olive Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

set(OLIVE_TS_FILES
  ts/ar_AR.ts
  ts/bs_BA.ts
  ts/cs_CZ.ts
  ts/de_DE.ts
  ts/en_US.ts
  ts/es_ES.ts
  ts/fr_FR.ts
  ts/id_ID.ts
  ts/it_IT.ts
  ts/pt_BR.ts
  ts/ru_RU.ts
  ts/sr_RS.ts
  ts/tr_TR.ts
  ts/uk_UK.ts
  ts/zh_CN.ts
  ts/zh_TW.ts
  PARENT_SCOPE
)

# Add translations
qt5_add_translation(OLIVE_QM_FILES ${OLIVE_TS_FILES})

set(QRC_BODY "")
foreach(QM_FILE ${OLIVE_QM_FILES})
  get_filename_component(QM_FILENAME_COMPONENT ${QM_FILE} NAME_WE)
  string(APPEND QRC_BODY "<file alias=\"${QM_FILENAME_COMPONENT}\">${QM_FILE}</file>\n")
endforeach()
configure_file(translations.qrc.in translations.qrc @ONLY)

set(OLIVE_RESOURCES
  ${OLIVE_RESOURCES}
  ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc
  PARENT_SCOPE
)
