L20n/Features/Public vs Private

< L20n‎ | Features
Revision as of 12:49, 28 February 2012 by Gandalf (talk | contribs) (Created page with "== goal == we need to be able to recognize variables from a developer from entities located in resources, we also need to separate attributes that are locally defined by the loca...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

goal

we need to be able to recognize variables from a developer from entities located in resources, we also need to separate attributes that are locally defined by the localizer from the ones that should be available to the developer

example

We decided to separate the expression syntax used to call to other entities from the syntax used to reference developer provided variables.

Developer provided variables (either from the context or a call) are referenced by a name, no changes here. But in order to reference another entity, a prefix ":" has to be used. It looks like this:

<brandName {
  nominative: "Firefox",
  genitive: "Firefoksa"
}
  _gender: { mac: 'male', win: 'female' }
  accesskey: { mac: 'F', win: 'C'}
>

<about "About {{ :brandName.nominative }}">
<update[:brandName:_gender.win] {
  male: "{{ :brandName }} has been updated.  The update took {{ updateTime }} seconds."
  female: "{{ :brandName:accesskey.mac }}"
}>

The rationale here is that we expect localizers to reference developer provided variables much more often, while referencing other entities (except for a bradName like cases) will be rather an exception.

We decided to aim for using "_" in front of an entity name or attribute name to indicate that it's a local entity/attribute. Those will be referenced the same way, but will not be available to the developer. (e,g. developer cannot ask for brandName:_gender here

This will enable us to compare locales skipping local entries.

For computed calls, the syntax will look like this:

/*
   For variables:
   var1 - "accesskey"
   var2 - "entity2"
   var3 - "win"
 */

<entity1 "value"
 accesskey: "c">

<entity2 "value">

<entity3 {
  win: "test",
  lin: "test2"
}>
/*
  This will compute to "Hello c and value and test"
*/
<title "Hello {{ :entity1:[var1] }} and {{ :[var2] }} and {{ :entity3[var3] }}">

status

  • open
  • stas, gandalf - ok
  • pike - ?