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 -def define_tables():
     24      # Copied from git commit 96b9f1419453d8079dd1631c329f04d6e005baae from
     25      # git://hforge.org/itools.git
     26      config_uri = 'urn:oasis:names:tc:opendocument:xmlns:config:1.0'
     27      dc_uri = 'http://purl.org/dc/elements/1.1/'
     28      form_uri = 'urn:oasis:names:tc:opendocument:xmlns:form:1.0'
     29      meta_uri = 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0'
     30      number_uri = 'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0'
     31      office_uri = 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'
     32      presentation_uri = 'urn:oasis:names:tc:opendocument:xmlns:presentation:1.0'
     33      text_uri = 'urn:oasis:names:tc:opendocument:xmlns:text:1.0'
     34      svg_uri = 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0'
     35
     36      inline_elements = [
     37          (text_uri, 'page-count'),
     38          (text_uri, 'page-number'),
     39
     40          (text_uri, 'a'),
     41          (text_uri, 'line-break'),
     42          (text_uri, 'ruby-base'),
     43          (text_uri, 's'),
     44          (text_uri, 'span'),
     45          (text_uri, 'tab')]
     46
     47      no_translate_content_elements = [
     48
     49          # Config
     50          (config_uri, 'config-item'),
     51
     52          # Dublin core
     53          (dc_uri, 'creator'),
     54          (dc_uri, 'date'),
     55          #(dc_uri, 'description'),
     56          (dc_uri, 'language'),
     57          #(dc_uri, 'subject'),
     58          #(dc_uri, 'title'),
     59
     60          # Form
     61          (form_uri, 'item'),
     62          (form_uri, 'option'),
     63
     64          # Meta
     65          (meta_uri, 'creation-date'),
     66          (meta_uri, 'date-string'),
     67          (meta_uri, 'editing-cycles'),
     68          (meta_uri, 'editing-duration'),
     69          (meta_uri, 'generator'),
     70          (meta_uri, 'initial-creator'),
     71          #(meta_uri, 'keyword'),
     72          (meta_uri, 'printed-by'),
     73          (meta_uri, 'print-date'),
     74          (meta_uri, 'user-defined'),
     75
     76          # Number
     77          (number_uri, 'currency-symbol'),
     78          (number_uri, 'embedded-text'),
     79          (number_uri, 'text'),
     80
     81          # Office
     82          (office_uri, 'binary-data'),
     83
     84          # Presentation
     85          (presentation_uri, 'date-time-decl'),
     86          #(presentation_uri, 'footer-decl'),
     87          #(presentation_uri, 'header-decl'),
     88
     89          # Text
     90          (text_uri, 'author-initials'),
     91          (text_uri, 'author-name'),
     92          # XXX (text_uri, 'bibliography-mark'),
     93          (text_uri, 'bookmark-ref'),
     94          #(text_uri, 'chapter'),
     95          (text_uri, 'character-count'),
     96          #(text_uri, 'conditional-text'),
     97          (text_uri, 'creation-date'),
     98          (text_uri, 'creation-time'),
     99          (text_uri, 'creator'),
    100          (text_uri, 'date'),
    101          (text_uri, 'dde-connection'),
    102          #(text_uri, 'description'),
    103          (text_uri, 'editing-cycles'),
    104          (text_uri, 'editing-duration'),
    105          (text_uri, 'expression'),
    106          (text_uri, 'file-name'),
    107          #(text_uri, 'hidden-paragraph'),
    108          #(text_uri, 'hidden-text'),
    109          (text_uri, 'image-count'),
    110          #(text_uri, 'index-entry-span'),
    111          (text_uri, 'index-title-template'),
    112          (text_uri, 'initial-creator'),
    113          #(text_uri, 'keywords'),
    114          (text_uri, 'linenumbering-separator'),
    115          (text_uri, 'measure'),
    116          (text_uri, 'modification-date'),
    117          (text_uri, 'modification-time'),
    118          #(text_uri, 'note-citation'),
    119          #(text_uri, 'note-continuation-notice-backward'),
    120          #(text_uri, 'note-continuation-notice-forward'),
    121          (text_uri, 'note-ref'),
    122          (text_uri, 'number'),
    123          (text_uri, 'object-count'),
    124          (text_uri, 'page-continuation'),
    125          (text_uri, 'page-count'),
    126          (text_uri, 'page-number'),
    127          (text_uri, 'page-variable-get'),
    128          (text_uri, 'page-variable-set'),
    129          (text_uri, 'paragraph-count'),
    130          #(text_uri, 'placeholder'),
    131          (text_uri, 'print-date'),
    132          (text_uri, 'print-time'),
    133          (text_uri, 'printed-by'),
    134          (text_uri, 'reference-ref'),
    135          #(text_uri, 'ruby-text'),
    136          (text_uri, 'script'),
    137          (text_uri, 'sender-city'),
    138          (text_uri, 'sender-company'),
    139          (text_uri, 'sender-country'),
    140          (text_uri, 'sender-email'),
    141          (text_uri, 'sender-fax'),
    142          (text_uri, 'sender-firstname'),
    143          (text_uri, 'sender-initials'),
    144          (text_uri, 'sender-lastname'),
    145          (text_uri, 'sender-phone-private'),
    146          (text_uri, 'sender-phone-work'),
    147          #(text_uri, 'sender-position'),
    148          (text_uri, 'sender-postal-code'),
    149          (text_uri, 'sender-state-or-province'),
    150          (text_uri, 'sender-street'),
    151          #(text_uri, 'sender-title'),
    152          (text_uri, 'sequence'),
    153          (text_uri, 'sequence-ref'),
    154          (text_uri, 'sheet-name'),
    155          #(text_uri, 'subject'),
    156          (text_uri, 'table-count'),
    157          (text_uri, 'table-formula'),
    158          (text_uri, 'template-name'),
    159          (text_uri, 'text-input'),
    160          (text_uri, 'time'),
    161          #(text_uri, 'title'),
    162          (text_uri, 'user-defined'),
    163          (text_uri, 'user-field-get'),
    164          (text_uri, 'user-field-input'),
    165          (text_uri, 'variable-get'),
    166          (text_uri, 'variable-input'),
    167          (text_uri, 'variable-set'),
    168          (text_uri, 'word-count'),
    169
    170          # SVG
    171          #(svg_uri, 'title'),
    172          #(svg_uri, 'desc')
    173
    174          # From translate
    175          (text_uri, 'tracked-changes')
    176          ]
    177
    178      globals()['inline_elements'] = inline_elements
    179      globals()['no_translate_content_elements'] = no_translate_content_elements
    180
    181  try:
    182      from itools.odf.schema import inline_elements
    183      from itools.odf.schema import no_translate_content_elements
    184
    185  except:
    186      define_tables()
    187