babosa 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -20,8 +20,9 @@ FriendlyId.
|
|
20
20
|
"Jürgen Müller".to_slug.transliterate.to_s #=> "Jurgen Muller"
|
21
21
|
"Jürgen Müller".to_slug.transliterate(:german).to_s #=> "Juergen Mueller"
|
22
22
|
|
23
|
-
|
24
|
-
gladly accept contributions
|
23
|
+
Many European languages using both Roman and Cyrillic alphabets are supported.
|
24
|
+
I'll gladly accept contributions from fluent speakers to support more
|
25
|
+
languages.
|
25
26
|
|
26
27
|
### Non-ASCII removal
|
27
28
|
|
@@ -164,6 +165,7 @@ Please use Babosa's [Github issue tracker](http://github.com/norman/babosa/issue
|
|
164
165
|
|
165
166
|
## Contributors
|
166
167
|
|
168
|
+
* [Kim Joar Bekkelund](https://github.com/kjbekkelund) - Norwegian support
|
167
169
|
* [Alexey Shkolnikov](https://github.com/grlm) - Russian support
|
168
170
|
* [Martin Petrov](https://github.com/martin-petrov) - Bulgarian support
|
169
171
|
* [Molte Emil Strange Andersen](https://github.com/molte) - Danish support
|
@@ -172,6 +174,9 @@ Please use Babosa's [Github issue tracker](http://github.com/norman/babosa/issue
|
|
172
174
|
|
173
175
|
## Changelog
|
174
176
|
|
177
|
+
* 0.3.3 - Add Norwegian support.
|
178
|
+
* 0.3.2 - Improve Macedonian support.
|
179
|
+
* 0.3.1 - Small fixes to Cyrillic.
|
175
180
|
* 0.3.0 - Cyrillic support. Improve support for various Unicode spaces and dashes.
|
176
181
|
* 0.2.2 - Fix for "smart" quote handling.
|
177
182
|
* 0.2.1 - Implement #empty? for compatiblity with Active Support's #blank?.
|
@@ -181,7 +186,7 @@ Please use Babosa's [Github issue tracker](http://github.com/norman/babosa/issue
|
|
181
186
|
|
182
187
|
## Copyright
|
183
188
|
|
184
|
-
Copyright (c) 2010 Norman Clarke
|
189
|
+
Copyright (c) 2010-2011 Norman Clarke
|
185
190
|
|
186
191
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
187
192
|
this software and associated documentation files (the "Software"), to deal in
|
data/lib/babosa/identifier.rb
CHANGED
@@ -84,14 +84,14 @@ module Babosa
|
|
84
84
|
# characters that are Roman-alphabet characters + diacritics. Non-letter
|
85
85
|
# characters are left unmodified.
|
86
86
|
#
|
87
|
-
# string = Identifier.new "
|
87
|
+
# string = Identifier.new "Łódź
|
88
88
|
# string.transliterate # => "Lodz, Poland"
|
89
89
|
# string = Identifier.new "日本"
|
90
90
|
# string.transliterate # => "日本"
|
91
91
|
#
|
92
92
|
# You can pass any key(s) from +Characters.approximations+ as arguments. This allows
|
93
|
-
# for contextual approximations.
|
94
|
-
#
|
93
|
+
# for contextual approximations. Various languages are supported, you can see which ones
|
94
|
+
# by looking at the source of {Babosa::Transliterator::Base}.
|
95
95
|
#
|
96
96
|
# string = Identifier.new "Jürgen Müller"
|
97
97
|
# string.transliterate # => "Jurgen Muller"
|
@@ -242,7 +242,7 @@ module Babosa
|
|
242
242
|
end
|
243
243
|
|
244
244
|
%w[transliterate clean downcase word_chars normalize normalize_utf8
|
245
|
-
tidy_bytes to_ascii to_ruby_method truncate truncate_bytes upcase
|
245
|
+
tidy_bytes to_ascii to_ruby_method truncate truncate_bytes upcase
|
246
246
|
with_separators].each do |method|
|
247
247
|
class_eval(<<-EOM, __FILE__, __LINE__ + 1)
|
248
248
|
def #{method}(*args)
|
@@ -12,10 +12,11 @@ module Babosa
|
|
12
12
|
autoload :German, "babosa/transliterator/german"
|
13
13
|
autoload :Latin, "babosa/transliterator/latin"
|
14
14
|
autoload :Macedonian, "babosa/transliterator/macedonian"
|
15
|
+
autoload :Norwegian, "babosa/transliterator/norwegian"
|
15
16
|
autoload :Russian, "babosa/transliterator/russian"
|
16
17
|
autoload :Serbian, "babosa/transliterator/serbian"
|
17
18
|
autoload :Spanish, "babosa/transliterator/spanish"
|
18
|
-
autoload :Ukrainian,
|
19
|
+
autoload :Ukrainian, "babosa/transliterator/ukrainian"
|
19
20
|
|
20
21
|
def self.get(symbol)
|
21
22
|
const_get(symbol.to_s.classify)
|
data/lib/babosa/version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path("../../spec_helper", __FILE__)
|
3
|
+
|
4
|
+
describe Babosa::Transliterator::Norwegian do
|
5
|
+
|
6
|
+
let(:t) { described_class.instance }
|
7
|
+
it_behaves_like "a latin transliterator"
|
8
|
+
|
9
|
+
it "should transliterate various characters" do
|
10
|
+
examples = {
|
11
|
+
"Øivind" => "Oeivind",
|
12
|
+
"Bø" => "Boe",
|
13
|
+
"Åre" => "Aare",
|
14
|
+
"Håkon" => "Haakon"
|
15
|
+
}
|
16
|
+
examples.each {|k, v| t.transliterate(k).should eql(v)}
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: babosa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.3.
|
5
|
+
version: 0.3.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Norman Clarke
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-04-05 00:00:00 -03:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- lib/babosa/transliterator/german.rb
|
64
64
|
- lib/babosa/transliterator/latin.rb
|
65
65
|
- lib/babosa/transliterator/macedonian.rb
|
66
|
+
- lib/babosa/transliterator/norwegian.rb
|
66
67
|
- lib/babosa/transliterator/russian.rb
|
67
68
|
- lib/babosa/transliterator/serbian.rb
|
68
69
|
- lib/babosa/transliterator/spanish.rb
|
@@ -86,6 +87,7 @@ files:
|
|
86
87
|
- spec/transliterators/danish_spec.rb
|
87
88
|
- spec/transliterators/german_spec.rb
|
88
89
|
- spec/transliterators/macedonian_spec.rb
|
90
|
+
- spec/transliterators/norwegian_spec.rb
|
89
91
|
- spec/transliterators/russian_spec.rb
|
90
92
|
- spec/transliterators/serbian_spec.rb
|
91
93
|
- spec/transliterators/spanish_spec.rb
|