2014-07-09 03:12:28 -07:00
|
|
|
string(TOUPPER ${INPUT_ENC} upperInputEnc)
|
|
|
|
string(TOLOWER ${INPUT_ENC} lowerInputEnc)
|
|
|
|
get_filename_component(inputName ${INPUT_FILE} NAME)
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${ICONV_PRG} -f ${INPUT_ENC} -t ${OUTPUT_ENC} ${INPUT_FILE}
|
|
|
|
OUTPUT_VARIABLE trans
|
|
|
|
ERROR_VARIABLE err
|
|
|
|
RESULT_VARIABLE res)
|
2023-05-13 03:12:29 -07:00
|
|
|
if(res)
|
2014-07-09 03:12:28 -07:00
|
|
|
message(FATAL_ERROR "iconv failed to run correctly: ${err}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
string(REPLACE "charset=${lowerInputEnc}" "charset=${OUTPUT_CHARSET}"
|
|
|
|
trans "${trans}")
|
|
|
|
string(REPLACE "charset=${upperInputEnc}" "charset=${OUTPUT_CHARSET}"
|
|
|
|
trans "${trans}")
|
|
|
|
string(REPLACE "# Original translations"
|
|
|
|
"# Generated from ${inputName}, DO NOT EDIT"
|
|
|
|
trans "${trans}")
|
|
|
|
|
|
|
|
file(WRITE ${OUTPUT_FILE} "${trans}")
|