L20n/Features/Resource file syntax: Difference between revisions
(Created page with "== goal == Consider potential improvements in the resource file syntax in order to improve working with the source files. The format is supposed to follow [[L20n/File_format_pr...") |
|||
| Line 7: | Line 7: | ||
== content == | == content == | ||
Currently we have [http://zbraniecki.github.com/l20n/docs/grammar.html LOL syntax], and feedback on it from Mozilla French Team [[https://etherpad.mozilla.org/l20n-feedback 1][https://etherpad.mozilla.org/l20n-feedback-feedback 2]]. | Currently we have [http://zbraniecki.github.com/l20n/docs/grammar.html LOL syntax], and feedback on it from <del>Mozilla French Team</del> the B2G/Gaia and JetPack teams [[https://etherpad.mozilla.org/l20n-feedback 1][https://etherpad.mozilla.org/l20n-feedback-feedback 2]]. | ||
The counter proposal is revolving around changes to the LOL syntax that would make it less XML'y, and more YAML'y, so to say. | <del>The counter proposal is revolving around changes to the LOL syntax that would make it less XML'y, and more YAML'y, so to say. | ||
The list of proposed changes is the following: | The list of proposed changes is the following:</del> | ||
* remove entity delimiters (<>) and replace them with indentation-based entity structure recognition. | * <del>remove entity delimiters (<>) and replace them with indentation-based entity structure recognition.</del> | ||
* separate entity attributes into separate entities | * <del>separate entity attributes into separate entities</del> | ||
* C-like comments vs. YAML-like comments | * <del>C-like comments vs. YAML-like comments</del> | ||
* string delimiters in YAML vs LOL | * <del>string delimiters in YAML vs LOL</del> | ||
The B2G/Gaia and JetPack teams are perfectly happy with the following LOL aspects: | |||
* the JSON-like values: strings, arrays, dicts | |||
* the C-style expressions: in strings, identifiers, macros | |||
* the C-style comments | |||
Their counter proposal is to change the way entities are declared[[https://etherpad.mozilla.org/l20n-elements 3]]: | |||
# to have a <strong>simpler</strong> syntax for the basic key/value cases (> 90% of all strings) — it shouldn’t be more complex than the current *.properties file format! | |||
# to allow grouping/nesting entities | |||
# to bring a more consistant syntax (syntax highlighting support?) | |||
# to bring a more generic/<strong>extensible</strong> syntax, thus easing the handling of unforeseen cases | |||
The choice of a syntax is a matter of taste (XML, JSON, YAML, etc.) and should be discussed. The key point in having a extensible syntax is that it requires expressing element attributes and content in a generic way. | |||
Example: | Example: | ||
LOL: | LOL: | ||
<pre> | <pre> | ||
<brandName | <brandName "Value" | ||
accesskey: "c"> | accesskey: "c"> | ||
</pre> | </pre> | ||
Flat YAML-like proposal: | |||
<pre> | <pre> | ||
brandName | brandName: Value | ||
brandName.accesskey: c | brandName.accesskey: c | ||
</pre> | </pre> | ||
Structured YAML-like proposal: | |||
<pre> | |||
brandName: | |||
&text: Value | |||
.accesskey: c | |||
</pre> | |||
Structured YAML-like proposal, compact variant: | |||
<pre> | <pre> | ||
brandName | brandName: Value | ||
accesskey: c | .accesskey: c | ||
</pre> | </pre> | ||
See [https://github.com/fabi1cazenave/webL10n/blob/master/LOL/data/test.yaml demo file] | See: | ||
* [https://github.com/fabi1cazenave/webL10n/blob/master/LOL/data/test.yaml YAML-like demo file] | |||
* [https://github.com/fabi1cazenave/webL10n/blob/master/LOL/data/test.yaml JSON-like demo file] | |||
* [http://kazhack.org/webL10n/LOL/ online LOL/JSON parser] | |||
To avoid « namespace » conflicts between element content/attributes and localization properties, a specific prefix should be used. As the dot is already used as a prefix for attributes in LOL expressions, we suggest keeping it in entity declarations. Element properties could be prefixed with an &, e.g. &textContent/&innerHTML or &text/&html for short (note that this would allow to be sharper, and to use other content syntaxes). | |||
== status == | == status == | ||
We need to investigate how such syntax may work for the localizers, will it indeed make working with files easier, how will it accommodate the grammar that we have for LOL together with the proposed extensions listed on the [[L20n/Features]] list. | We need to investigate how such syntax may work for the localizers, will it indeed make working with files easier, how will it accommodate the grammar that we have for LOL together with the proposed extensions listed on the [[L20n/Features]] list. | ||
Revision as of 11:15, 15 March 2012
goal
Consider potential improvements in the resource file syntax in order to improve working with the source files.
The format is supposed to follow L20n/File_format_principles.
content
Currently we have LOL syntax, and feedback on it from Mozilla French Team the B2G/Gaia and JetPack teams [12].
The counter proposal is revolving around changes to the LOL syntax that would make it less XML'y, and more YAML'y, so to say.
The list of proposed changes is the following:
remove entity delimiters (<>) and replace them with indentation-based entity structure recognition.separate entity attributes into separate entitiesC-like comments vs. YAML-like commentsstring delimiters in YAML vs LOL
The B2G/Gaia and JetPack teams are perfectly happy with the following LOL aspects:
- the JSON-like values: strings, arrays, dicts
- the C-style expressions: in strings, identifiers, macros
- the C-style comments
Their counter proposal is to change the way entities are declared[3]:
- to have a simpler syntax for the basic key/value cases (> 90% of all strings) — it shouldn’t be more complex than the current *.properties file format!
- to allow grouping/nesting entities
- to bring a more consistant syntax (syntax highlighting support?)
- to bring a more generic/extensible syntax, thus easing the handling of unforeseen cases
The choice of a syntax is a matter of taste (XML, JSON, YAML, etc.) and should be discussed. The key point in having a extensible syntax is that it requires expressing element attributes and content in a generic way.
Example:
LOL:
<brandName "Value" accesskey: "c">
Flat YAML-like proposal:
brandName: Value brandName.accesskey: c
Structured YAML-like proposal:
brandName: &text: Value .accesskey: c
Structured YAML-like proposal, compact variant:
brandName: Value .accesskey: c
See:
To avoid « namespace » conflicts between element content/attributes and localization properties, a specific prefix should be used. As the dot is already used as a prefix for attributes in LOL expressions, we suggest keeping it in entity declarations. Element properties could be prefixed with an &, e.g. &textContent/&innerHTML or &text/&html for short (note that this would allow to be sharper, and to use other content syntaxes).
status
We need to investigate how such syntax may work for the localizers, will it indeed make working with files easier, how will it accommodate the grammar that we have for LOL together with the proposed extensions listed on the L20n/Features list.