r18n-core 2.1.7 → 2.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b288ce5a2e79c097eaff495c0e7a621b9e95b2e
4
- data.tar.gz: aadc3d612bf79b2c93d19c722cd1b595ce13db00
3
+ metadata.gz: 5bbaa39e76a973790722f6ff6bc226c48f431f81
4
+ data.tar.gz: 4d8d2cdc188540d8a5740e63f06c0105efbaf370
5
5
  SHA512:
6
- metadata.gz: 9ff9ddf8d869a22c811b05a373e58c4c4e1aaf38bb86e5cb4d264c076cf492fe1fda70183d0314a23d74e4c087f853c2883a93225029f019a986522f555a8cd6
7
- data.tar.gz: d52bc69e7667fdb799f98f8df88f8f4fbe15c674bf7a390be27b03085e3a8b0be93b7898f31ae3c3b49a3c7408836302babfe4ead6cce7c4ebe08561fb8a93bc
6
+ metadata.gz: bb03b1cf8bba47d9a6fc74d4f7226e0e313cf53eac972bac848f5b3c8b032f8da3b29a9ceec96ff8cf86aa1b61aa3e195f5223699b615e880aec147fa023750b
7
+ data.tar.gz: 3cd414164ccfe5cafdc076acfdf3a0f3e2f4408a58e37709ce54d63cdf1a36e51d051c931e36fceceec0d462eb5b860a8043c9b794d4d0a46da70ae2dc26f10c
data/ChangeLog.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 2.1.8 (Ѣ)
2
+ * Fix `true` and `false` keys support (by Alexander Popov).
3
+
1
4
  ## 2.1.7 (Sewe)
2
5
  * Add Afrikaans locale (by Llewellyn van der Merwe).
3
6
 
@@ -145,7 +145,10 @@ module R18n
145
145
  # Translation can contain variable part. Just set is as <tt>%1</tt>,
146
146
  # <tt>%2</tt>, etc in translations file and set values in next +params+.
147
147
  def [](name, *params)
148
- name = name.to_s if not name.is_a? String and not name.is_a? Integer
148
+ unless [String, Integer, TrueClass, FalseClass]
149
+ .any? { |klass| name.is_a?(klass) }
150
+ name = name.to_s
151
+ end
149
152
  value = @data[name]
150
153
  case value
151
154
  when TranslatedString
@@ -1,3 +1,3 @@
1
1
  module R18n
2
- VERSION = '2.1.7'.freeze unless defined? R18n::VERSION
2
+ VERSION = '2.1.8'.freeze unless defined? R18n::VERSION
3
3
  end
@@ -33,6 +33,13 @@ describe R18n::Translation do
33
33
  expect(i18n.one.split.first.to_s).to be_kind_of(String)
34
34
  end
35
35
 
36
+ it "returns strings by Boolean keys (true, false)" do
37
+ i18n = R18n::I18n.new('en', DIR)
38
+
39
+ expect(i18n.boolean[true]).to eq('Boolean is true')
40
+ expect(i18n.boolean[false]).to eq('Boolean is false')
41
+ end
42
+
36
43
  it "returns html escaped string" do
37
44
  klass = Class.new(R18n::TranslatedString) do
38
45
  def html_safe
@@ -40,3 +40,7 @@ markdown:
40
40
  textile:
41
41
  simple: !!textile _Hi!_
42
42
  html: !!textile _Hi!_<br />
43
+
44
+ boolean:
45
+ true: Boolean is true
46
+ false: Boolean is false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r18n-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.7
4
+ version: 2.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Sitnik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-13 00:00:00.000000000 Z
11
+ date: 2017-09-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  R18n is a i18n tool to translate your Ruby application.