Okapi Framework - Filters

Ruby on Rails YAML Filter (BETA)

- Overview
- Processing Details
- Parameters

If you are using an Okapi Tool after the M9 release, you should be using the wiki online help:
http://www.opentag.com/okapi/wiki/index.php?title=YAML_Filter

Overview

The Ruby on Rails YAML Filter is an Okapi component that implements the IFilter interface for the YAML files used with Ruby on Rails. The filter is implemented in the class net.sf.okapi.filters.railsyaml.RailsYamlFilter of the Okapi library.

A YAML file looks like the example below. The parts highlited in green are extracted.

fr:
  activerecord:
    errors:
      template:
        header: 
          one: "Impossible d'enregistrer {{model}}: 1 erreur"
          other: "Impossible d'enregistrer {{model}}: {{count}} erreurs."
        body: "Veuillez vérifier les champs suivants :"
      messages:
        inclusion: "n'est pas inclus(e) dans la liste"
        exclusion: "n'est pas disponible"
        invalid: "n'est pas valide"
        confirmation: "ne concorde pas avec la confirmation"

Note that this filter does not support yet all YAML constructs. Only double-quoted entries are extracted.

Processing Details

Input Encoding

The filter decides which encoding to use for the input document using the following logic:

Line-Breaks

The type of line-breaks of the output is the same as the one of the original input.

Identifier

Each extracted entry is assigned as name the sequence of all its parents identifiers. For example, in the example above, the name of the text unit with the content "n'est pas disponible" is fr.activerecord.errors.messages.exclusion.

Parameters

The filter includes options to set given parts of the extracted text as inline codes, using regular expression.

Example of the options with three regular expressions:

#v1
useCodeFinder.b=true
codeFinderRules.count.i=3
codeFinderRules.rule0=%(([-0+#]?)[-0+#]?)((\d\$)?)(([\d\*]*)(\.[\d\*]*)?)[dioxXucsfeEgGpnYyBbHhSMmAZ]
codeFinderRules.rule1=(\\r\\n)|\\a|\\b|\\f|\\n|\\r|\\t|\\v
codeFinderRules.rule2=\{\{\w.*?\}\}