i18n-migrations 0.2.2 → 0.2.3
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 +4 -4
- data/lib/i18n/migrations/google_translate_dictionary.rb +19 -11
- data/lib/i18n/migrations/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c4a2b5e44a50d5964357bb129e0c6962b8fe1ef
|
4
|
+
data.tar.gz: 4ce6af1bb0c7306f3232a8c8457359bbc8cfd48a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 062f502cee7369d9633614cb81fad1f4337640fc890c3ccb396fdbcdc287121b0274e7679368401750820f52b0ee8fd701b83163edf75dcf9bc95c9ab6028274
|
7
|
+
data.tar.gz: 71fce5f7ac6ec1555b74684141e106168f4c36f56138bebb65480df45c991a6b0b924d7653883ffb5c59f9fde02fa183215ed8ed265eb54b313a4f577b1b3cfb
|
@@ -58,7 +58,9 @@ module I18n
|
|
58
58
|
end
|
59
59
|
|
60
60
|
# common mistakes
|
61
|
-
after = after
|
61
|
+
after = after
|
62
|
+
.gsub('% {', '%{')
|
63
|
+
.gsub('%{', '%{')
|
62
64
|
|
63
65
|
# match up variables, should have same variable in before and after
|
64
66
|
before_variables = before.scan(VARIABLE_STRING_REGEX)
|
@@ -67,16 +69,18 @@ module I18n
|
|
67
69
|
if before_variables.sort == after_variables.sort
|
68
70
|
# we have all of our variables, let's make sure spacing before them is correct
|
69
71
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
72
|
+
unless no_spaces?
|
73
|
+
before_variables.each do |variable|
|
74
|
+
before_index = before =~ /(.?)#{variable}/
|
75
|
+
before_leading = $1
|
76
|
+
after_index = after =~ /(.?)#{variable}/
|
77
|
+
after_leading = $1
|
78
|
+
|
79
|
+
if before_index && after_index &&
|
80
|
+
before_leading == ' ' && after_leading != ' ' &&
|
81
|
+
after_index != 0
|
82
|
+
after = after.sub(variable, " #{variable}")
|
83
|
+
end
|
80
84
|
end
|
81
85
|
end
|
82
86
|
|
@@ -117,6 +121,10 @@ module I18n
|
|
117
121
|
|
118
122
|
private
|
119
123
|
|
124
|
+
def no_spaces?
|
125
|
+
@to_locale == 'zh'
|
126
|
+
end
|
127
|
+
|
120
128
|
def format(key)
|
121
129
|
key&.index('_html') ? :html : :text
|
122
130
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n-migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Lightsmith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|