ConvertPo.cmake 713 B

12345678910111213141516171819202122
  1. string(TOUPPER ${INPUT_ENC} upperInputEnc)
  2. string(TOLOWER ${INPUT_ENC} lowerInputEnc)
  3. get_filename_component(inputName ${INPUT_FILE} NAME)
  4. execute_process(
  5. COMMAND ${ICONV_PRG} -f ${INPUT_ENC} -t ${OUTPUT_ENC} ${INPUT_FILE}
  6. OUTPUT_VARIABLE trans
  7. ERROR_VARIABLE err
  8. RESULT_VARIABLE res)
  9. if(NOT res EQUAL 0)
  10. message(FATAL_ERROR "iconv failed to run correctly: ${err}")
  11. endif()
  12. string(REPLACE "charset=${lowerInputEnc}" "charset=${OUTPUT_CHARSET}"
  13. trans "${trans}")
  14. string(REPLACE "charset=${upperInputEnc}" "charset=${OUTPUT_CHARSET}"
  15. trans "${trans}")
  16. string(REPLACE "# Original translations"
  17. "# Generated from ${inputName}, DO NOT EDIT"
  18. trans "${trans}")
  19. file(WRITE ${OUTPUT_FILE} "${trans}")