goal
allow for entities to be enabled only for some screen sizes, operating systems, languages etc.
examples
Basically there are two concepts here. One is to group a list of entities into some form of "if" block, another is to make @import command work only when a pattern matches.
Use cases here are entities that are used only for a given operating system (mac or win only), or different entities for different screen sizes (if screen width is below 480, use shorter entities).
For the block cases, the syntax might look similar to this:
@block (@width<600) {
<title "Short text">
<windowDesc "About this app">
}
of course it's entirely possible to achieve the same with index and globals:
<title[@width<600 ? 'long' : 'short'] {
short: "Settings",
long: "Settings Manager"
}>
This syntax would also allow for @import commands to be encapsulated within such a conditional block.
Alternatively, we may just add an if clause to @import command:
@import ("path/to/resource") if (@width<600)
status
- stas - against
- gandalf - against
- pike - ?
We evaluated this proposal and so far we're leaning against adding the scope block. Adding another concept to L20n - conditional blocks, 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.