Skip to content

Commit 07b5e84

Browse files
committed
Consistency - FORMAT_STYLE_OPTIONS/CURRENCY_DISPLAY_OPTIONS etc.
1 parent 0a80c52 commit 07b5e84

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

fluent.runtime/fluent/bundle/types.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
FORMAT_STYLE_DECIMAL = "decimal"
1414
FORMAT_STYLE_CURRENCY = "currency"
1515
FORMAT_STYLE_PERCENT = "percent"
16-
FORMAT_STYLES = set([FORMAT_STYLE_DECIMAL,
17-
FORMAT_STYLE_CURRENCY,
18-
FORMAT_STYLE_PERCENT])
16+
FORMAT_STYLE_OPTIONS = set([
17+
FORMAT_STYLE_DECIMAL,
18+
FORMAT_STYLE_CURRENCY,
19+
FORMAT_STYLE_PERCENT,
20+
])
1921

2022
CURRENCY_DISPLAY_SYMBOL = "symbol"
2123
CURRENCY_DISPLAY_CODE = "code"
@@ -26,9 +28,21 @@
2628
CURRENCY_DISPLAY_NAME,
2729
])
2830

31+
DATE_STYLE_OPTIONS = set([
32+
"full",
33+
"long",
34+
"medium",
35+
"short",
36+
None,
37+
])
2938

30-
DATE_STYLE_OPTIONS = ["full", "long", "medium", "short", None]
31-
TIME_STYLE_OPTIONS = ["full", "long", "medium", "short", None]
39+
TIME_STYLE_OPTIONS = set([
40+
"full",
41+
"long",
42+
"medium",
43+
"short",
44+
None,
45+
])
3246

3347

3448
class FluentType(object):
@@ -55,7 +69,7 @@ class NumberFormatOptions(object):
5569

5670
# See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat
5771
style = attr.ib(default=FORMAT_STYLE_DECIMAL,
58-
validator=attr.validators.in_(FORMAT_STYLES))
72+
validator=attr.validators.in_(FORMAT_STYLE_OPTIONS))
5973
currency = attr.ib(default=None)
6074
currencyDisplay = attr.ib(default=CURRENCY_DISPLAY_SYMBOL,
6175
validator=attr.validators.in_(CURRENCY_DISPLAY_OPTIONS))

0 commit comments

Comments
 (0)