message_format 0.0.3 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +26 -0
- data/lib/message_format/interpreter.rb +1 -1
- data/lib/message_format/parser.rb +1 -2
- data/lib/message_format/version.rb +1 -1
- data/message_format.gemspec +2 -2
- data/spec/message_format_spec.rb +7 -0
- metadata +15 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0aab0390b7b67a1170bfa552f6d310c4c9d6a62af94100bbb508b778a4d0c8be
|
4
|
+
data.tar.gz: 733ba45310b0a2919ff2eaffe4ce8d2782fd13b4e9347fd78ea6f6fa463341f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30be89c25251d7d263b5b518e293bef76b6f5809ce3851a104e7ac0532bc483ea11f067c490476eb529382d10ae701bb199a9eb6f0f7df6d5d474402e59f5626
|
7
|
+
data.tar.gz: c0aeff15bda3d4cb1ad1a82b6dbbd858752f876c375a0de66b1f0fd2c206a0733b12bcea6030613d75d1605a5326e2f911cdc1175fd03e99cf22e3db933d6a0b
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,31 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.0.8
|
4
|
+
|
5
|
+
* Update twitter_cldr dependency
|
6
|
+
|
7
|
+
## 0.0.7
|
8
|
+
|
9
|
+
* Fix integer number formatter
|
10
|
+
|
11
|
+
## 0.0.6
|
12
|
+
|
13
|
+
* Update twitter_cldr dependency
|
14
|
+
|
15
|
+
## 0.0.5
|
16
|
+
|
17
|
+
* Update twitter_cldr dependency
|
18
|
+
|
19
|
+
## 0.0.4
|
20
|
+
|
21
|
+
* **Bug Fix**
|
22
|
+
* set SyntaxError message so it is displayed properly
|
23
|
+
|
24
|
+
## 0.0.3
|
25
|
+
|
26
|
+
* **Internal**
|
27
|
+
* Move repo ownership to format-message org
|
28
|
+
|
3
29
|
## 0.0.2
|
4
30
|
|
5
31
|
* **New Feature**
|
@@ -84,7 +84,7 @@ module MessageFormat
|
|
84
84
|
lambda do |args|
|
85
85
|
number = TwitterCldr::Localized::LocalizedNumber.new(args[id] - offset, locale)
|
86
86
|
if style == 'integer'
|
87
|
-
number.to_decimal(:precision => 0)
|
87
|
+
number.to_decimal.to_s(:precision => 0)
|
88
88
|
elsif style == 'percent'
|
89
89
|
number.to_percent.to_s
|
90
90
|
elsif style == 'currency'
|
@@ -360,7 +360,6 @@ module MessageFormat
|
|
360
360
|
#
|
361
361
|
class SyntaxError < StandardError
|
362
362
|
|
363
|
-
attr_reader :message
|
364
363
|
attr_reader :expected
|
365
364
|
attr_reader :found
|
366
365
|
attr_reader :offset
|
@@ -368,7 +367,7 @@ module MessageFormat
|
|
368
367
|
attr_reader :column
|
369
368
|
|
370
369
|
def initialize (message, expected, found, offset, line, column)
|
371
|
-
|
370
|
+
super(message)
|
372
371
|
@expected = expected
|
373
372
|
@found = found
|
374
373
|
@offset = offset
|
data/message_format.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "message_format"
|
8
8
|
spec.version = MessageFormat::VERSION
|
9
9
|
spec.authors = ["Andy VanWagoner"]
|
10
|
-
spec.email = ["andy@
|
10
|
+
spec.email = ["andy@thetalecrafter.com"]
|
11
11
|
spec.summary = %q{Parse and format i18n messages using ICU MessageFormat patterns}
|
12
12
|
spec.description = %q{Parse and format i18n messages using ICU MessageFormat patterns, including simple placeholders, number and date placeholders, and selecting among submessages for gender and plural arguments.}
|
13
13
|
spec.homepage = "https://github.com/format-message/message-format-rb"
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency "twitter_cldr", "~>
|
21
|
+
spec.add_runtime_dependency "twitter_cldr", "~> 6.0"
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.6"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
24
|
end
|
data/spec/message_format_spec.rb
CHANGED
@@ -47,6 +47,13 @@ describe MessageFormat do
|
|
47
47
|
expect(message).to match(/^0 \: \d\d?\/\d\d?\/\d{2,4} \d\d?\:\d\d [AP]M$/)
|
48
48
|
end
|
49
49
|
|
50
|
+
it 'formats integer number' do
|
51
|
+
pattern = '{ n, number, integer }'
|
52
|
+
message = MessageFormat.new(pattern, 'en-US').format({ n: 1234 })
|
53
|
+
|
54
|
+
expect(message).to match('1,234')
|
55
|
+
end
|
56
|
+
|
50
57
|
it 'handles plurals' do
|
51
58
|
pattern =
|
52
59
|
'On {takenDate, date, short} {name} {numPeople, plural, offset:1
|
metadata
CHANGED
@@ -1,67 +1,67 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: message_format
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy VanWagoner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: twitter_cldr
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '6.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.6'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.6'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '10.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
55
|
description: Parse and format i18n messages using ICU MessageFormat patterns, including
|
56
56
|
simple placeholders, number and date placeholders, and selecting among submessages
|
57
57
|
for gender and plural arguments.
|
58
58
|
email:
|
59
|
-
- andy@
|
59
|
+
- andy@thetalecrafter.com
|
60
60
|
executables: []
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
|
-
- .gitignore
|
64
|
+
- ".gitignore"
|
65
65
|
- CHANGELOG.md
|
66
66
|
- CODE_OF_CONDUCT.md
|
67
67
|
- Gemfile
|
@@ -86,21 +86,19 @@ require_paths:
|
|
86
86
|
- lib
|
87
87
|
required_ruby_version: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
|
-
- -
|
89
|
+
- - ">="
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '0'
|
92
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
|
-
|
99
|
-
rubygems_version: 2.0.14
|
98
|
+
rubygems_version: 3.0.3
|
100
99
|
signing_key:
|
101
100
|
specification_version: 4
|
102
101
|
summary: Parse and format i18n messages using ICU MessageFormat patterns
|
103
102
|
test_files:
|
104
103
|
- spec/message_format_spec.rb
|
105
104
|
- spec/spec_helper.rb
|
106
|
-
has_rdoc:
|