@ -12,6 +12,15 @@
include ( CMakeParseArguments )
# T h e G e t t e x t m o d u l e i s s t i l l o l d - f a s h i o n e d , A L L C A P S v a r i a b l e s
find_package ( Gettext )
set_package_properties ( GETTEXT PROPERTIES
D E S C R I P T I O N " G N U gettext ( translation ) t o o l s . "
U R L " h t t p s : / / w w w . g n u . o r g / s o f t w a r e / g e t t e x t / "
P U R P O S E " G e t t e x t i s u s e d i n t h e t r a n s l a t i o n o f P y t h o n m o d u l e s . "
T Y P E R E Q U I R E D
)
# I n s t a l l s a d i r e c t o r y c o n t a i n i n g l a n g u a g e - c o d e - l a b e l e d s u b d i r e c t o r i e s w i t h
# g e t t e x t d a t a i n t o t h e a p p r o p r i a t e s y s t e m d i r e c t o r y . A l l o w s r e n a m i n g t h e
# . m o f i l e s d u r i n g i n s t a l l t o a v o i d n a m e s p a c e c l a s h e s .
@ -44,8 +53,13 @@ function( install_calamares_gettext_translations )
endif ( )
string ( REGEX REPLACE ".mo$" ".po" TRANSLATION_SOURCE_FILENAME "${TRANSLATION_FILENAME}" )
message ( STATUS "Installing gettext translations for ${TRANSLATION_NAME}" )
message ( STATUS " Installing ${TRANSLATION_FILENAME} from ${TRANSLATION_SOURCE_DIR}" )
if ( GETTEXT_FOUND AND GETTEXT_MSGFMT_EXECUTABLE )
message ( STATUS "Installing gettext translations for ${TRANSLATION_NAME}" )
message ( STATUS " Installing ${TRANSLATION_FILENAME} from ${TRANSLATION_SOURCE_DIR}" )
else ( )
message ( WARNING "Gettext translations requested for ${TRANSLATION_NAME}, but gettext was not found." )
return ( )
endif ( )
set ( TARGET_NAME calamares-gettext-translations- ${ NAME } )
if ( NOT TARGET "${TARGET_NAME}" )
@ -62,10 +76,18 @@ function( install_calamares_gettext_translations )
if ( lang STREQUAL "en" )
message ( STATUS " Skipping ${TRANSLATION_NAME} translations for en_US" )
else ( )
# W e * * d o n ' t * * u s e t h e g e t t e x t m a c r o ' s h e r e b e c a u s e t h e s o u r c e
# s t r u c t u r e d o e s n ' t m a t c h : w e a r e c a l l i n g t h i s o n c e p e r l a n g u a g e
# f o r a l l o f C a l a m a r e s ' s l a n g u a g e s , w h i l e t h e g e t t e x t m o d u l e
# e x p e c t s i t t o b e c a l l e d o n c e , f o r a g i v e n l a n g u a g e s o u r c e - d i r .
#
# U s i n g a n y o f t h e g e t t e x t m a c r o s j u s t g e t s u s m u l t i p l e r u l e s
# f o r p y t h o n . g m o , a n d i t w a n t s t o u s e m s g m e r g e , b e s i d e s , w h i c h
# d o e s n ' t f i t o u r T r a n s i f e x w o r k f l o w .
make_directory ( ${ lang_mo_dir } )
add_custom_command (
O U T P U T $ { l a n g _ m o }
C O M M A N D m s g f m t
C O M M A N D ${ G E T T E X T _ M S G F M T _ E X E C U T A B L E }
A R G S - o $ { l a n g _ m o } $ { l a n g _ p o }
M A I N _ D E P E N D E N C Y $ { l a n g _ p o }
)