Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/translate-toolkit-1.5.1/translate/storage/odf_shared.py
blob: 6f6da4756e6a580c27ffc50c0c165b0cf69fd1f6 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2004-2006 Zuza Software Foundation
#
# This file is part of translate.
#
# translate is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# translate is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with translate; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#

def define_tables():
    # Copied from git commit 96b9f1419453d8079dd1631c329f04d6e005baae from
    # git://hforge.org/itools.git
    config_uri = 'urn:oasis:names:tc:opendocument:xmlns:config:1.0'
    dc_uri = 'http://purl.org/dc/elements/1.1/'
    form_uri = 'urn:oasis:names:tc:opendocument:xmlns:form:1.0'
    meta_uri = 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0'
    number_uri = 'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0'
    office_uri = 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'
    presentation_uri = 'urn:oasis:names:tc:opendocument:xmlns:presentation:1.0'
    text_uri = 'urn:oasis:names:tc:opendocument:xmlns:text:1.0'
    svg_uri = 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0'
    
    inline_elements = [
        (text_uri, 'page-count'),
        (text_uri, 'page-number'),
    
        (text_uri, 'a'),
        (text_uri, 'line-break'),
        (text_uri, 'ruby-base'),
        (text_uri, 's'),
        (text_uri, 'span'),
        (text_uri, 'tab')]
    
    no_translate_content_elements = [
    
        # Config
        (config_uri, 'config-item'),
    
        # Dublin core
        (dc_uri, 'creator'),
        (dc_uri, 'date'),
        #(dc_uri, 'description'),
        (dc_uri, 'language'),
        #(dc_uri, 'subject'),
        #(dc_uri, 'title'),
    
        # Form
        (form_uri, 'item'),
        (form_uri, 'option'),
    
        # Meta
        (meta_uri, 'creation-date'),
        (meta_uri, 'date-string'),
        (meta_uri, 'editing-cycles'),
        (meta_uri, 'editing-duration'),
        (meta_uri, 'generator'),
        (meta_uri, 'initial-creator'),
        #(meta_uri, 'keyword'),
        (meta_uri, 'printed-by'),
        (meta_uri, 'print-date'),
        (meta_uri, 'user-defined'),
    
        # Number
        (number_uri, 'currency-symbol'),
        (number_uri, 'embedded-text'),
        (number_uri, 'text'),
    
        # Office
        (office_uri, 'binary-data'),
    
        # Presentation
        (presentation_uri, 'date-time-decl'),
        #(presentation_uri, 'footer-decl'),
        #(presentation_uri, 'header-decl'),
    
        # Text
        (text_uri, 'author-initials'),
        (text_uri, 'author-name'),
        # XXX (text_uri, 'bibliography-mark'),
        (text_uri, 'bookmark-ref'),
        #(text_uri, 'chapter'),
        (text_uri, 'character-count'),
        #(text_uri, 'conditional-text'),
        (text_uri, 'creation-date'),
        (text_uri, 'creation-time'),
        (text_uri, 'creator'),
        (text_uri, 'date'),
        (text_uri, 'dde-connection'),
        #(text_uri, 'description'),
        (text_uri, 'editing-cycles'),
        (text_uri, 'editing-duration'),
        (text_uri, 'expression'),
        (text_uri, 'file-name'),
        #(text_uri, 'hidden-paragraph'),
        #(text_uri, 'hidden-text'),
        (text_uri, 'image-count'),
        #(text_uri, 'index-entry-span'),
        (text_uri, 'index-title-template'),
        (text_uri, 'initial-creator'),
        #(text_uri, 'keywords'),
        (text_uri, 'linenumbering-separator'),
        (text_uri, 'measure'),
        (text_uri, 'modification-date'),
        (text_uri, 'modification-time'),
        #(text_uri, 'note-citation'),
        #(text_uri, 'note-continuation-notice-backward'),
        #(text_uri, 'note-continuation-notice-forward'),
        (text_uri, 'note-ref'),
        (text_uri, 'number'),
        (text_uri, 'object-count'),
        (text_uri, 'page-continuation'),
        (text_uri, 'page-count'),
        (text_uri, 'page-number'),
        (text_uri, 'page-variable-get'),
        (text_uri, 'page-variable-set'),
        (text_uri, 'paragraph-count'),
        #(text_uri, 'placeholder'),
        (text_uri, 'print-date'),
        (text_uri, 'print-time'),
        (text_uri, 'printed-by'),
        (text_uri, 'reference-ref'),
        #(text_uri, 'ruby-text'),
        (text_uri, 'script'),
        (text_uri, 'sender-city'),
        (text_uri, 'sender-company'),
        (text_uri, 'sender-country'),
        (text_uri, 'sender-email'),
        (text_uri, 'sender-fax'),
        (text_uri, 'sender-firstname'),
        (text_uri, 'sender-initials'),
        (text_uri, 'sender-lastname'),
        (text_uri, 'sender-phone-private'),
        (text_uri, 'sender-phone-work'),
        #(text_uri, 'sender-position'),
        (text_uri, 'sender-postal-code'),
        (text_uri, 'sender-state-or-province'),
        (text_uri, 'sender-street'),
        #(text_uri, 'sender-title'),
        (text_uri, 'sequence'),
        (text_uri, 'sequence-ref'),
        (text_uri, 'sheet-name'),
        #(text_uri, 'subject'),
        (text_uri, 'table-count'),
        (text_uri, 'table-formula'),
        (text_uri, 'template-name'),
        (text_uri, 'text-input'),
        (text_uri, 'time'),
        #(text_uri, 'title'),
        (text_uri, 'user-defined'),
        (text_uri, 'user-field-get'),
        (text_uri, 'user-field-input'),
        (text_uri, 'variable-get'),
        (text_uri, 'variable-input'),
        (text_uri, 'variable-set'),
        (text_uri, 'word-count'),
    
        # SVG
        #(svg_uri, 'title'),
        #(svg_uri, 'desc')
    
        # From translate
        (text_uri, 'tracked-changes')
        ]

    globals()['inline_elements'] = inline_elements
    globals()['no_translate_content_elements'] = no_translate_content_elements

try:
    from itools.odf.schema import inline_elements
    from itools.odf.schema import no_translate_content_elements
    
except:
    define_tables()