stringex 2.0.8 → 2.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.rdoc +4 -1
- data/VERSION +1 -1
- data/lib/stringex/localization/conversion_expressions.rb +1 -1
- data/locales/ru.yml +68 -0
- data/stringex.gemspec +4 -2
- data/test/unit/localization/ru_test.rb +129 -0
- data/test/unit/string_extensions_test.rb +7 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODY5NzllMWE1OTU5NDU0YTI5NmZhYTI4YzY5MGZhNDM2NDc3NThiMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODMxMDc3OWI1MGFjYmFhYzE5MGEwOGFlMWQ4YTQyOTg1MmM2ZGQzZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmFhNmQyZjJjMmM2MGY3OTBkNjMxMmFkYmQ5ZDZiYThjNjg3OWQ2OWRhMDlh
|
10
|
+
YmJlZDhmZDVkNjJmMTBlZmU2NmQzOGE5Mjk3N2Q4NDFmYzA1ZjA5ZDkzYWNk
|
11
|
+
YmM3YzdjZjg0YzZhOGJhZTA1YWIyNTIyYTBiNzEyMTM3MzY4NjE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDViM2I3YWM4NjQ4ZTk1MWMzNmJmMWMxMWIzYjRkNWE5NmFhNmMyNTEzZDcz
|
14
|
+
NDE1MTZjZGZiNGFjMjg1NDQ0MDg4YzA5MWE4NzY2ZDk4ZmE1YTk1M2ZkNzU3
|
15
|
+
OGE5NjVjNmE4Y2I2Nzg0MWFjZTkxMzFjMWYzZTJmMTZjMTBjZmQ=
|
data/README.rdoc
CHANGED
@@ -103,7 +103,10 @@ Currently, built-in translations are available for the following languages:
|
|
103
103
|
|
104
104
|
* English (en)
|
105
105
|
* Danish (da)
|
106
|
-
*
|
106
|
+
* German (de)
|
107
|
+
* Portuguese Brazilian (pt-BR)
|
108
|
+
* Russian (ru)
|
109
|
+
|
107
110
|
|
108
111
|
You can easily add your own or customize the built-in translations - read here[https://github.com/rsl/stringex/wiki/Localization-of-Stringex-conversions]. If you add a new language, please submit a pull request so we can make it available to other users also.
|
109
112
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.9
|
data/locales/ru.yml
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# NOTE: Some translation keys make use of matches from regular expressions
|
2
|
+
# to manipulate whitespace and order. Please consult the source code for
|
3
|
+
# Stringex::Localization::ConversionExpressions to see what those
|
4
|
+
# regular expressions look like if you need to manipulate the order
|
5
|
+
# differently than the usage below.
|
6
|
+
ru:
|
7
|
+
stringex:
|
8
|
+
characters:
|
9
|
+
and: и
|
10
|
+
at: в
|
11
|
+
divide: делить на
|
12
|
+
degrees: градусов
|
13
|
+
dot: \1 точка \2
|
14
|
+
ellipsis: многоточие
|
15
|
+
equals: равно
|
16
|
+
number: номер
|
17
|
+
percent: процентов
|
18
|
+
plus: плюс
|
19
|
+
slash: слеш
|
20
|
+
star: звезда
|
21
|
+
currencies:
|
22
|
+
dollars: \1 долларов
|
23
|
+
dollars_cents: \1 долларов \2 центов
|
24
|
+
pounds: \1 фунтов
|
25
|
+
pounds_pence: \1 фунтов \2 пенсов
|
26
|
+
euros: \1 евро
|
27
|
+
euros_cents: \1 евро \2 центов
|
28
|
+
yen: \1 йен
|
29
|
+
reais: \1 реал
|
30
|
+
reais_cents: \1 реал \2 сентаво
|
31
|
+
html_entities:
|
32
|
+
amp: и
|
33
|
+
cent: " центов"
|
34
|
+
copy: (c)
|
35
|
+
deg: " градусов "
|
36
|
+
divide: " делить на "
|
37
|
+
double_quote: '"'
|
38
|
+
ellipsis: "..."
|
39
|
+
en_dash: "-"
|
40
|
+
em_dash: "--"
|
41
|
+
frac14: одна четверть
|
42
|
+
frac12: половина
|
43
|
+
frac34: три четверти
|
44
|
+
gt: ">"
|
45
|
+
lt: <
|
46
|
+
nbsp: " "
|
47
|
+
pound: " фунтов "
|
48
|
+
reg: (r)
|
49
|
+
single_quote: "'"
|
50
|
+
times: x
|
51
|
+
trade: (tm)
|
52
|
+
yen: " йен "
|
53
|
+
vulgar_fractions:
|
54
|
+
half: половина
|
55
|
+
one_third: одна треть
|
56
|
+
two_thirds: две трети
|
57
|
+
one_fourth: одна четверть
|
58
|
+
three_fourths: три четверти
|
59
|
+
one_fifth: одна пятая
|
60
|
+
two_fifths: две пятых
|
61
|
+
three_fifths: три пятых
|
62
|
+
four_fifths: четыре пятых
|
63
|
+
one_sixth: одна шестая
|
64
|
+
five_sixths: пять шестых
|
65
|
+
one_eighth: одна восьмая
|
66
|
+
three_eighths: три восьмых
|
67
|
+
five_eighths: пять восьмых
|
68
|
+
seven_eighths: семь восьмых
|
data/stringex.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "stringex"
|
8
|
-
s.version = "2.0.
|
8
|
+
s.version = "2.0.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Russell Norris"]
|
12
|
-
s.date = "2013-
|
12
|
+
s.date = "2013-08-26"
|
13
13
|
s.description = "Some [hopefully] useful extensions to Ruby's String class. Stringex is made up of three libraries: ActsAsUrl [permalink solution with better character translation], Unidecoder [Unicode to ASCII transliteration], and StringExtensions [miscellaneous helper methods for the String class]."
|
14
14
|
s.email = "rsl@luckysneaks.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -230,6 +230,7 @@ Gem::Specification.new do |s|
|
|
230
230
|
"locales/de.yml",
|
231
231
|
"locales/en.yml",
|
232
232
|
"locales/pt-BR.yml",
|
233
|
+
"locales/ru.yml",
|
233
234
|
"stringex.gemspec",
|
234
235
|
"test/performance/localization_performance_test.rb",
|
235
236
|
"test/test_helper.rb",
|
@@ -242,6 +243,7 @@ Gem::Specification.new do |s|
|
|
242
243
|
"test/unit/localization/de_test.rb",
|
243
244
|
"test/unit/localization/default_test.rb",
|
244
245
|
"test/unit/localization/en_test.rb",
|
246
|
+
"test/unit/localization/ru_test.rb",
|
245
247
|
"test/unit/localization_18n_failure_test.rb",
|
246
248
|
"test/unit/localization_test.rb",
|
247
249
|
"test/unit/redcloth_to_html_test.rb",
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
require 'i18n'
|
5
|
+
require 'stringex'
|
6
|
+
|
7
|
+
class RussianYAMLLocalizationTest < Test::Unit::TestCase
|
8
|
+
def setup
|
9
|
+
Stringex::Localization.reset!
|
10
|
+
Stringex::Localization.backend = :i18n
|
11
|
+
Stringex::Localization.backend.load_translations :ru
|
12
|
+
Stringex::Localization.locale = :ru
|
13
|
+
end
|
14
|
+
|
15
|
+
{
|
16
|
+
"foo & bar" => "foo и bar",
|
17
|
+
"AT&T" => "AT и T",
|
18
|
+
"99° is normal" => "99 градусов is normal",
|
19
|
+
"4 ÷ 2 is 2" => "4 делить на 2 is 2",
|
20
|
+
"webcrawler.com" => "webcrawler точка com",
|
21
|
+
"Well..." => "Well многоточие",
|
22
|
+
"x=1" => "x равно 1",
|
23
|
+
"a #2 pencil" => "a номер 2 pencil",
|
24
|
+
"100%" => "100 процентов",
|
25
|
+
"cost+tax" => "cost плюс tax",
|
26
|
+
"batman/robin fan fiction" => "batman слеш robin fan fiction",
|
27
|
+
"dial *69" => "dial звезда 69",
|
28
|
+
" i leave whitespace on ends unchanged " => " i leave whitespace on ends unchanged "
|
29
|
+
}.each do |original, converted|
|
30
|
+
define_method "test_character_conversion: '#{original}'" do
|
31
|
+
assert_equal converted, original.convert_miscellaneous_characters
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
{
|
36
|
+
"$100" => "100 долларов",
|
37
|
+
"$19.99" => "19 долларов 99 центов",
|
38
|
+
"£100" => "100 фунтов",
|
39
|
+
"£19.99" => "19 фунтов 99 пенсов",
|
40
|
+
"€100" => "100 евро",
|
41
|
+
"€19.99" => "19 евро 99 центов",
|
42
|
+
"¥1000" => "1000 йен"
|
43
|
+
}.each do |original, converted|
|
44
|
+
define_method "test_currency_conversion: '#{original}'" do
|
45
|
+
assert_equal converted, original.convert_miscellaneous_characters
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
{
|
50
|
+
"Tea & Sympathy" => "Tea и Sympathy",
|
51
|
+
"10¢" => "10 центов",
|
52
|
+
"©2000" => "(c)2000",
|
53
|
+
"98° is fine" => "98 градусов is fine",
|
54
|
+
"10÷5" => "10 делить на 5",
|
55
|
+
""quoted"" => '"quoted"',
|
56
|
+
"to be continued…" => "to be continued...",
|
57
|
+
"2000–2004" => "2000-2004",
|
58
|
+
"I wish—oh, never mind" => "I wish--oh, never mind",
|
59
|
+
"½ ounce of gold" => "половина ounce of gold",
|
60
|
+
"1 and ¼ ounces of silver" => "1 and одна четверть ounces of silver",
|
61
|
+
"9 and ¾ ounces of platinum" => "9 and три четверти ounces of platinum",
|
62
|
+
"3>2" => "3>2",
|
63
|
+
"2<3" => "2<3",
|
64
|
+
"two words" => "two words",
|
65
|
+
"£100" => "фунтов 100",
|
66
|
+
"Walmart®" => "Walmart(r)",
|
67
|
+
"'single quoted'" => "'single quoted'",
|
68
|
+
"2×4" => "2x4",
|
69
|
+
"Programming™" => "Programming(tm)",
|
70
|
+
"¥20000" => "йен 20000",
|
71
|
+
" i leave whitespace on ends unchanged " => " i leave whitespace on ends unchanged "
|
72
|
+
}.each do |original, converted|
|
73
|
+
define_method "test_html_entity_conversion: '#{original}'" do
|
74
|
+
assert_equal converted, original.convert_miscellaneous_html_entities
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
{
|
79
|
+
"½" => "половина",
|
80
|
+
"½" => "половина",
|
81
|
+
"½" => "половина",
|
82
|
+
"⅓" => "одна треть",
|
83
|
+
"⅓" => "одна треть",
|
84
|
+
"⅔" => "две трети",
|
85
|
+
"⅔" => "две трети",
|
86
|
+
"¼" => "одна четверть",
|
87
|
+
"¼" => "одна четверть",
|
88
|
+
"¼" => "одна четверть",
|
89
|
+
"¾" => "три четверти",
|
90
|
+
"¾" => "три четверти",
|
91
|
+
"¾" => "три четверти",
|
92
|
+
"⅕" => "одна пятая",
|
93
|
+
"⅕" => "одна пятая",
|
94
|
+
"⅖" => "две пятых",
|
95
|
+
"⅖" => "две пятых",
|
96
|
+
"⅗" => "три пятых",
|
97
|
+
"⅗" => "три пятых",
|
98
|
+
"⅘" => "четыре пятых",
|
99
|
+
"⅘" => "четыре пятых",
|
100
|
+
"⅙" => "одна шестая",
|
101
|
+
"⅙" => "одна шестая",
|
102
|
+
"⅚" => "пять шестых",
|
103
|
+
"⅚" => "пять шестых",
|
104
|
+
"⅛" => "одна восьмая",
|
105
|
+
"⅛" => "одна восьмая",
|
106
|
+
"⅜" => "три восьмых",
|
107
|
+
"⅜" => "три восьмых",
|
108
|
+
"⅝" => "пять восьмых",
|
109
|
+
"⅝" => "пять восьмых",
|
110
|
+
"⅞" => "семь восьмых",
|
111
|
+
"⅞" => "семь восьмых"
|
112
|
+
}.each do |original, converted|
|
113
|
+
define_method "test_vulgar_fractions_conversion: #{original}" do
|
114
|
+
assert_equal converted, original.convert_vulgar_fractions
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
{
|
119
|
+
"foo & bar" => "foo-i-bar",
|
120
|
+
"AT&T" => "at-i-t",
|
121
|
+
"99° is normal" => "99-ghradusov-is-normal",
|
122
|
+
"4 ÷ 2 is 2" => "4-dielit-na-2-is-2",
|
123
|
+
"webcrawler.com" => "webcrawler-tochka-com",
|
124
|
+
}.each do |original, converted|
|
125
|
+
define_method "test_character_conversion: '#{original}'" do
|
126
|
+
assert_equal converted, original.to_url
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -75,7 +75,13 @@ class StringExtensionsTest < Test::Unit::TestCase
|
|
75
75
|
"$1,000" =>
|
76
76
|
"1000-dollars",
|
77
77
|
"«zut alors»" =>
|
78
|
-
"zut-alors"
|
78
|
+
"zut-alors",
|
79
|
+
"Rabbits aren't real" =>
|
80
|
+
"rabbits-arent-real",
|
81
|
+
"R" =>
|
82
|
+
"r",
|
83
|
+
"R$ isn't R" =>
|
84
|
+
"reais-isnt-r"
|
79
85
|
}.each do |html, plain|
|
80
86
|
assert_equal plain, html.to_url
|
81
87
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stringex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Russell Norris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -388,6 +388,7 @@ files:
|
|
388
388
|
- locales/de.yml
|
389
389
|
- locales/en.yml
|
390
390
|
- locales/pt-BR.yml
|
391
|
+
- locales/ru.yml
|
391
392
|
- stringex.gemspec
|
392
393
|
- test/performance/localization_performance_test.rb
|
393
394
|
- test/test_helper.rb
|
@@ -400,6 +401,7 @@ files:
|
|
400
401
|
- test/unit/localization/de_test.rb
|
401
402
|
- test/unit/localization/default_test.rb
|
402
403
|
- test/unit/localization/en_test.rb
|
404
|
+
- test/unit/localization/ru_test.rb
|
403
405
|
- test/unit/localization_18n_failure_test.rb
|
404
406
|
- test/unit/localization_test.rb
|
405
407
|
- test/unit/redcloth_to_html_test.rb
|