Browse Source

Add CMakeL10n rules.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Slávek Banko 2 months ago
parent
commit
60f97e3b91
Signed by: Slávek Banko <slavek.banko@axis.cz> GPG Key ID: 608F5293A04BE668

+ 28
- 0
CMakeL10n.txt View File

@@ -0,0 +1,28 @@
1
+#################################################
2
+#
3
+#  (C) 2018-2019 Slávek Banko
4
+#  slavek.banko (AT) axis.cz
5
+#
6
+#  Improvements and feedback are welcome
7
+#
8
+#  This file is released under GPL >= 2
9
+#
10
+#################################################
11
+
12
+cmake_minimum_required( VERSION 2.8 )
13
+
14
+
15
+##### include our cmake modules #################
16
+
17
+set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
18
+include( TDEL10n )
19
+
20
+
21
+##### set directory for POT files ###############
22
+
23
+set( POT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../koffice-i18n/template/messages/koffice" )
24
+
25
+
26
+##### create translation templates ##############
27
+
28
+tde_l10n_auto_add_subdirectories( )

+ 112
- 0
chalk/CMakeL10n.txt View File

@@ -0,0 +1,112 @@
1
+#################################################
2
+#####
3
+##### from_hex( HEX DEC )
4
+#####
5
+
6
+function( from_hex HEX DEC )
7
+    string(SUBSTRING "${HEX}" 2 -1 HEX)
8
+    string(TOUPPER "${HEX}" HEX)
9
+    set(_res 0)
10
+    string(LENGTH "${HEX}" _strlen)
11
+
12
+    while(_strlen GREATER 0)
13
+        math(EXPR _res "${_res} * 16")
14
+        string(SUBSTRING "${HEX}" 0 1 NIBBLE)
15
+        string(SUBSTRING "${HEX}" 1 -1 HEX)
16
+        if(NIBBLE STREQUAL "A")
17
+            math(EXPR _res "${_res} + 10")
18
+        elseif(NIBBLE STREQUAL "B")
19
+            math(EXPR _res "${_res} + 11")
20
+        elseif(NIBBLE STREQUAL "C")
21
+            math(EXPR _res "${_res} + 12")
22
+        elseif(NIBBLE STREQUAL "D")
23
+            math(EXPR _res "${_res} + 13")
24
+        elseif(NIBBLE STREQUAL "E")
25
+            math(EXPR _res "${_res} + 14")
26
+        elseif(NIBBLE STREQUAL "F")
27
+            math(EXPR _res "${_res} + 15")
28
+        else()
29
+            math(EXPR _res "${_res} + ${NIBBLE}")
30
+        endif()
31
+
32
+        string(LENGTH "${HEX}" _strlen)
33
+    endwhile()
34
+
35
+    set(${DEC} ${_res} PARENT_SCOPE)
36
+endfunction()
37
+
38
+
39
+##### prepare strings from data files ###########
40
+
41
+file( GLOB_RECURSE _chalk_data_files
42
+      RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
43
+      ${CMAKE_CURRENT_SOURCE_DIR}/data/*.ggr
44
+      ${CMAKE_CURRENT_SOURCE_DIR}/data/*.gpl
45
+      ${CMAKE_CURRENT_SOURCE_DIR}/data/*.gih
46
+      ${CMAKE_CURRENT_SOURCE_DIR}/data/*.gbr
47
+      ${CMAKE_CURRENT_SOURCE_DIR}/data/*.pat
48
+)
49
+list( SORT _chalk_data_files )
50
+unset( _chalk_data_l10n )
51
+foreach( _chalk_file ${_chalk_data_files} )
52
+
53
+  if( "${_chalk_file}" MATCHES "\\.(ggr|gpl)" )
54
+    file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file} _file_data )
55
+    string( REGEX REPLACE "(^|\n)Name: ([^\n]+).*" "\\1i18n(\"\\2\");\\n" _file_l10n "${_file_data}" )
56
+    file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file}.tde_l10n "${_file_l10n}" )
57
+  endif( )
58
+
59
+  if( "${_chalk_file}" MATCHES "\\.gih" )
60
+    file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file} _file_data )
61
+    string( REGEX REPLACE "^([^\n]+).*" "i18n(\"\\1\");\\n" _file_l10n "${_file_data}" )
62
+    file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file}.tde_l10n "${_file_l10n}" )
63
+  endif( )
64
+
65
+  if( "${_chalk_file}" MATCHES "\\.gbr" )
66
+    file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file}
67
+          _file_head LIMIT 4 HEX )
68
+    from_hex( "0x${_file_head}" _file_head_size )
69
+    file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file}
70
+          _file_head LIMIT 4 OFFSET 4 HEX )
71
+    from_hex( "0x${_file_head}" _file_head_version )
72
+    if( "${_file_head_version}" EQUAL "1" )
73
+      math( EXPR _file_head_len "${_file_head_size} - 21" )
74
+      file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file}
75
+            _file_head LIMIT ${_file_head_len} OFFSET 20 )
76
+    else( )
77
+      math( EXPR _file_head_len "${_file_head_size} - 29" )
78
+      file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file}
79
+            _file_head LIMIT ${_file_head_len} OFFSET 28 )
80
+    endif( )
81
+    string( STRIP "${_file_head}" _file_head )
82
+    file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file}.tde_l10n
83
+          "i18n(\"${_file_head}\");\n" )
84
+  endif( )
85
+
86
+  if( "${_chalk_file}" MATCHES "\\.pat" )
87
+    file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file}
88
+          _file_head LIMIT 4 HEX )
89
+    from_hex( "0x${_file_head}" _file_head_size )
90
+    math( EXPR _file_head_len "${_file_head_size} - 25" )
91
+    file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file}
92
+          _file_head LIMIT ${_file_head_len} OFFSET 24 )
93
+    string( STRIP "${_file_head}" _file_head )
94
+    file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/${_chalk_file}.tde_l10n
95
+          "i18n(\"${_file_head}\");\n" )
96
+  endif( )
97
+
98
+  list( APPEND _chalk_data_l10n "${_chalk_file}.tde_l10n" )
99
+
100
+endforeach( )
101
+
102
+
103
+##### create translation templates ##############
104
+
105
+tde_l10n_create_template(
106
+    CATALOG "chalk"
107
+    SOURCES
108
+        ${_chalk_data_l10n}
109
+        "."
110
+)
111
+
112
+tde_l10n_auto_add_subdirectories( )

+ 3
- 0
chalk/plugins/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_auto_add_subdirectories( )

+ 3
- 0
chalk/plugins/viewplugins/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_auto_add_subdirectories( )

+ 3
- 0
chalk/plugins/viewplugins/screenshot/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "kscreenshot_plugin" )

+ 3
- 0
example/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "example" )

+ 3
- 0
filters/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "kofficefilters" )

+ 3
- 0
karbon/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "karbon" )

+ 3
- 0
kchart/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "kchart" )

+ 14
- 0
kexi/CMakeL10n.txt View File

@@ -0,0 +1,14 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template(
4
+    CATALOG "kexi"
5
+    EXCLUDES
6
+        "^3rdparty/"
7
+        "^doc/"
8
+        "^formeditor/"
9
+        "^plugins/scripting/"
10
+        "^scriptingplugins/"
11
+        "(^|/)tests/"
12
+)
13
+
14
+tde_l10n_auto_add_subdirectories( )

+ 3
- 0
kexi/formeditor/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "kformdesigner" )

+ 6
- 0
kformula/CMakeL10n.txt View File

@@ -0,0 +1,6 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template(
4
+    CATALOG "kformula"
5
+    SOURCES "." "tips"
6
+)

+ 29
- 0
kivio/CMakeL10n.txt View File

@@ -0,0 +1,29 @@
1
+##### prepare strings from data files ###########
2
+
3
+unset( _kivio_data_l10n )
4
+file( GLOB_RECURSE _kivio_data_files
5
+      RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
6
+      ${CMAKE_CURRENT_SOURCE_DIR}/*.shape
7
+)
8
+list( SORT _kivio_data_files )
9
+foreach( _kivio_file ${_kivio_data_files} )
10
+    tde_l10n_prepare_xml(
11
+        SOURCE "${_kivio_file}"
12
+        CONTEXT "Stencils"
13
+        TAGS "name"
14
+    )
15
+    list( APPEND _kivio_data_l10n "${_kivio_file}.tde_l10n" )
16
+endforeach( )
17
+
18
+
19
+##### create translation templates ##############
20
+
21
+tde_l10n_create_template(
22
+    CATALOG "kivio"
23
+    SOURCES
24
+        "."
25
+        ${_kivio_data_l10n}
26
+    ATTRIBUTES
27
+        "desc:Title,data,Stencils:Description,data,Stencils"
28
+        "*.sml:Title,data,Stencils:Description,data,Stencils"
29
+)

+ 3
- 0
koshell/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "koshell" )

+ 3
- 0
kounavail/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "kounavail" )

+ 10
- 0
kplato/CMakeL10n.txt View File

@@ -0,0 +1,10 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template(
4
+    CATALOG "kplato"
5
+    SOURCES
6
+        "."
7
+        "../kdgantt"
8
+    ATTRIBUTES
9
+        "reports/*.ktf:Label,Text"
10
+)

+ 3
- 0
kpresenter/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "kpresenter" )

+ 29
- 0
kspread/CMakeL10n.txt View File

@@ -0,0 +1,29 @@
1
+##### prepare strings from data files ###########
2
+
3
+file( GLOB_RECURSE _kspread_data_files
4
+      RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
5
+      ${CMAKE_CURRENT_SOURCE_DIR}/extensions/*.xml
6
+)
7
+list( SORT _kspread_data_files )
8
+unset( _kspread_data_l10n )
9
+foreach( _kspread_file ${_kspread_data_files} )
10
+    tde_l10n_prepare_xml(
11
+        SOURCE ${_kspread_file}
12
+        TAGS "Example" "GroupName" "Text" "Comment" "Syntax" "TypeName"
13
+    )
14
+    list( APPEND _kspread_data_l10n "${_kspread_file}.tde_l10n" )
15
+endforeach( )
16
+
17
+
18
+##### create translation templates ##############
19
+
20
+tde_l10n_create_template(
21
+    CATALOG "kspread"
22
+    SOURCES
23
+        "."
24
+        ${_kspread_data_l10n}
25
+    EXCLUDES
26
+        "^plugins/"
27
+)
28
+
29
+tde_l10n_auto_add_subdirectories( )

+ 3
- 0
kspread/plugins/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_auto_add_subdirectories( )

+ 3
- 0
kspread/plugins/calculator/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "kspreadcalc_calc" )

+ 3
- 0
kspread/plugins/insertcalendar/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "kspreadinsertcalendar" )

+ 6
- 0
kugar/CMakeL10n.txt View File

@@ -0,0 +1,6 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template(
4
+    CATALOG "kugar"
5
+    KEYWORDS "tr" "tqtr"
6
+)

+ 27
- 0
kword/CMakeL10n.txt View File

@@ -0,0 +1,27 @@
1
+##### prepare strings from data files ###########
2
+
3
+file( GLOB_RECURSE _kword_data_files
4
+      RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
5
+      ${CMAKE_CURRENT_SOURCE_DIR}/expression/*.xml
6
+)
7
+list( SORT _kword_data_files )
8
+unset( _kword_data_l10n )
9
+foreach( _kword_file ${_kword_data_files} )
10
+    tde_l10n_prepare_xml(
11
+        SOURCE ${_kword_file}
12
+        TAGS "Example" "GroupName" "Text" "Comment" "Syntax" "TypeName"
13
+    )
14
+    list( APPEND _kword_data_l10n "${_kword_file}.tde_l10n" )
15
+endforeach( )
16
+
17
+
18
+##### create translation templates ##############
19
+
20
+tde_l10n_create_template(
21
+    CATALOG "kword"
22
+    SOURCES
23
+        "."
24
+        ${_kword_data_l10n}
25
+)
26
+
27
+tde_l10n_auto_add_subdirectories( )

+ 8
- 0
lib/CMakeL10n.txt View File

@@ -0,0 +1,8 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template(
4
+    CATALOG "koffice"
5
+    EXCLUDES "^koproperty/"
6
+)
7
+
8
+tde_l10n_auto_add_subdirectories( )

+ 3
- 0
lib/koproperty/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "koproperty" )

+ 3
- 0
plugins/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_auto_add_subdirectories( )

+ 3
- 0
plugins/scan/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "kscan_plugin" )

+ 3
- 0
tools/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_auto_add_subdirectories( )

+ 3
- 0
tools/converter/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "koconverter" )

+ 3
- 0
tools/kthesaurus/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "kthesaurus" )

+ 3
- 0
tools/tdefile-plugins/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_auto_add_subdirectories( )

+ 3
- 0
tools/tdefile-plugins/abiword/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "tdefile_abiword" )

+ 3
- 0
tools/tdefile-plugins/gnumeric/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "tdefile_gnumeric" )

+ 3
- 0
tools/tdefile-plugins/koffice/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "tdefile_koffice" )

+ 3
- 0
tools/tdefile-plugins/ooo/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "tdefile_ooo" )

+ 3
- 0
tools/thesaurus/CMakeL10n.txt View File

@@ -0,0 +1,3 @@
1
+##### create translation templates ##############
2
+
3
+tde_l10n_create_template( "thesaurus_tool" )

Loading…
Cancel
Save