mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-01 16:19:43 +02:00
142 lines
2.8 KiB
CMake
Executable File
142 lines
2.8 KiB
CMake
Executable File
|
|
set( TARGET locale )
|
|
set( TARGET_ROOT ${topdir}/locale )
|
|
|
|
message( STATUS "========== Configuring ${TARGET} ==========" )
|
|
|
|
def_vars()
|
|
|
|
list( APPEND SOURCES
|
|
af.po
|
|
ar.po
|
|
be.po
|
|
bg.po
|
|
bn.po
|
|
bs.po
|
|
ca.po
|
|
ca_ES@valencia.po
|
|
cs.po
|
|
cy.po
|
|
da.po
|
|
de.po
|
|
el.po
|
|
es.po
|
|
eu.po
|
|
eu_ES.po
|
|
fa.po
|
|
fi.po
|
|
fr.po
|
|
ga.po
|
|
gl.po
|
|
he.po
|
|
hi.po
|
|
hr.po
|
|
hu.po
|
|
hy.po
|
|
id.po
|
|
it.po
|
|
ja.po
|
|
ka.po
|
|
km.po
|
|
ko.po
|
|
lt.po
|
|
mk.po
|
|
my.po
|
|
nb.po
|
|
nl.po
|
|
oc.po
|
|
pl.po
|
|
pt_BR.po
|
|
pt_PT.po
|
|
ro.po
|
|
ru.po
|
|
sk.po
|
|
sl.po
|
|
sr_RS.po
|
|
sr_RS@latin.po
|
|
sv.po
|
|
ta.po
|
|
tg.po
|
|
tr.po
|
|
uk.po
|
|
vi.po
|
|
zh_CN.po
|
|
zh_TW.po
|
|
)
|
|
|
|
# Look for gettext
|
|
find_package( Gettext QUIET )
|
|
if( GETTEXT_FOUND )
|
|
mark_as_advanced( FORCE GETTEXT_MSGFMT_EXECUTABLE )
|
|
mark_as_advanced( FORCE GETTEXT_MSGMERGE_EXECUTABLE )
|
|
set( msgfmt "${GETTEXT_MSGFMT_EXECUTABLE}" )
|
|
elseif( PYTHON )
|
|
set( msgfmt "${PYTHON}" "${TARGET_ROOT}/msgfmt.py" )
|
|
elseif( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
|
nuget_package( pkgdir "Gettext.Tools" "0.20.1.1" )
|
|
file( TO_NATIVE_PATH "${pkgdir}/tools/bin/msgfmt.exe" msgfmt )
|
|
endif()
|
|
|
|
if( NOT DEFINED msgfmt )
|
|
message( WARNING "The msgfmt program wasn't found...translations will not be provided." )
|
|
return()
|
|
endif()
|
|
|
|
if( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
|
|
set( locale "${_DEST}/Resources" )
|
|
elseif( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
|
set( locale "${_DEST}/Languages" )
|
|
else()
|
|
set( locale "${_DEST}/locale" )
|
|
endif()
|
|
|
|
set( OUTPUTS )
|
|
foreach( source ${SOURCES} )
|
|
get_filename_component( lang "${source}" NAME_WE )
|
|
|
|
if( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
|
|
set( dst "${locale}/${lang}.lproj" )
|
|
elseif( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
|
set( dst "${locale}/${lang}" )
|
|
else()
|
|
set( dst "${locale}/${lang}/LC_MESSAGES" )
|
|
endif()
|
|
|
|
set( po "${_SRCDIR}/${source}" )
|
|
set( mo "${dst}/audacity.mo" )
|
|
|
|
add_custom_command(
|
|
DEPENDS
|
|
"${po}"
|
|
COMMAND
|
|
"${CMAKE_COMMAND}" -E make_directory "${dst}"
|
|
COMMAND
|
|
${msgfmt} -o "${mo}" "${po}"
|
|
OUTPUT
|
|
"${mo}"
|
|
)
|
|
|
|
# Always make sure there's an empty English folder. Otherwise, some menu
|
|
# items will be translated to the next language listed in System
|
|
# Preferences/Language & Text
|
|
if( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
|
|
add_custom_command(
|
|
COMMAND
|
|
${CMAKE_COMMAND} -E make_directory "${_DEST}/Resources/en.lproj"
|
|
OUTPUT
|
|
"${mo}"
|
|
APPEND
|
|
)
|
|
endif()
|
|
|
|
list( APPEND OUTPUTS ${mo} )
|
|
endforeach()
|
|
|
|
add_custom_target( "${TARGET}" ALL DEPENDS ${OUTPUTS} SOURCES "${SOURCES}" )
|
|
|
|
if( NOT "${CMAKE_GENERATOR}" MATCHES "Xcode|Visual Studio*" )
|
|
install( DIRECTORY ${locale}/
|
|
TYPE LOCALE )
|
|
endif()
|
|
|