L20n/Features/Conditional blocks: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 11: Line 11:
For the block cases, the syntax might look similar to this:
For the block cases, the syntax might look similar to this:
<pre>
<pre>
@block (@width<600) {
if (@width<600 && @locale="pl") {
   <title "Short text">
   <title "Short text">
   <windowDesc "About this app">
   <windowDesc "About this app">
}
}
</pre>
</pre>
of course it's entirely possible to achieve the same with index and globals:
of course it's entirely possible to achieve the same with index and globals:
<pre>
<pre>
<title[@width<600 ? 'long' : 'short'] {
<title[@width<600 ? 'long' : 'short'] {
Line 27: Line 29:


== status ==
== status ==
* stas - against
* stas - ?
* gandalf - against
* gandalf - for
* pike - ?
* pike - ?


We evaluated this proposal and so far we're leaning against adding the scope block. Adding another concept to L20n - conditional blocks,
This is needed for multilocale resources (Gaia)
would decrease the readability of the file (the reader would have to understand the scope syntax here), and
since the goal is achievable with index conditions, we plan not to implement it for 1.0.
 
If in the future we will see such conditional indexes to be widely used, we may decide to include it for the next version.
 
We plan to implement the if clause for @import command. This will also mean that we encourage groups of entities that are to be used in certain
conditions to be exported into a separate file. This should increase readability and will allow us to avoid increasing complexity.
 
<pre>
@import ("path/to/resource") if (@width<600)
</pre>
Confirmed users
1,016

edits

Navigation menu