Skip to content

Commit e6d4805

Browse files
committed
Tweaks to wording in the Guide
1 parent efdd2c6 commit e6d4805

File tree

4 files changed

+23
-32
lines changed

4 files changed

+23
-32
lines changed

guide/builtins.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ last-notice =
88
Last checked: { DATETIME($lastChecked, day: "numeric", month: "long") }.
99
```
1010

11-
```json
12-
{
13-
"lastChecked": "2016-04-22T08:13:56.354Z",
14-
"unreadEmails": 5
15-
}
16-
```
17-
1811
In most cases, Fluent will automatically select the right formatter for the
1912
argument and format it into a given locale.
2013

guide/external.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,3 @@ unreadEmails = { $user } has { $emailCount } unread emails.
2222
There are all kinds of external data that might be useful in providing a good
2323
localization: user names, number of unread messages, battery level, current
2424
time, time left before an alarm goes off, etc.
25-
26-
To reference a variable, use the dollar syntax in your FTL code:
27-
`$user`. `user` has to be defined in the context data. In the examples below,
28-
we insert the value of a context data variable into a message's value.

guide/selectors.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
# Selectors
22

33
```
4-
emails = { $unreadEmails ->
4+
emails =
5+
{ $unreadEmails ->
56
[one] You have one unread email.
67
*[other] You have { $unreadEmails } unread emails.
78
}
89
```
910

10-
```json
11-
{
12-
"unreadEmails": 5
13-
}
14-
```
15-
1611
One of the most common cases when a localizer needs to use a placeable is when
1712
there are multiple variants of the string that depend on some external
18-
argument. FTL provides the select expression syntax, which chooses one of the
19-
provided variants based on the given selector.
13+
argument. In the example above, the `emails` message depends on the value of
14+
the `$unreadEmails` external argument.
2015

21-
The `*` indicator identifies the default selection. A default selection is required.
16+
FTL has the select expression syntax which allows to define multiple variants
17+
of the translation and choose between them based on the value of the
18+
selector. The `*` indicator identifies the default variant. A default
19+
variant is required.
2220

23-
The selector may be a string, in which case it will be compared directly to the
24-
keys of variants defined in the select expression. For number selectors, the
25-
variant keys either match the number exactly or they match the [CLDR plural
26-
category](http://www.unicode.org/cldr/charts/30/supplemental/language_plural_rules.html)
27-
for the number. The possible categories are: `zero`, `one`, `two`, `few`,
28-
`many`, and `other`. For instance, English has two plural categories: `one` and
29-
`other`.
21+
The selector may be a string, in which case it will be compared directly to
22+
the keys of variants defined in the select expression. For selectors which
23+
are numbers, the variant keys either match the number exactly or they match
24+
the [CLDR plural category][] for the number. The possible categories are:
25+
`zero`, `one`, `two`, `few`, `many`, and `other`. For instance, English has
26+
two plural categories: `one` and `other`.
3027

3128
If the translation requires a number to be formatted in a particular
3229
non-default manner, the selector should use the same formatting options. The
@@ -35,8 +32,11 @@ which, for some languages, might be different than the category of the
3532
unformatted number:
3633

3734
```
38-
your-score = { NUMBER($score, minimumFractionDigits: 1) ->
35+
your-score =
36+
{ NUMBER($score, minimumFractionDigits: 1) ->
3937
[0.0] You scored zero points. What happened?
4038
*[other] You scored { NUMBER($score, minimumFractionDigits: 1) } points.
4139
}
4240
```
41+
42+
[CLDR plural category]: http://www.unicode.org/cldr/charts/30/supplemental/language_plural_rules.html

guide/variants.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ As we stated at the beginning of this guide, messages primarily consist of
1818
string values. A single string value can have multiple branches, or variants,
1919
which are chosen based on the value of a selector. In some cases, however, we
2020
don't need any selector and instead just want to define multiple variants of
21-
the message and use them from within other messages. For instance, in languages
22-
that use noun declension, `-brand-name` may need to be declined when referred to
21+
the message and use them from within other messages.
22+
23+
This is most useful for [terms](terms.html). For instance, in languages that
24+
use noun declension, `-brand-name` may need to be declined when referred to
2325
from other messages.
2426

2527
FTL lets you define variants without a selector. Think of them as facets of the
26-
same message. You can refer to them using the `message[variant key]` syntax.
28+
same message. You can refer to them using the `identifier[variant key]` syntax.
2729

2830
For instance, in many inflected languages (e.g. German, Finnish, Hungarian, all
2931
Slavic languages), the *about* preposition governs the grammatical case of the

0 commit comments

Comments
 (0)