@ -54,16 +54,6 @@ if( NOT DEFINED MSGUNIQ_EXECUTABLE )
endif ( )
endif ( )
if ( NOT DEFINED MSGCAT_EXECUTABLE )
find_program ( MSGCAT_EXECUTABLE
N A M E S m s g c a t
H I N T S " $ { T D E _ P R E F I X } / b i n "
)
if ( "${MSGCAT_EXECUTABLE}" STREQUAL "MSGCAT_EXECUTABLE-NOTFOUND" )
tde_message_fatal ( "msgcat is required but not found" )
endif ( )
endif ( )
if ( NOT DEFINED PO4A_GETTEXTIZE_EXECUTABLE )
find_program ( PO4A_GETTEXTIZE_EXECUTABLE
N A M E S p o 4 a - g e t t e x t i z e
@ -305,7 +295,7 @@ macro( tde_l10n_create_template )
if ( ${ _dest } MATCHES "[^/]$" )
set ( _dest "${_dest}/" )
endif ( )
if ( ${ _dest } MATCHES "^[^/]" )
if ( NOT IS_ABSOLUTE ${ _dest } )
set ( _dest "${CMAKE_CURRENT_SOURCE_DIR}/${_dest}" )
endif ( )
@ -555,12 +545,6 @@ macro( tde_l10n_create_template )
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R }
O U T P U T _ V A R I A B L E _ p o t
)
# s e t c h a r s e t a n d e n c o d i n g h e a d e r s
if ( _pot )
string ( REPLACE "Content-Type: text/plain; charset=CHARSET" "Content-Type: text/plain; charset=UTF-8" _pot "${_pot}" )
string ( REPLACE "Content-Transfer-Encoding: ENCODING" "Content-Transfer-Encoding: 8bit" _pot "${_pot}" )
endif ( )
endif ( )
# p r o c e s s d e s k t o p f i l e s
@ -573,13 +557,8 @@ macro( tde_l10n_create_template )
endforeach ( )
# c r e a t e t r a n s l a t i o n t e m p l a t e f o r d e s k t o p f i l e s
if ( _pot )
set ( _withPotHeader "--omit-header" )
else ( )
set ( _withPotHeader "--foreign-user" )
endif ( )
execute_process (
C O M M A N D $ { X G E T T E X T _ E X E C U T A B L E } ${ _ w i t h P o t H e a d e r }
C O M M A N D $ { X G E T T E X T _ E X E C U T A B L E } - - f o r e i g n - u s e r
- - f r o m - c o d e = U T F - 8 - C - c - k i 1 8 n - o - $ { _ d e s k t o p s }
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R }
O U T P U T _ V A R I A B L E _ p o t D e s k t o p
@ -588,43 +567,34 @@ macro( tde_l10n_create_template )
# m e r g e t r a n s l a t i o n t e m p l a t e s
if ( _potDesktop )
if ( _pot )
file ( WRITE ${ CMAKE_CURRENT_SOURCE_DIR } /extracted-pot.tmp "${_pot}" )
file ( APPEND ${ CMAKE_CURRENT_SOURCE_DIR } /extracted-pot.tmp "${_potDesktop}" )
execute_process (
C O M M A N D $ { M S G U N I Q _ E X E C U T A B L E } - - u s e - f i r s t
I N P U T _ F I L E $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / e x t r a c t e d - p o t . t m p
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R }
O U T P U T _ V A R I A B L E _ p o t
)
file ( REMOVE ${ CMAKE_CURRENT_SOURCE_DIR } /extracted-pot.tmp )
set ( _pot "${_pot}\n${_potDesktop}" )
else ( )
set ( _pot "${_potDesktop}" )
# s e t c h a r s e t a n d e n c o d i n g h e a d e r s
string ( REPLACE "Content-Type: text/plain; charset=CHARSET" "Content-Type: text/plain; charset=UTF-8" _pot "${_pot}" )
string ( REPLACE "Content-Transfer-Encoding: ENCODING" "Content-Transfer-Encoding: 8bit" _pot "${_pot}" )
endif ( )
endif ( )
endif ( )
# me r g e a d d i t i o n a l p o t f i l e s
# j o i n a d d i t i o n a l p o t f i l e s
if ( _pots )
file ( WRITE ${ CMAKE_CURRENT_SOURCE_DIR } /extracted-pot.tmp "${_pot}" )
execute_process (
C O M M A N D $ { M S G C A T _ E X E C U T A B L E } - - u s e - f i r s t e x t r a c t e d - p o t . t m p $ { _ p o t s }
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R }
O U T P U T _ V A R I A B L E _ p o t
)
file ( REMOVE ${ CMAKE_CURRENT_SOURCE_DIR } /extracted-pot.tmp )
# s e t c h a r s e t a n d e n c o d i n g h e a d e r s
string ( REPLACE "Content-Type: text/plain; charset=CHARSET" "Content-Type: text/plain; charset=UTF-8" _pot "${_pot}" )
string ( REPLACE "Content-Transfer-Encoding: ENCODING" "Content-Transfer-Encoding: 8bit" _pot "${_pot}" )
foreach ( _extra_pot IN LISTS _pots )
file ( READ ${ _extra_pot } _extra_pot )
if ( _extra_pot )
if ( _pot )
set ( _pot "${_pot}\n${_extra_pot}" )
else ( )
set ( _pot "${_extra_pot}" )
endif ( )
endif ( )
endforeach ( )
endif ( )
# f i n a l i z e t r a n s l a t i o n t e m p l a t e
if ( _pot )
# s e t c h a r s e t a n d e n c o d i n g h e a d e r s
string ( REPLACE "Content-Type: text/plain; charset=CHARSET" "Content-Type: text/plain; charset=UTF-8" _pot "${_pot}" )
string ( REPLACE "Content-Transfer-Encoding: ENCODING" "Content-Transfer-Encoding: 8bit" _pot "${_pot}" )
# u p d a t e r e f e r e n c e s f o r r e s o u r c e s t o o r i g i n a l f i l e s a n d l i n e n u m b e r s
list ( FIND _files "extracted-rc.tde_l10n" _extractedRC_index )
if ( "${_extractedRC_index}" GREATER -1
@ -650,6 +620,18 @@ macro( tde_l10n_create_template )
# u p d a t e r e f e r e n c e s f o r m o d i f i e d s o u r c e files ( ".tde_l10n" extension )
string ( REGEX REPLACE "\\.tde_l10n[0-9]*(:[0-9]+)" "\\1" _pot "${_pot}" )
# m e r g e u n i q u e s t r i n g s
string ( REGEX REPLACE "\n\n(#[^\n]*\n)*msgid \" \"\nmsgstr \"\"\n(\"[^\n]*\n)*\n" "\n\n" _pot "${_pot}" )
file ( WRITE ${ CMAKE_CURRENT_SOURCE_DIR } /extracted-pot.tmp "${_pot}" )
execute_process (
C O M M A N D $ { M S G U N I Q _ E X E C U T A B L E }
I N P U T _ F I L E $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / e x t r a c t e d - p o t . t m p
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R }
O U T P U T _ V A R I A B L E _ p o t
)
file ( REMOVE ${ CMAKE_CURRENT_SOURCE_DIR } /extracted-pot.tmp )
string ( REGEX REPLACE "(^|\n)#.? #-#-#-#-# [^\n]* #-#-#-#-#\n" "\\1" _pot "${_pot}" )
# r e p l a c e t h e r e f e r e n c e s f o r _ t r a n s l a t o r i n f o w i t h i n s t r u c t i o n s i n t h e c o m m e n t
string ( REGEX REPLACE
" ( ^ | \ n ) ( # : [ ^ \ n ] * ) _ t r a n s l a t o r i n f o : 1 ( $ |[^\n]* ) "