Uploaded image for project: 'translate5'
  1. translate5
  2. TRANSLATE-411

CSV-import with tag protection, whitespace protection and REGEX-sensitive protection

    XMLWordPrintable

Details

    • New Feature
    • Resolution: Fixed
    • None
    • None
    • Import/Export

    Description

      For the structure and usage of the used task-template.xml see attached example file.

      whitespace

      All whitespace except a single space is always protected as tags. This can not be switched off. With several normal space characters directly after each other, the first one is left as space, and the others will be protected as one tag.

      tag protection

      CSV-import can be set to a mode that tags are recognized. This is done via a "task-template.xml"-file in the root of an import-zip-package of translate5.

      If this mode is active, brackets have to be encoded as entities if they where meant as normal characters

       ">" should become >
      

      The tagged text can be as complex as a normal xml-structure, e.g. it can consist of opening- and closing-paired-tags as well as empty self-closing-tags (single-tags). All tags are allowed as a tag that has the format it should have in regard to xml definition. However, the content of a CSV-cell does not have to be well-formed - it is allowed to only have opening or closing tags in it without the correspondig paired tag. In this case however all tags in the segment are transformed to placeholder tags - regardless if they have a potentially matching counterpart or not.

      A sample csv-file with tagged text is attached.

      REGEX-sensitive protection

      A "task-template.xml"-file can pass a number of regular expression (PHP-PCRE-Syntax including modifiers). Everything matched with one of these REGEX will be converted to a single tag within translate5. Be carefull of possible security flaws like inserting php-code in the regular-expression passed in task-template.xml. It must be ensured, that nothing passed as REGEX will be evaluated as PHP-code. The simplest way might be to ensure, that no string identifiers (see http://php.net/manual/en/language.types.string.php) are used within the passed REGEX, unless they are not escaped by a backslash. In addition the REGEX should be checked against a REGEX to test, if it really is a REGEX, like described in the best voted answer here: http://stackoverflow.com/questions/172303/is-there-a-regular-expression-to-detect-a-valid-regular-expression

      Attachments

        1. task-template.xml
          3 kB
          Marc Mittag [Administrator]

        Issue Links

          Activity

            People

              Stephan Stephan Bergmann
              Stephan Stephan Bergmann
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: