Browse Source

Add CMakeL10n rules.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 1 year ago
parent
commit
b97668ea39
No known key found for this signature in database GPG Key ID: 608F5293A04BE668
37 changed files with 368 additions and 0 deletions
  1. +28
    -0
      CMakeL10n.txt
  2. +3
    -0
      blinken/CMakeL10n.txt
  3. +3
    -0
      blinken/src/CMakeL10n.txt
  4. +3
    -0
      kalzium/CMakeL10n.txt
  5. +30
    -0
      kalzium/src/CMakeL10n.txt
  6. +3
    -0
      kanagram/CMakeL10n.txt
  7. +3
    -0
      kanagram/src/CMakeL10n.txt
  8. +3
    -0
      kbruch/CMakeL10n.txt
  9. +3
    -0
      kbruch/src/CMakeL10n.txt
  10. +3
    -0
      keduca/CMakeL10n.txt
  11. +3
    -0
      kgeography/CMakeL10n.txt
  12. +3
    -0
      kgeography/src/CMakeL10n.txt
  13. +3
    -0
      khangman/CMakeL10n.txt
  14. +6
    -0
      khangman/khangman/CMakeL10n.txt
  15. +39
    -0
      kig/CMakeL10n.txt
  16. +3
    -0
      kiten/CMakeL10n.txt
  17. +3
    -0
      klatin/CMakeL10n.txt
  18. +3
    -0
      klatin/klatin/CMakeL10n.txt
  19. +3
    -0
      klettres/CMakeL10n.txt
  20. +3
    -0
      klettres/klettres/CMakeL10n.txt
  21. +3
    -0
      kmplot/CMakeL10n.txt
  22. +3
    -0
      kmplot/kmplot/CMakeL10n.txt
  23. +3
    -0
      kpercentage/CMakeL10n.txt
  24. +17
    -0
      kpercentage/kpercentage/CMakeL10n.txt
  25. +3
    -0
      kstars/CMakeL10n.txt
  26. +155
    -0
      kstars/kstars/CMakeL10n.txt
  27. +3
    -0
      ktouch/CMakeL10n.txt
  28. +3
    -0
      ktouch/src/CMakeL10n.txt
  29. +3
    -0
      kturtle/CMakeL10n.txt
  30. +3
    -0
      kturtle/src/CMakeL10n.txt
  31. +3
    -0
      kverbos/CMakeL10n.txt
  32. +3
    -0
      kverbos/kverbos/CMakeL10n.txt
  33. +3
    -0
      kvoctrain/CMakeL10n.txt
  34. +3
    -0
      kvoctrain/kvoctrain/CMakeL10n.txt
  35. +3
    -0
      kwordquiz/CMakeL10n.txt
  36. +3
    -0
      kwordquiz/src/CMakeL10n.txt
  37. +3
    -0
      libtdeedu/CMakeL10n.txt

+ 28
- 0
CMakeL10n.txt View File

@@ -0,0 +1,28 @@
#################################################
#
# (C) 2018 Slávek Banko
# slavek.banko (AT) axis.cz
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################

cmake_minimum_required( VERSION 2.8 )


##### include our cmake modules #################

set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
include( TDEL10n )


##### set directory for POT files ###############

set( POT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../tde-i18n/template/messages/tdeedu" )


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

tde_l10n_auto_add_subdirectories()

+ 3
- 0
blinken/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_auto_add_subdirectories( )

+ 3
- 0
blinken/src/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_create_template( "blinken" )

+ 3
- 0
kalzium/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_auto_add_subdirectories( )

+ 30
- 0
kalzium/src/CMakeL10n.txt View File

@@ -0,0 +1,30 @@
##### prepare xml files #########################

tde_l10n_prepare_xml(
SOURCE data/data.xml
TAGS name
)

tde_l10n_prepare_xml(
SOURCE data/knowledge.xml
TAGS name desc refitem
)

tde_l10n_prepare_xml(
SOURCE data/tools.xml
TAGS name desc
)


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

tde_l10n_create_template(
CATALOG "kalzium"
SOURCES
"."
"data/data.xml.tde_l10n"
"data/knowledge.xml.tde_l10n"
"data/tools.xml.tde_l10n"
ATTRIBUTES
"data/data.xml:name,origin"
)

+ 3
- 0
kanagram/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_auto_add_subdirectories( )

+ 3
- 0
kanagram/src/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_create_template( "kanagram" )

+ 3
- 0
kbruch/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_auto_add_subdirectories( )

+ 3
- 0
kbruch/src/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_create_template( "kbruch" )

+ 3
- 0
keduca/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_create_template( "keduca" )

+ 3
- 0
kgeography/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_auto_add_subdirectories( )

+ 3
- 0
kgeography/src/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_create_template( "kgeography" )

+ 3
- 0
khangman/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_auto_add_subdirectories( )

+ 6
- 0
khangman/khangman/CMakeL10n.txt View File

@@ -0,0 +1,6 @@
##### create translation templates ##############

tde_l10n_create_template(
CATALOG "khangman"
SOURCES "data.i18n" "."
)

+ 39
- 0
kig/CMakeL10n.txt View File

@@ -0,0 +1,39 @@
##### prepare kig templates #####################

file( GLOB_RECURSE _kigt_files
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/macros/*.kigt
)
list( SORT _kigt_files )
unset( _kigt_l10n )
foreach( _kigt_file ${_kigt_files} )
tde_l10n_prepare_xml(
SOURCE ${_kigt_file}
TAGS "Name" "Description" "UseText" "SelectStatement"
C_FORMAT
)
list( APPEND _kigt_l10n "${_kigt_file}.tde_l10n" )
endforeach( )


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

tde_l10n_create_template(
CATALOG "kig"
SOURCES
"."
"data/tips"
${_kigt_l10n}
EXCLUDES
"^tdefile/"
)

tde_l10n_create_template(
CATALOG "tdefile_drgeo"
SOURCES "tdefile/tdefile_drgeo.cpp" "tdefile/tdefile_drgeo.h"
)

tde_l10n_create_template(
CATALOG "tdefile_kig"
SOURCES "tdefile/tdefile_kig.cpp" "tdefile/tdefile_kig.h"
)

+ 3
- 0
kiten/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_create_template( "kiten" )

+ 3
- 0
klatin/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_auto_add_subdirectories( )

+ 3
- 0
klatin/klatin/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_create_template( "klatin" )

+ 3
- 0
klettres/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_auto_add_subdirectories( )

+ 3
- 0
klettres/klettres/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_create_template( "klettres" )

+ 3
- 0
kmplot/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_auto_add_subdirectories( )

+ 3
- 0
kmplot/kmplot/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_create_template( "kmplot" )

+ 3
- 0
kpercentage/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_auto_add_subdirectories( )

+ 17
- 0
kpercentage/kpercentage/CMakeL10n.txt View File

@@ -0,0 +1,17 @@
##### prepare right and wrong files #############

unset( _answers_l10n )
foreach( _answers right.txt wrong.txt )
file( READ "${CMAKE_CURRENT_SOURCE_DIR}/${_answers}" _file_data )
string( REGEX REPLACE "(^|\n)([^\n]+)" "\\1i18n(\"\\2\");" _file_l10n "${_file_data}" )
file( WRITE "${CMAKE_CURRENT_SOURCE_DIR}/${_answers}.tde_l10n" "${_file_l10n}" )
list( APPEND _answers_l10n "${_answers}.tde_l10n" )
endforeach( )


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

tde_l10n_create_template(
CATALOG "kpercentage"
SOURCES "." ${_answers_l10n}
)

+ 3
- 0
kstars/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_auto_add_subdirectories( )

+ 155
- 0
kstars/kstars/CMakeL10n.txt View File

@@ -0,0 +1,155 @@
##### prepare strings from data files ###########

message( STATUS "Prepare to extract strings from kstars data files..." )

## extract constellations
file( READ "${CMAKE_CURRENT_SOURCE_DIR}/data/cnames.dat" _cnames )
string( REGEX REPLACE " +(\n|\$)" "\\1" _cnames "${_cnames}" )
string( REGEX REPLACE
"(^|\n)[0-9][^ ]* ([^\n]+)"
"\\1i18n(\"Constellation name (optional)\", \"\\2\");"
_cnames "${_cnames}" )
file( WRITE "${CMAKE_CURRENT_SOURCE_DIR}/data/cnames.dat.tde_l10n" "${_cnames}" )

## extract cities, regions and countries
file( READ "${CMAKE_CURRENT_SOURCE_DIR}/data/Cities.dat" _cities )
string( REGEX REPLACE "(^|\n)([^:]*): *([^:]*): *([^:]*):[^\n]*" "\\1\\2:\\3:\\4:" _cities "${_cities}" )
string( REGEX REPLACE " +:" ":" _cities "${_cities}" )
string( REGEX REPLACE
"([^:]+):([^:]*):([^:]*):(\n|\$)"
"i18n(\"City name (optional, probably does not need a translation)\", \"\\1\"):\\2:\\3:\\4"
_cities "${_cities}" )
string( REGEX REPLACE
"([^:]*):([^:]+):([^:]*):(\n|\$)"
"\\1:i18n(\"Region/state name (optional, rarely needs a translation)\", \"\\2\"):\\3:\\4"
_cities "${_cities}" )
string( REGEX REPLACE
"([^:]*):([^:]*):([^:]+):(\n|\$)"
"\\1:\\2:i18n(\"Country name (optional, but should be translated)\", \"\\3\"):\\4"
_cities "${_cities}" )
string( REPLACE ":" ";" _cities "${_cities}" )
file( WRITE "${CMAKE_CURRENT_SOURCE_DIR}/data/Cities.dat.tde_l10n" "${_cities}" )

## extract image/info menu items
file( READ "${CMAKE_CURRENT_SOURCE_DIR}/data/image_url.dat" _image_url )
string( REGEX REPLACE
"([^:\n]*):([^:\n]+):http[^\n]*\n"
"i18n(\"Image/info menu item (should be translated)\", \"\\2\");\n"
_image_url "${_image_url}" )
string( REGEX REPLACE "(^|\n)#" "\\1//" _image_url "${_image_url}" )
file( WRITE "${CMAKE_CURRENT_SOURCE_DIR}/data/image_url.dat.tde_l10n" "${_image_url}" )

file( READ "${CMAKE_CURRENT_SOURCE_DIR}/data/info_url.dat" _info_url )
string( REGEX REPLACE
"([^:\n]*):([^:\n]+):http[^\n]*\n"
"i18n(\"Image/info menu item (should be translated)\", \"\\2\");\n"
_info_url "${_info_url}" )
string( REGEX REPLACE "(^|\n)#" "\\1//" _info_url "${_info_url}" )
file( WRITE "${CMAKE_CURRENT_SOURCE_DIR}/data/info_url.dat.tde_l10n" "${_info_url}" )

## star names : some might be different in other languages,
## or they might have to be adapted to non-Latin alphabets
file( GLOB_RECURSE _hip_files
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/data/hip*.dat
)
list( SORT _hip_files )
unset( _hip_files_l10n )
foreach( _hip_file ${_hip_files} )
# read file
file( READ "${CMAKE_CURRENT_SOURCE_DIR}/${_hip_file}" _hip_data )
string( REGEX REPLACE "[^\n]" "" _hip_len ${_hip_data} )
string( LENGTH "+${_hip_len}" _hip_len )

# process lines
set( _hip_pos 0 )
unset( _hip_l10n )
while( _hip_pos LESS ${_hip_len} )
# pick line
string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\1" _hip_line "${_hip_data}" )
string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\2" _hip_data "${_hip_data}" )
math( EXPR _hip_pos "${_hip_pos}+1" )

string( LENGTH "${_hip_line}" _hip_line_len )
if( _hip_line_len LESS 72 OR "${_hip_line}" MATCHES "^#" )
set( _hip_line "" )
else( )
string( SUBSTRING "${_hip_line}" 72 -1 _hip_line )
string( REGEX MATCH "^([^:]+)" _hip_line "${_hip_line}" )
string( STRIP "${_hip_line}" _hip_line )
if( NOT "${_hip_line}" STREQUAL "" )
set( _hip_line "i18n(\"star name\", \"${_hip_line}\");" )
endif( )
endif( )
set( _hip_l10n "${_hip_l10n}${_hip_line}\n" )
endwhile( )

# write file
file( WRITE "${CMAKE_CURRENT_SOURCE_DIR}/${_hip_file}.tde_l10n" "${_hip_l10n}" )
list( APPEND _hip_files_l10n "${_hip_file}.tde_l10n" )
endforeach( )

## extract deep-sky object names
file( GLOB_RECURSE _ngcic_files
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/data/ngcic*.dat
)
list( SORT _ngcic_files )
unset( _ngcic_files_l10n )
foreach( _ngcic_file ${_ngcic_files} )
# read file
file( READ "${CMAKE_CURRENT_SOURCE_DIR}/${_ngcic_file}" _ngcic_data )
string( REGEX REPLACE "[^\n]" "" _ngcic_len ${_ngcic_data} )
string( LENGTH "+${_ngcic_len}" _ngcic_len )

# process lines
set( _ngcic_pos 0 )
unset( _ngcic_l10n )
while( _ngcic_pos LESS ${_ngcic_len} )
# pick line
string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\1" _ngcic_line "${_ngcic_data}" )
string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\2" _ngcic_data "${_ngcic_data}" )
math( EXPR _ngcic_pos "${_ngcic_pos}+1" )

string( LENGTH "${_ngcic_line}" _ngcic_line_len )
if( _ngcic_line_len LESS 76 OR "${_ngcic_line}" MATCHES "^#" )
set( _ngcic_line "" )
else( )
string( SUBSTRING "${_ngcic_line}" 76 -1 _ngcic_line )
string( STRIP "${_ngcic_line}" _ngcic_line )
if( NOT "${_ngcic_line}" STREQUAL "" )
set( _ngcic_line "i18n(\"object name (optional)\", \"${_ngcic_line}\");" )
endif( )
endif( )
set( _ngcic_l10n "${_ngcic_l10n}${_ngcic_line}\n" )
endwhile( )

# write file
file( WRITE "${CMAKE_CURRENT_SOURCE_DIR}/${_ngcic_file}.tde_l10n" "${_ngcic_l10n}" )
list( APPEND _ngcic_files_l10n "${_ngcic_file}.tde_l10n" )
endforeach( )

## extract strings from file containing advanced URLs:
file( READ "${CMAKE_CURRENT_SOURCE_DIR}/data/advinterface.dat" _kslabel )
string( REGEX REPLACE
"\\[KSLABEL\\]([^\n]*)(\n|\$)"
"i18n(\"Advanced URLs: description or category\", \"\\1\");\\2"
_kslabel "${_kslabel}" )
file( WRITE "${CMAKE_CURRENT_SOURCE_DIR}/data/advinterface.dat.tde_l10n" "${_kslabel}" )


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

tde_l10n_create_template(
CATALOG "kstars"
SOURCES
"."
"data/tips"
"data/cnames.dat.tde_l10n"
"data/Cities.dat.tde_l10n"
"data/image_url.dat.tde_l10n"
"data/info_url.dat.tde_l10n"
${_hip_files_l10n}
${_ngcic_files_l10n}
"data/advinterface.dat.tde_l10n"
)

+ 3
- 0
ktouch/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_auto_add_subdirectories( )

+ 3
- 0
ktouch/src/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_create_template( "ktouch" )

+ 3
- 0
kturtle/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_auto_add_subdirectories( )

+ 3
- 0
kturtle/src/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_create_template( "kturtle" )

+ 3
- 0
kverbos/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_auto_add_subdirectories( )

+ 3
- 0
kverbos/kverbos/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_create_template( "kverbos" )

+ 3
- 0
kvoctrain/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_auto_add_subdirectories( )

+ 3
- 0
kvoctrain/kvoctrain/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_create_template( "kvoctrain" )

+ 3
- 0
kwordquiz/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_auto_add_subdirectories( )

+ 3
- 0
kwordquiz/src/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_create_template( "kwordquiz" )

+ 3
- 0
libtdeedu/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
##### create translation templates ##############

tde_l10n_create_template( "libtdeedu" )

Loading…
Cancel
Save