Update TDEL10n module

+ Add a way to disable default keywords.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/13/head
Slávek Banko 6 years ago
parent 67db9032d9
commit 3306290834
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -149,6 +149,7 @@ endfunction( )
##### The methods from b) to d) can be combined.
##### EXCLUDES determines which files are to be excluded from processing
##### KEYWORDS determines additional keywords for xgettext.
##### Use "-" if is needed to disable default keywords.
##### ATTRIBUTES determines files and specification for extractattr:
##### source_spec:element,attribute[,context]
##### DESTINATION determines directory to save translation template.
@ -174,11 +175,13 @@ macro( tde_l10n_create_template )
unset( _desktops )
unset( _pots )
unset( _dest )
unset( _keywords )
unset( _keywords_add )
unset( _attributes )
unset( _pot )
unset( _directive )
set( _var _catalog )
set( _keywords_c_default "i18n" "i18n:1,2" "tr2i18n" "tr2i18n:1,2" "I18N_NOOP" "I18N_NOOP2" )
set( _keywords_desktop_default "Description" "ExtraNames" "X-TDE-Submenu" )
foreach( _arg ${ARGN} )
@ -212,8 +215,8 @@ macro( tde_l10n_create_template )
# found directive "KEYWORDS"
if( "+${_arg}" STREQUAL "+KEYWORDS" )
unset( _keywords )
set( _var _keywords )
unset( _keywords_add )
set( _var _keywords_add )
set( _directive 1 )
endif( )
@ -328,10 +331,22 @@ macro( tde_l10n_create_template )
tde_message_fatal( "no source files found" )
endif( )
# prepare additional keywords
unset( _add_keywords )
foreach( _keyword ${_keywords} )
list( APPEND _add_keywords "-k${_keyword}" )
# prepare keywords
unset( _keywords_c )
unset( _keywords_desktop )
foreach( _keyword ${_keywords_c_default} ${_keywords_add} )
if( "${_keyword}" STREQUAL "-" )
unset( _keywords_c )
unset( _keyword )
endif( )
list( APPEND _keywords_c "-k${_keyword}" )
endforeach( )
foreach( _keyword ${_keywords_desktop_default} ${_keywords_add} )
if( "${_keyword}" STREQUAL "-" )
unset( _keywords_desktop )
unset( _keyword )
endif( )
list( APPEND _keywords_desktop "-k${_keyword}" )
endforeach( )
# prepare resource files *.kcfg, *.rc and *.ui
@ -402,9 +417,7 @@ macro( tde_l10n_create_template )
if( _files )
execute_process(
COMMAND ${KDE_XGETTEXT_EXECUTABLE} --foreign-user -C
-ki18n -ki18n:1,2 -ktr2i18n -ktr2i18n:1,2
-kI18N_NOOP -kI18N_NOOP2 ${_add_keywords}
-o - ${_files}
${_keywords_c} -o - ${_files}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE _pot
)
@ -426,8 +439,7 @@ macro( tde_l10n_create_template )
endif( )
execute_process(
COMMAND ${XGETTEXT_EXECUTABLE} ${_withPotHeader} -L Desktop
-kDescription -kExtraNames -kX-TDE-Submenu ${_add_keywords}
-o - ${_desktops}
${_keywords_desktop} -o - ${_desktops}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE _potDesktop
)

Loading…
Cancel
Save