message_format 0.0.2 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 90b4292d4e0a33c497f1cf9ec2efe3650592c900
4
- data.tar.gz: 8833b184ef0771db6d1b3bebcf5e79520ec5e59e
2
+ SHA256:
3
+ metadata.gz: d658a9e2c2873f4d79b82d4e8d52c16ce8c5847813ea74a5fda309e79a506570
4
+ data.tar.gz: f6f08d3b64ff10dfb697803abdf68c02311fa90456a378d3134cfeee4915b2e7
5
5
  SHA512:
6
- metadata.gz: a535a9ab8e3239bfcb46fe08b27fab14aacc5de742098be6e3839c0635bed11ec3c5232218220fc2b0f5c65ec9f3034bfee3806f7070a77dfdf1995b677a1521
7
- data.tar.gz: 32a2459fcb0ffda22a8aa63193172558d49c2b43db209d2e6cd1d36ab629cfbd3a7a20a4310cbca8f591f3b9a92a963acf01ae32be060b48d7e5ddb60e68fda1
6
+ metadata.gz: 451d356902caee5c79b4f694bb8547216ef74270ba71716bce06600dee1df3b88f3ed526c5a3b82069aa98e069c8a76516c95dfde19c73cddb72995e25165d3a
7
+ data.tar.gz: 5ef6bc98d8fdbf84224d7587f7754b472f2e70a6abeaa1c3b527ae63972908915440dc7ac99ca94a23a795805ae4ef06c0e2e28ab42fdd4ce90a259ed1436d28
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.7
4
+
5
+ * Fix integer number formatter
6
+
7
+ ## 0.0.6
8
+
9
+ * Update twitter_cldr dependency
10
+
11
+ ## 0.0.5
12
+
13
+ * Update twitter_cldr dependency
14
+
15
+ ## 0.0.4
16
+
17
+ * **Bug Fix**
18
+ * set SyntaxError message so it is displayed properly
19
+
20
+ ## 0.0.3
21
+
22
+ * **Internal**
23
+ * Move repo ownership to format-message org
24
+
3
25
  ## 0.0.2
4
26
 
5
27
  * **New Feature**
data/README.md CHANGED
@@ -29,7 +29,7 @@ The [ICU Message Format][icu-message] is a great format for user-visible strings
29
29
 
30
30
  ## Contributing
31
31
 
32
- 1. Fork it ( https://github.com/thetalecrafter/message-format-rb/fork )
32
+ 1. Fork it ( https://github.com/format-message/message-format-rb/fork )
33
33
  2. Create your feature branch (`git checkout -b my-new-feature`)
34
34
  3. Commit your changes (`git commit -am 'Add some feature'`)
35
35
  4. Push to the branch (`git push origin my-new-feature`)
@@ -43,5 +43,5 @@ This software is free to use under the MIT license. See the [LICENSE.txt file][L
43
43
  [icu-cpp]: http://icu-project.org/apiref/icu4c/classicu_1_1MessageFormat.html
44
44
  [icu-php]: http://php.net/manual/en/class.messageformatter.php
45
45
  [icu-java]: http://icu-project.org/apiref/icu4j/
46
- [icu-javascript]: https://github.com/thetalecrafter/message-format
47
- [LICENSE]: https://github.com/thetalecrafter/message-format-rb/blob/master/LICENSE.txt
46
+ [icu-javascript]: https://github.com/format-message/message-format
47
+ [LICENSE]: https://github.com/format-message/message-format-rb/blob/master/LICENSE.txt
@@ -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).to_s
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
- @message = message
370
+ super(message)
372
371
  @expected = expected
373
372
  @found = found
374
373
  @offset = offset
@@ -1,3 +1,3 @@
1
1
  module MessageFormat
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -7,10 +7,10 @@ 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@instructure.com"]
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
- spec.homepage = "https://github.com/thetalecrafter/message-format-rb"
13
+ spec.homepage = "https://github.com/format-message/message-format-rb"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -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", "~> 3.1"
21
+ spec.add_runtime_dependency "twitter_cldr", "~> 5.0"
22
22
  spec.add_development_dependency "bundler", "~> 1.6"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
24
  end
@@ -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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: message_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy VanWagoner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-08 00:00:00.000000000 Z
11
+ date: 2020-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: twitter_cldr
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.1'
19
+ version: '5.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: '3.1'
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -56,7 +56,7 @@ description: Parse and format i18n messages using ICU MessageFormat patterns, in
56
56
  simple placeholders, number and date placeholders, and selecting among submessages
57
57
  for gender and plural arguments.
58
58
  email:
59
- - andy@instructure.com
59
+ - andy@thetalecrafter.com
60
60
  executables: []
61
61
  extensions: []
62
62
  extra_rdoc_files: []
@@ -76,7 +76,7 @@ files:
76
76
  - message_format.gemspec
77
77
  - spec/message_format_spec.rb
78
78
  - spec/spec_helper.rb
79
- homepage: https://github.com/thetalecrafter/message-format-rb
79
+ homepage: https://github.com/format-message/message-format-rb
80
80
  licenses:
81
81
  - MIT
82
82
  metadata: {}
@@ -95,12 +95,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  requirements: []
98
- rubyforge_project:
99
- rubygems_version: 2.2.2
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: