silo:std.locale
Source src/silo:std.locale
1
2
3
4
5
6
7:use
8 :open core AnyInt Bool Result Str Symbol Vec Ordering
9 :open traits Debug Display Eq Hash Ord TryFrom TryInto
10:end
11
12
13
14
15:enum(pub) PluralCategory
16 | zero
17 | one
18 | two
19 | few
20 | many
21 | other
22:end
23
24
25@lang(locale)
26:impl Locale
27 @host
28 .plural-category ( Locale AnyInt -> PluralCategory ) ;
29:end
30
31
32
33
34
35:aspect(pub) CurrentLocale
36
37 @host
38 .locale ( -> Locale ) ;
39
40 @host
41 .lookup-order ( -> (Vec Locale) ) ;
42:end
43
44:impl (CurrentLocale Locale)
45 .locale ( Locale -> Locale ) identity ;
46 @host
47 .lookup-order ( Locale -> (Vec Locale) ) ;
48:end
49
50:impl TryFrom Locale Symbol | Str
51 .try-from ( Symbol -> (Result Locale Str) ) locale-try-from-symbol ;
52:end
53
54:impl TryFrom Locale Str | Str
55 .try-from ( Str -> (Result Locale Str) ) locale-try-from-str ;
56:end
57
58:impl TryInto Symbol Locale | Str
59 .try-into ( Symbol -> (Result Locale Str) ) locale-try-from-symbol ;
60:end
61
62:impl TryInto Str Locale | Str
63 .try-into ( Str -> (Result Locale Str) ) locale-try-from-str ;
64:end
65
66:impl Display Locale .fmt ( Locale -> Str ) locale>str ; :end
67:impl Debug Locale .fmt-debug ( Locale -> Str ) locale>str ; :end
68:impl Hash Locale .hash ( Locale -> AnyInt ) hash-locale ; :end
69:impl Eq Locale Locale @host .= ( Locale Locale -> Bool ) ; :end
70:impl Ord Locale Locale
71 @host
72 .< ( Locale Locale -> Bool ) ;
73 @host
74 .> ( Locale Locale -> Bool ) ;
75:end