I'm with Pike here: we need an imperative macro which understands values.
The hash semantics simply don't cut it here: we can't just fall back to
the default member because then we'd get the translation wrong (using the
wrong order of magnitude).
A good check to perform is to test if this would work well with
compare-locales. Hash members are private and I'd argue that using them to
store arbitrary data is wrong. If it's independent data, it should go into
separate entities, preferably public ones. Perhaps we should reconsider
the validity of hashes without index *and* default value in order to
discourage using them as data stores. Hash members should really be used
to store faceted data, like grammatical cases of the same datum.
* * *
(Now the crazy part.)
If macros turn out to be entities with some logic and the expressions are
simple decision trees, maybe we should consider merging them with hashes
where keys are predicates?
<unit[$n] {
$n < 1024: "B",
else: "kB"
}>
This still doesn't pass the compare-locale check, but now we have logic
which can help guarantee completeness.
-stas
On Mon, Aug 31, 2015 at 2:36 PM, Axel Hecht <
l1...@mozilla.com> wrote:
> I think that all of these are hacks, and this one is a bit, too:
>
> <unit($n) { $n < 1024 ? "B" :
> "kB" }>
> <value($n) { $n < 1024 ? $n :
> $n/1024 }>
> <betterNotify "{{ value($num) }} {{unit($num) }}">
>
>
> This would work great, if we had number formatting, and if we had macros.
>
> I think the double resolve is good until then, but please pass in the
> fileSize as argument, so that we can pluralize octets.
>
> Axel
>
>
>
> On 8/31/15 7:08 AM, Zibi Braniecki wrote:
>
> _______________________________________________
> tools-l10n mailing list
>
tools...@lists.mozilla.org
>
https://lists.mozilla.org/listinfo/tools-l10n
>