romanvbabenko-ukrainian 0.1.0

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.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 romanvbabenko
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,7 @@
1
+ = ukrainian
2
+
3
+ Description goes here.
4
+
5
+ == Copyright
6
+
7
+ Copyright (c) 2009 romanvbabenko. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,58 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "ukrainian"
8
+ gem.summary = "Ukrainian language support for Ruby and Rails"
9
+ gem.email = "romanvbabenko@gmail.com"
10
+ gem.homepage = "http://github.com/romanvbabenko/ukrainian"
11
+ gem.authors = ["romanvbabenko"]
12
+ gem.files.include FileList['lib/**/*']
13
+ gem.add_dependency('i18n')
14
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
+ end
16
+
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
19
+ end
20
+
21
+ require 'rake/testtask'
22
+ Rake::TestTask.new(:test) do |test|
23
+ test.libs << 'lib' << 'test'
24
+ test.pattern = 'test/**/*_test.rb'
25
+ test.verbose = true
26
+ end
27
+
28
+ begin
29
+ require 'rcov/rcovtask'
30
+ Rcov::RcovTask.new do |test|
31
+ test.libs << 'test'
32
+ test.pattern = 'test/**/*_test.rb'
33
+ test.verbose = true
34
+ end
35
+ rescue LoadError
36
+ task :rcov do
37
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
38
+ end
39
+ end
40
+
41
+
42
+ task :default => :test
43
+
44
+ require 'rake/rdoctask'
45
+ Rake::RDocTask.new do |rdoc|
46
+ if File.exist?('VERSION.yml')
47
+ config = YAML.load(File.read('VERSION.yml'))
48
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
49
+ else
50
+ version = ""
51
+ end
52
+
53
+ rdoc.rdoc_dir = 'rdoc'
54
+ rdoc.title = "ukrainian #{version}"
55
+ rdoc.rdoc_files.include('README*')
56
+ rdoc.rdoc_files.include('lib/**/*.rb')
57
+ end
58
+
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :minor: 1
3
+ :patch: 0
4
+ :major: 0
@@ -0,0 +1,24 @@
1
+ module I18n
2
+ module Backend
3
+ class Simple
4
+ protected
5
+ def pluralize(locale, entry, count)
6
+ return entry unless entry.is_a?(Hash) and count
7
+ key = :zero if count == 0 && entry.has_key?(:zero)
8
+ locale_pluralize = lookup(locale, :pluralize)
9
+ if locale_pluralize && locale_pluralize.respond_to?(:call)
10
+ key ||= locale_pluralize.call(count)
11
+ else
12
+ key ||= default_pluralizer(count)
13
+ end
14
+ raise InvalidPluralizationData.new(entry, count) unless entry.has_key?(key)
15
+ entry[key]
16
+ end
17
+
18
+ def default_pluralizer(count)
19
+ count == 1 ? :one : :other
20
+ end
21
+ end
22
+ end
23
+ end
24
+
@@ -0,0 +1,11 @@
1
+ uk:
2
+ # Used in array.to_sentence
3
+ support:
4
+ array:
5
+ # Rails 2.2
6
+ sentence_connector: 'і'
7
+ skip_last_comma: true
8
+ # Rails 2.3
9
+ words_connector: ', '
10
+ two_words_connector: ' і '
11
+ last_word_connector: ' та '
@@ -0,0 +1,122 @@
1
+ uk:
2
+ number:
3
+ # Used in number_with_delimiter()
4
+ # These are also the defaults for 'currency', 'percentage', 'precision', and 'human'
5
+ format:
6
+ # Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5)
7
+ separator: ","
8
+ # Delimets thousands (e.g. 1,000,000 is a million) (always in groups of three)
9
+ delimiter: " "
10
+ # Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00)
11
+ precision: 3
12
+
13
+ # Used in number_to_currency()
14
+ currency:
15
+ format:
16
+ # Where is the currency sign? %u is the currency unit, %n the number (default: $5.00)
17
+ format: "%n %u"
18
+ unit: "грн."
19
+ # These three are to override number.format and are optional
20
+ separator: ","
21
+ delimiter: " "
22
+ precision: 2
23
+
24
+ # Used in number_to_percentage()
25
+ percentage:
26
+ format:
27
+ # These three are to override number.format and are optional
28
+ # separator:
29
+ delimiter: ""
30
+ # precision:
31
+
32
+ # Used in number_to_precision()
33
+ precision:
34
+ format:
35
+ # These three are to override number.format and are optional
36
+ # separator:
37
+ delimiter: ""
38
+ # precision:
39
+
40
+ # Used in number_to_human_size()
41
+ human:
42
+ format:
43
+ # These three are to override number.format and are optional
44
+ # separator:
45
+ delimiter: ""
46
+ precision: 1
47
+ storage_units:
48
+ # Storage units output formatting.
49
+ # %u is the storage unit, %n is the number (default: 2 MB)
50
+ format: "%n %u"
51
+ units:
52
+ byte:
53
+ one: "байт"
54
+ few: "байти"
55
+ many: "байтів"
56
+ other: "байту"
57
+ kb: "кБ"
58
+ mb: "МБ"
59
+ gb: "ГБ"
60
+ tb: "ТБ"
61
+ # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
62
+ datetime:
63
+ distance_in_words:
64
+ half_a_minute: "півхвилини"
65
+ less_than_x_seconds:
66
+ one: "менше {{count}} секунди"
67
+ few: "менше {{count}} секунд"
68
+ many: "менше {{count}} секунд"
69
+ other: "менше {{count}} секунди"
70
+ x_seconds:
71
+ one: "{{count}} секунда"
72
+ few: "{{count}} секунди"
73
+ many: "{{count}} секунд"
74
+ other: "{{count}} секунди"
75
+ less_than_x_minutes:
76
+ one: "менше {{count}} хвилини"
77
+ few: "менше {{count}} хвилин"
78
+ many: "менше {{count}} хвилин"
79
+ other: "менше {{count}} хвилини"
80
+ x_minutes:
81
+ one: "{{count}} хвилина"
82
+ few: "{{count}} хвилини"
83
+ many: "{{count}} хвилин"
84
+ other: "{{count}} хвилини"
85
+ about_x_hours:
86
+ one: "близько {{count}} година"
87
+ few: "близько {{count}} години"
88
+ many: "близько {{count}} годин"
89
+ other: "близько {{count}} години"
90
+ x_days:
91
+ one: "{{count}} день"
92
+ few: "{{count}} дні"
93
+ many: "{{count}} днів"
94
+ other: "{{count}} дня"
95
+ about_x_months:
96
+ one: "близько {{count}} місяця"
97
+ few: "близько {{count}} місяців"
98
+ many: "близько {{count}} місяців"
99
+ other: "близько {{count}} місяця"
100
+ x_months:
101
+ one: "{{count}} місяць"
102
+ few: "{{count}} місяці"
103
+ many: "{{count}} місяців"
104
+ other: "{{count}} місяця"
105
+ about_x_years:
106
+ one: "близько {{count}} року"
107
+ few: "близько {{count}} років"
108
+ many: "близько {{count}} років"
109
+ other: "близько {{count}} року"
110
+ over_x_years:
111
+ one: "більше {{count}} року"
112
+ few: "більше {{count}} років"
113
+ many: "більше {{count}} років"
114
+ other: "більше {{count}} року"
115
+ prompts:
116
+ year: "Рік"
117
+ month: "Місяць"
118
+ day: "День"
119
+ hour: "Година"
120
+ minute: "Хвилина"
121
+ second: "Секунда"
122
+
@@ -0,0 +1,47 @@
1
+ uk:
2
+ activerecord:
3
+ errors:
4
+ template:
5
+ header:
6
+ one: "{{model}} не збережено через {{count}} помилку"
7
+ few: "{{model}} не збережено через {{count}} помилки"
8
+ many: "{{model}} не збережено через {{count}} помилок"
9
+ other: "{{model}} не збережено через {{count}} помилки"
10
+ # The variable :count is also available
11
+ body: "Помилки виявлено в таких полях:"
12
+
13
+ # The values :model, :attribute and :value are always available for interpolation
14
+ # The value :count is available when applicable. Can be used for pluralization.
15
+ messages:
16
+ inclusion: "не включено до переліку"
17
+ exclusion: "зарезервовано"
18
+ invalid: "недійсний"
19
+ confirmation: "не збігається з підтвердженням"
20
+ accepted: "має бути прийнятий"
21
+ empty: "не може бути порожнім"
22
+ blank: "не може бути пустим"
23
+ too_long:
24
+ one: "занадто довгий (максимум {{count}} знак)"
25
+ few: "занадто довгий (максимум {{count}} знаки)"
26
+ many: "занадто довгий (максимум {{count}} знаків)"
27
+ other: "занадто довгий (максимум {{count}} знаку)"
28
+ too_short:
29
+ one: "занадто короткий (мінімум {{count}} знак)"
30
+ few: "занадто короткий (мінімум {{count}} знаки)"
31
+ many: "занадто короткий (мінімум {{count}} знаків)"
32
+ other: "занадто короткий (мінімум {{count}} знаку)"
33
+ wrong_length:
34
+ one: "неправильна довжина (має бути {{count}} знак)"
35
+ few: "неправильна довжина (має бути {{count}} знаки)"
36
+ many: "неправильна довжина (має бути {{count}} знаків)"
37
+ other: "неправильна довжина (має бути {{count}} знаку)"
38
+ taken: "вже зайнятий"
39
+ not_a_number: "не число"
40
+ greater_than: "має бути більше ніж {{count}}"
41
+ greater_than_or_equal_to: "має бути більше ніж або дорівнювати {{count}}"
42
+ equal_to: "має дорівнювати {{count}}"
43
+ less_than: "має бути менше ніж {{count}}"
44
+ less_than_or_equal_to: "має бути менше ніж або дорівнювати {{count}}"
45
+ odd: "має бути непарним"
46
+ even: "має бути парним"
47
+ # Append your own errors here or at the model/attributes scope.
@@ -0,0 +1,26 @@
1
+ uk:
2
+ date:
3
+ formats:
4
+ # Use the strftime parameters for formats.
5
+ # When no format has been given, it uses default.
6
+ # You can provide other formats here if you like!
7
+ default: "%d.%m.%Y"
8
+ short: "%d %b"
9
+ long: "%d %B %Y"
10
+
11
+ day_names: [неділя, понеділок, вівторок, середа, четвер, "п'ятниця", субота]
12
+ abbr_day_names: [нд., пн., вт., ср., чт., пт., сб.]
13
+
14
+ # Don't forget the nil at the beginning; there's no such thing as a 0th month
15
+ month_names: [~, Січень, Лютий, Березень, Квітень, Травень, Червень, Липень, Серпень, Вересень, Жовтень, Листопад, Грудень]
16
+ abbr_month_names: [~, січ., лют., бер., квіт., трав., черв., лип., серп., вер., жовт., лист., груд.]
17
+ # Used in date_select and datime_select.
18
+ order: [ :day, :month, :year ]
19
+
20
+ time:
21
+ formats:
22
+ default: "%a, %d %b %Y, %H:%M:%S %z"
23
+ short: "%d %b, %H:%M"
24
+ long: "%d %B %Y, %H:%M"
25
+ am: "до полудня"
26
+ pm: "по полудні"
@@ -0,0 +1,18 @@
1
+ {
2
+ :uk => {
3
+ :pluralize => lambda { |n|
4
+ modulo10 = n.modulo(10)
5
+ modulo100 = n.modulo(100)
6
+
7
+ if modulo10 == 1 && modulo100 != 11
8
+ :one
9
+ elsif (modulo10 == 2 || modulo10 == 3 || modulo10 == 4) && !(modulo100 == 12 || modulo100 == 13 || modulo100 == 14)
10
+ :few
11
+ elsif modulo10 == 0 || (modulo10 == 5 || modulo10 == 6 || modulo10 == 7 || modulo10 == 8 || modulo10 == 9) || (modulo100 == 11 || modulo100 == 12 || modulo100 == 13 || modulo100 == 14)
12
+ :many
13
+ else
14
+ :other
15
+ end
16
+ }
17
+ }
18
+ }
data/lib/ukrainian.rb ADDED
@@ -0,0 +1,21 @@
1
+ require File.join(File.dirname(__FILE__), 'ukrainian/backend/simple')
2
+ require 'i18n'
3
+
4
+ module Ukrainian
5
+ extend self
6
+
7
+ def init_i18n
8
+ I18n.load_path.unshift(*locale_files)
9
+ end
10
+
11
+ protected
12
+ def locale_path
13
+ File.join(File.dirname(__FILE__), 'ukrainian', 'locale', '**/*')
14
+ end
15
+
16
+ def locale_files
17
+ Dir[locale_path]
18
+ end
19
+ end
20
+
21
+ Ukrainian.init_i18n
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'ukrainian'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class UkrainianTest < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
data/ukrainian.gemspec ADDED
@@ -0,0 +1,60 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{ukrainian}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["romanvbabenko"]
9
+ s.date = %q{2009-07-06}
10
+ s.email = %q{romanvbabenko@gmail.com}
11
+ s.extra_rdoc_files = [
12
+ "LICENSE",
13
+ "README.rdoc"
14
+ ]
15
+ s.files = [
16
+ ".document",
17
+ ".gitignore",
18
+ "LICENSE",
19
+ "README.rdoc",
20
+ "Rakefile",
21
+ "VERSION.yml",
22
+ "lib/ukrainian.rb",
23
+ "lib/ukrainian.rb",
24
+ "lib/ukrainian/backend/simple.rb",
25
+ "lib/ukrainian/locale/acitvesupport.yml",
26
+ "lib/ukrainian/locale/acitvesupport.yml",
27
+ "lib/ukrainian/locale/actionview.yml",
28
+ "lib/ukrainian/locale/actionview.yml",
29
+ "lib/ukrainian/locale/activerecord.yml",
30
+ "lib/ukrainian/locale/activerecord.yml",
31
+ "lib/ukrainian/locale/datetime.yml",
32
+ "lib/ukrainian/locale/datetime.yml",
33
+ "lib/ukrainian/locale/pluralize.rb",
34
+ "test/test_helper.rb",
35
+ "test/ukrainian_test.rb",
36
+ "ukrainian.gemspec"
37
+ ]
38
+ s.homepage = %q{http://github.com/romanvbabenko/ukrainian}
39
+ s.rdoc_options = ["--charset=UTF-8"]
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = %q{1.3.4}
42
+ s.summary = %q{Ukrainian language support for Ruby and Rails}
43
+ s.test_files = [
44
+ "test/test_helper.rb",
45
+ "test/ukrainian_test.rb"
46
+ ]
47
+
48
+ if s.respond_to? :specification_version then
49
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
50
+ s.specification_version = 3
51
+
52
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
53
+ s.add_runtime_dependency(%q<i18n>, [">= 0"])
54
+ else
55
+ s.add_dependency(%q<i18n>, [">= 0"])
56
+ end
57
+ else
58
+ s.add_dependency(%q<i18n>, [">= 0"])
59
+ end
60
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: romanvbabenko-ukrainian
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - romanvbabenko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-07-06 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: i18n
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description:
26
+ email: romanvbabenko@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - LICENSE
33
+ - README.rdoc
34
+ files:
35
+ - .document
36
+ - .gitignore
37
+ - LICENSE
38
+ - README.rdoc
39
+ - Rakefile
40
+ - VERSION.yml
41
+ - lib/ukrainian.rb
42
+ - lib/ukrainian/backend/simple.rb
43
+ - lib/ukrainian/locale/acitvesupport.yml
44
+ - lib/ukrainian/locale/actionview.yml
45
+ - lib/ukrainian/locale/activerecord.yml
46
+ - lib/ukrainian/locale/datetime.yml
47
+ - lib/ukrainian/locale/pluralize.rb
48
+ - test/test_helper.rb
49
+ - test/ukrainian_test.rb
50
+ - ukrainian.gemspec
51
+ has_rdoc: false
52
+ homepage: http://github.com/romanvbabenko/ukrainian
53
+ post_install_message:
54
+ rdoc_options:
55
+ - --charset=UTF-8
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: "0"
63
+ version:
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: "0"
69
+ version:
70
+ requirements: []
71
+
72
+ rubyforge_project:
73
+ rubygems_version: 1.2.0
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: Ukrainian language support for Ruby and Rails
77
+ test_files:
78
+ - test/test_helper.rb
79
+ - test/ukrainian_test.rb