bisu 1.7.1 → 1.7.2
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 +5 -5
- data/.ruby-version +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +20 -18
- data/README.md +2 -2
- data/lib/bisu/localizer.rb +4 -1
- data/lib/bisu/version.rb +2 -2
- data/spec/lib/bisu/localizer_spec.rb +7 -3
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: de4d41b8e81de051cee161b99f77b0e6e81fe7cdb878191beb46a9427db39db5
|
4
|
+
data.tar.gz: f840f4d92ebc448ad43e298dcb95f3223c323a81f9441a1967689b278a501282
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc08b4b71b33d3db13a04302905d1846b190aa7e9febbf5eea69a97da4d2147be3ae97c270f2d658b9c2d7b1f598e8cdeb32daba762927cd508164b3a305d9c0
|
7
|
+
data.tar.gz: ad976c7db6db95a592d9306e90e9c9051276cb2bc3dab784e97bef92d947386445c7f0d315b589df29e60833ac665039c4445d3d178dc1b21a30da6acb59892b
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.0
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
`Bisu` adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## [1.7.2](https://github.com/hole19/bisu/releases/tag/v1.7.2)
|
6
|
+
Released on 2020/03/09
|
7
|
+
|
8
|
+
#### Added
|
9
|
+
- Correctly handles percentage sign on Android platform
|
10
|
+
|
5
11
|
## [1.7.1](https://github.com/hole19/bisu/releases/tag/v1.7.1)
|
6
12
|
Released on 2019/03/04
|
7
13
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,30 +1,32 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
addressable (2.
|
4
|
+
addressable (2.7.0)
|
5
|
+
public_suffix (>= 2.0.2, < 5.0)
|
5
6
|
colorize (0.8.1)
|
6
7
|
crack (0.4.3)
|
7
8
|
safe_yaml (~> 1.0.0)
|
8
|
-
diff-lcs (1.
|
9
|
-
hashdiff (0.
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
rspec-
|
14
|
-
rspec-
|
15
|
-
|
16
|
-
|
17
|
-
|
9
|
+
diff-lcs (1.3)
|
10
|
+
hashdiff (1.0.1)
|
11
|
+
public_suffix (4.0.3)
|
12
|
+
rake (13.0.1)
|
13
|
+
rspec (3.9.0)
|
14
|
+
rspec-core (~> 3.9.0)
|
15
|
+
rspec-expectations (~> 3.9.0)
|
16
|
+
rspec-mocks (~> 3.9.0)
|
17
|
+
rspec-core (3.9.1)
|
18
|
+
rspec-support (~> 3.9.1)
|
19
|
+
rspec-expectations (3.9.0)
|
18
20
|
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
-
rspec-support (~> 3.
|
20
|
-
rspec-its (1.
|
21
|
+
rspec-support (~> 3.9.0)
|
22
|
+
rspec-its (1.3.0)
|
21
23
|
rspec-core (>= 3.0.0)
|
22
24
|
rspec-expectations (>= 3.0.0)
|
23
|
-
rspec-mocks (3.
|
25
|
+
rspec-mocks (3.9.1)
|
24
26
|
diff-lcs (>= 1.2.0, < 2.0)
|
25
|
-
rspec-support (~> 3.
|
26
|
-
rspec-support (3.
|
27
|
-
safe_yaml (1.0.
|
27
|
+
rspec-support (~> 3.9.0)
|
28
|
+
rspec-support (3.9.2)
|
29
|
+
safe_yaml (1.0.5)
|
28
30
|
webmock (1.24.6)
|
29
31
|
addressable (>= 2.3.6)
|
30
32
|
crack (>= 0.3.2)
|
@@ -44,7 +46,7 @@ DEPENDENCIES
|
|
44
46
|
xml-simple (~> 1.1)
|
45
47
|
|
46
48
|
RUBY VERSION
|
47
|
-
ruby 2.
|
49
|
+
ruby 2.5.0p0
|
48
50
|
|
49
51
|
BUNDLED WITH
|
50
52
|
1.17.2
|
data/README.md
CHANGED
@@ -107,7 +107,7 @@ Create a \*.translatable version for your platform specific localization files:
|
|
107
107
|
"klGeneral_Delete" = "$kDelete$";
|
108
108
|
"klGeneral_Cancel" = "$kCancel$";
|
109
109
|
"klGeneral_Close" = "$kClose$";
|
110
|
-
"klRequestName" = "$kRequestName
|
110
|
+
"klRequestName" = "$kRequestName{user_name: %@}$";
|
111
111
|
```
|
112
112
|
|
113
113
|
##### Android
|
@@ -124,7 +124,7 @@ Create a \*.translatable version for your platform specific localization files:
|
|
124
124
|
<string name="delete">$kDelete$</string>
|
125
125
|
<string name="cancel">$kCancel$</string>
|
126
126
|
<string name="close">$kClose$</string>
|
127
|
-
<string name="request_name">$kRequestName
|
127
|
+
<string name="request_name">$kRequestName{user_name: %s}$</string>
|
128
128
|
</resources>
|
129
129
|
```
|
130
130
|
|
data/lib/bisu/localizer.rb
CHANGED
@@ -19,6 +19,8 @@ module Bisu
|
|
19
19
|
|
20
20
|
to_localize(t).map do |l|
|
21
21
|
if localized = @dict.localize(language, l[:key]) || @dict.localize(fallback_language, l[:key])
|
22
|
+
localized = process(localized)
|
23
|
+
|
22
24
|
l[:params].each do |param, value|
|
23
25
|
if localized.match("%{#{param}}")
|
24
26
|
localized = localized.gsub("%{#{param}}", value)
|
@@ -27,7 +29,7 @@ module Bisu
|
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
30
|
-
unless t.gsub!(l[:match],
|
32
|
+
unless t.gsub!(l[:match], localized)
|
31
33
|
Logger.warn("Could not find translation for #{l[:match]} in #{language}")
|
32
34
|
end
|
33
35
|
else
|
@@ -69,6 +71,7 @@ module Bisu
|
|
69
71
|
text = text.gsub("...", "…")
|
70
72
|
text = text.gsub("& ", "& ")
|
71
73
|
text = text.gsub("@", "\\\\@")
|
74
|
+
text = text.gsub(/%(?!{)/, "\\\\%%")
|
72
75
|
|
73
76
|
elsif @type.eql?(:ios)
|
74
77
|
text = text.gsub(/\"/, "\\\\\"")
|
data/lib/bisu/version.rb
CHANGED
@@ -16,7 +16,8 @@ describe Bisu::Localizer do
|
|
16
16
|
"kSingleQuoted" => "Não sabes nada 'João das Neves'",
|
17
17
|
"kEllipsis" => "Não sabes nada João das Neves...",
|
18
18
|
"kAmpersand" => "Não sabes nada João das Neves & Pícaros",
|
19
|
-
"kAtSign" => "\@johnsnow sabes alguma coisa?"
|
19
|
+
"kAtSign" => "\@johnsnow sabes alguma coisa?",
|
20
|
+
"kPercentage" => "Sabes 0% João das Neves."
|
20
21
|
},
|
21
22
|
"English" => {
|
22
23
|
"kMissingTransKey" => "You know little John Snow"
|
@@ -64,6 +65,7 @@ describe Bisu::Localizer do
|
|
64
65
|
it { translates("$kEllipsis$", to: expected[:ellipsis]) }
|
65
66
|
it { translates("$kAmpersand$", to: expected[:ampersand]) }
|
66
67
|
it { translates("$kAtSign$", to: expected[:at_sign]) }
|
68
|
+
it { translates("$kPercentage$", to: expected[:percentage]) }
|
67
69
|
|
68
70
|
# error handling
|
69
71
|
|
@@ -115,7 +117,8 @@ describe Bisu::Localizer do
|
|
115
117
|
single_quoted: keys[language]["kSingleQuoted"],
|
116
118
|
ellipsis: keys[language]["kEllipsis"],
|
117
119
|
ampersand: keys[language]["kAmpersand"],
|
118
|
-
at_sign: keys[language]["kAtSign"]
|
120
|
+
at_sign: keys[language]["kAtSign"],
|
121
|
+
percentage: keys[language]["kPercentage"]
|
119
122
|
} }
|
120
123
|
|
121
124
|
describe "of type iOS" do
|
@@ -135,7 +138,8 @@ describe Bisu::Localizer do
|
|
135
138
|
single_quoted: "Não sabes nada \\'João das Neves\\'",
|
136
139
|
ellipsis: "Não sabes nada João das Neves…",
|
137
140
|
ampersand: "Não sabes nada João das Neves & Pícaros",
|
138
|
-
at_sign: "\\@johnsnow sabes alguma coisa?"
|
141
|
+
at_sign: "\\@johnsnow sabes alguma coisa?",
|
142
|
+
percentage: "Sabes 0\\%% João das Neves."
|
139
143
|
) }
|
140
144
|
|
141
145
|
it_behaves_like "a localizer"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bisu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- joaoffcosta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: safe_yaml
|
@@ -131,8 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
|
-
|
135
|
-
rubygems_version: 2.5.1
|
134
|
+
rubygems_version: 3.1.2
|
136
135
|
signing_key:
|
137
136
|
specification_version: 4
|
138
137
|
summary: A localization automation service
|