Labs/Ubiquity/Parser 2/Localization Tutorial: Difference between revisions

No edit summary
Line 19: Line 19:


== The structure of the language file ==
== The structure of the language file ==
Each language in Parser 2 gets its own settings file. You'll need to look up the [http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes ISO 639-1 code for your language]... Here we'll use English (code <code>en</code>) as an example here and the language settings file would then be called <code>en.js</code> and go in the <code>/ubiquity/modules/parser/new/</code> directory of the repository.
Here is the basic template for a Ubiquity Parser 2 language file:
  function makeParser() {
    var en = new Parser('en');
  ...
    return en;
  };
Everything here is wrapped in a factory function called <code>makeParser</code>. This function initializes the new <code>Parser</code> object with the appropriate language code, sets a bunch of parameters (elided above) and returns it. That's it!
Now let's walk through some of the parameters you must set to get your language working. For reference, the properties the language parser object is required to have are: <code>branching</code>, <code>anaphora</code>, and <code>roles</code>.
== Identifying your branching parameter ==
308

edits