summaryrefslogtreecommitdiffstats
path: root/amor/CMakeL10n.txt
blob: 0aa3ea7ed55f6d8f59e41b3383606f43e175f8ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
##### prepare data/tips-en ######################

file( READ ${CMAKE_CURRENT_SOURCE_DIR}/data/tips-en _tips_file )
string( REGEX REPLACE "[^\n]" "" _tips_len "${_tips_file}" )
string( LENGTH "+${_tips_len}" _tips_len )
unset( _tips_inside )
unset( _tips_l10n )
set( _tips_pos 0 )
while( _tips_pos LESS ${_tips_len} )
  string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\1" _tip_line "${_tips_file}" )
  string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\2" _tips_file "${_tips_file}" )
  math( EXPR _tips_pos "${_tips_pos}+1" )

  if( "${_tip_line}" STREQUAL "%" )
    if( _tips_inside )
      set( _tip_line ");" )
      unset( _tips_inside )
    else( )
      set( _tip_line "" )
    endif( )
  else( )
    string( REGEX REPLACE "\\\\" "\\\\\\\\" _tip_line "${_tip_line}" )
    string( REGEX REPLACE "\\\"" "\\\\\"" _tip_line "${_tip_line}" )
    string( REGEX REPLACE "\t" "\\\\t" _tip_line "${_tip_line}" )
    if( _tips_inside )
      set( _tip_line "\"\\n${_tip_line}\"" )
    else( )
      if( NOT "${_tip_line}" STREQUAL "" )
        set( _tip_line "i18n(\"${_tip_line}\"" )
        set( _tips_inside 1 )
      endif( )
    endif( )
  endif( )
  set( _tips_l10n "${_tips_l10n}${_tip_line}\n" )
endwhile( )
file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/data/tips-en.tde_l10n "${_tips_l10n}" )


##### create translation templates ##############

tde_l10n_create_template(
    CATALOG "amor"
    SOURCES "data/tips-en.tde_l10n" "."
)

tde_l10n_create_template(
    CATALOG "desktop_files/amor.desktop/"
    SOURCES amor.desktop
    DESTINATION "${CMAKE_SOURCE_DIR}/translations"
)