Package translate :: Package storage :: Module odf_shared

[hide private]
[frames] | no frames]

# Source Code for Module translate.storage.odf_shared

      1  #!/usr/bin/env python
      2  # -*- coding: utf-8 -*-
      3  #
      4  # Copyright 2004-2006 Zuza Software Foundation
      5  #
      6  # This file is part of translate.
      7  #
      8  # translate is free software; you can redistribute it and/or modify
      9  # it under the terms of the GNU General Public License as published by
     10  # the Free Software Foundation; either version 2 of the License, or
     11  # (at your option) any later version.
     12  #
     13  # translate is distributed in the hope that it will be useful,
     14  # but WITHOUT ANY WARRANTY; without even the implied warranty of
     15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16  # GNU General Public License for more details.
     17  #
     18  # You should have received a copy of the GNU General Public License
     19  # along with translate; if not, write to the Free Software
     20  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     21  #
     22
     23
     24 -def define_tables():
     25      # Copied from git commit 96b9f1419453d8079dd1631c329f04d6e005baae from
     26      # git://hforge.org/itools.git
     27      config_uri = 'urn:oasis:names:tc:opendocument:xmlns:config:1.0'
     28      dc_uri = 'http://purl.org/dc/elements/1.1/'
     29      form_uri = 'urn:oasis:names:tc:opendocument:xmlns:form:1.0'
     30      meta_uri = 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0'
     31      number_uri = 'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0'
     32      office_uri = 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'
     33      presentation_uri = 'urn:oasis:names:tc:opendocument:xmlns:presentation:1.0'
     34      text_uri = 'urn:oasis:names:tc:opendocument:xmlns:text:1.0'
     35      svg_uri = 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0'
     36
     37      inline_elements = [
     38          (text_uri, 'page-count'),
     39          (text_uri, 'page-number'),
     40
     41          (text_uri, 'a'),
     42          (text_uri, 'line-break'),
     43          (text_uri, 'ruby-base'),
     44          (text_uri, 's'),
     45          (text_uri, 'span'),
     46          (text_uri, 'tab')]
     47
     48      no_translate_content_elements = [
     49
     50          # Config
     51          (config_uri, 'config-item'),
     52
     53          # Dublin core
     54          (dc_uri, 'creator'),
     55          (dc_uri, 'date'),
     56          #(dc_uri, 'description'),
     57          (dc_uri, 'language'),
     58          #(dc_uri, 'subject'),
     59          #(dc_uri, 'title'),
     60
     61          # Form
     62          (form_uri, 'item'),
     63          (form_uri, 'option'),
     64
     65          # Meta
     66          (meta_uri, 'creation-date'),
     67          (meta_uri, 'date-string'),
     68          (meta_uri, 'editing-cycles'),
     69          (meta_uri, 'editing-duration'),
     70          (meta_uri, 'generator'),
     71          (meta_uri, 'initial-creator'),
     72          #(meta_uri, 'keyword'),
     73          (meta_uri, 'printed-by'),
     74          (meta_uri, 'print-date'),
     75          (meta_uri, 'user-defined'),
     76
     77          # Number
     78          (number_uri, 'currency-symbol'),
     79          (number_uri, 'embedded-text'),
     80          (number_uri, 'text'),
     81
     82          # Office
     83          (office_uri, 'binary-data'),
     84
     85          # Presentation
     86          (presentation_uri, 'date-time-decl'),
     87          #(presentation_uri, 'footer-decl'),
     88          #(presentation_uri, 'header-decl'),
     89
     90          # Text
     91          (text_uri, 'author-initials'),
     92          (text_uri, 'author-name'),
     93          # XXX (text_uri, 'bibliography-mark'),
     94          (text_uri, 'bookmark-ref'),
     95          #(text_uri, 'chapter'),
     96          (text_uri, 'character-count'),
     97          #(text_uri, 'conditional-text'),
     98          (text_uri, 'creation-date'),
     99          (text_uri, 'creation-time'),
    100          (text_uri, 'creator'),
    101          (text_uri, 'date'),
    102          (text_uri, 'dde-connection'),
    103          #(text_uri, 'description'),
    104          (text_uri, 'editing-cycles'),
    105          (text_uri, 'editing-duration'),
    106          (text_uri, 'expression'),
    107          (text_uri, 'file-name'),
    108          #(text_uri, 'hidden-paragraph'),
    109          #(text_uri, 'hidden-text'),
    110          (text_uri, 'image-count'),
    111          #(text_uri, 'index-entry-span'),
    112          (text_uri, 'index-title-template'),
    113          (text_uri, 'initial-creator'),
    114          #(text_uri, 'keywords'),
    115          (text_uri, 'linenumbering-separator'),
    116          (text_uri, 'measure'),
    117          (text_uri, 'modification-date'),
    118          (text_uri, 'modification-time'),
    119          #(text_uri, 'note-citation'),
    120          #(text_uri, 'note-continuation-notice-backward'),
    121          #(text_uri, 'note-continuation-notice-forward'),
    122          (text_uri, 'note-ref'),
    123          (text_uri, 'number'),
    124          (text_uri, 'object-count'),
    125          (text_uri, 'page-continuation'),
    126          (text_uri, 'page-count'),
    127          (text_uri, 'page-number'),
    128          (text_uri, 'page-variable-get'),
    129          (text_uri, 'page-variable-set'),
    130          (text_uri, 'paragraph-count'),
    131          #(text_uri, 'placeholder'),
    132          (text_uri, 'print-date'),
    133          (text_uri, 'print-time'),
    134          (text_uri, 'printed-by'),
    135          (text_uri, 'reference-ref'),
    136          #(text_uri, 'ruby-text'),
    137          (text_uri, 'script'),
    138          (text_uri, 'sender-city'),
    139          (text_uri, 'sender-company'),
    140          (text_uri, 'sender-country'),
    141          (text_uri, 'sender-email'),
    142          (text_uri, 'sender-fax'),
    143          (text_uri, 'sender-firstname'),
    144          (text_uri, 'sender-initials'),
    145          (text_uri, 'sender-lastname'),
    146          (text_uri, 'sender-phone-private'),
    147          (text_uri, 'sender-phone-work'),
    148          #(text_uri, 'sender-position'),
    149          (text_uri, 'sender-postal-code'),
    150          (text_uri, 'sender-state-or-province'),
    151          (text_uri, 'sender-street'),
    152          #(text_uri, 'sender-title'),
    153          (text_uri, 'sequence'),
    154          (text_uri, 'sequence-ref'),
    155          (text_uri, 'sheet-name'),
    156          #(text_uri, 'subject'),
    157          (text_uri, 'table-count'),
    158          (text_uri, 'table-formula'),
    159          (text_uri, 'template-name'),
    160          (text_uri, 'text-input'),
    161          (text_uri, 'time'),
    162          #(text_uri, 'title'),
    163          (text_uri, 'user-defined'),
    164          (text_uri, 'user-field-get'),
    165          (text_uri, 'user-field-input'),
    166          (text_uri, 'variable-get'),
    167          (text_uri, 'variable-input'),
    168          (text_uri, 'variable-set'),
    169          (text_uri, 'word-count'),
    170
    171          # SVG
    172          #(svg_uri, 'title'),
    173          #(svg_uri, 'desc')
    174
    175          # From translate
    176          (text_uri, 'tracked-changes'),
    177          ]
    178
    179      globals()['inline_elements'] = inline_elements
    180      globals()['no_translate_content_elements'] = no_translate_content_elements
    181
    182  try:
    183      from itools.odf.schema import inline_elements
    184      from itools.odf.schema import no_translate_content_elements
    185
    186  except:
    187      define_tables()
    188