From 9e7603afab6fb0ed62ac9eb5fde2c29090488e36 Mon Sep 17 00:00:00 2001 From: Alexander Lomakin Date: Tue, 17 Jul 2012 15:15:51 +0400 Subject: [PATCH 01/65] Added ability to use %n as a marker to put input number in pluralization variants --- lib/russian.rb | 28 +++++++++++++++------------- spec/russian_spec.rb | 43 +++++++++++++++++++++++++++++-------------- 2 files changed, 44 insertions(+), 27 deletions(-) diff --git a/lib/russian.rb b/lib/russian.rb index 7c426eb..29a69e7 100644 --- a/lib/russian.rb +++ b/lib/russian.rb @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- encoding: utf-8 -*- $KCODE = 'u' if RUBY_VERSION < "1.9" @@ -9,9 +9,9 @@ module Russian extend self - + autoload :Transliteration, 'transliteration' - + # Russian locale LOCALE = :'ru' @@ -25,7 +25,7 @@ def locale LOCALIZE_MONTH_NAMES_MATCH = /(%[-\d]?d|%e)(.*)(%B)/ LOCALIZE_STANDALONE_ABBR_DAY_NAMES_MATCH = /^%a/ LOCALIZE_STANDALONE_DAY_NAMES_MATCH = /^%A/ - + # Init Russian i18n: load all translations shipped with library. def init_i18n I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization) @@ -39,30 +39,31 @@ def init_i18n # See I18n::translate def translate(key, options = {}) I18n.translate(key, options.merge({ :locale => LOCALE })) - end + end alias :t :translate - + # See I18n::localize def localize(object, options = {}) I18n.localize(object, options.merge({ :locale => LOCALE })) end alias :l :localize - + # strftime() proxy with Russian localization def strftime(object, format = :default) localize(object, { :format => format }) end - + # Simple pluralization proxy # - # Usage: + # Usage: # Russian.pluralize(1, "вещь", "вещи", "вещей") # Russian.pluralize(3.14, "вещь", "вещи", "вещей", "вещи") + # Russina.pluralize(5, "Произошла %n ошибка", "Произошло %n ошибки", "Произошло %n ошибок") def pluralize(n, *variants) raise ArgumentError, "Must have a Numeric as a first parameter" unless n.is_a?(Numeric) raise ArgumentError, "Must have at least 3 variants for pluralization" if variants.size < 3 raise ArgumentError, "Must have at least 4 variants for pluralization" if (variants.size < 4 && n != n.round) - variants_hash = pluralization_variants_to_hash(*variants) + variants_hash = pluralization_variants_to_hash(n, *variants) I18n.backend.send(:pluralize, LOCALE, variants_hash, n) end alias :p :pluralize @@ -76,16 +77,17 @@ def transliterate(str) Russian::Transliteration.transliterate(str) end alias :translit :transliterate - + protected # Returns all locale files shipped with library def locale_files Dir[File.join(File.dirname(__FILE__), "russian", "locale", "**/*")] end - + # Converts an array of pluralization variants to a Hash that can be used # with I18n pluralization. - def pluralization_variants_to_hash(*variants) + def pluralization_variants_to_hash(n, *variants) + variants.map!{ |variant| variant.gsub '%n', n.to_s } { :one => variants[0], :few => variants[1], diff --git a/spec/russian_spec.rb b/spec/russian_spec.rb index 6226bf3..2a0555d 100644 --- a/spec/russian_spec.rb +++ b/spec/russian_spec.rb @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- encoding: utf-8 -*- require File.dirname(__FILE__) + '/spec_helper' @@ -12,38 +12,38 @@ Russian.locale.should == Russian::LOCALE end end - + describe "during i18n initialization" do after(:each) do I18n.load_path = [] Russian.init_i18n end - + it "should keep existing translations while switching backends" do I18n.load_path << File.join(File.dirname(__FILE__), 'fixtures', 'en.yml') Russian.init_i18n I18n.t(:foo, :locale => :'en').should == "bar" end - + it "should keep existing :ru translations while switching backends" do I18n.load_path << File.join(File.dirname(__FILE__), 'fixtures', 'ru.yml') Russian.init_i18n I18n.t(:'date.formats.default', :locale => :'ru').should == "override" end - + it "should NOT set default locale to Russian locale" do locale = I18n.default_locale Russian.init_i18n I18n.default_locale.should == locale end end - + describe "with localize proxy" do before(:each) do @time = mock(:time) @options = { :format => "%d %B %Y" } end - + %w(l localize).each do |method| it "'#{method}' should call I18n backend localize" do I18n.should_receive(:localize).with(@time, @options.merge({ :locale => Russian.locale })) @@ -51,7 +51,7 @@ end end end - + describe "with translate proxy" do before(:all) do @object = :bar @@ -65,7 +65,7 @@ end end end - + describe "strftime" do before(:each) do @time = mock(:time) @@ -76,18 +76,18 @@ Russian.should_receive(:localize).with(@time, { :format => format }) Russian.strftime(@time, format) end - + it "should call localize with object and default format when format is not specified" do Russian.should_receive(:localize).with(@time, { :format => :default }) Russian.strftime(@time) end end - + describe "with pluralization" do %w(p pluralize).each do |method| it "'#{method}' should pluralize with variants given" do variants = %w(вещь вещи вещей вещи) - + Russian.send(method, 1, *variants).should == "вещь" Russian.send(method, 2, *variants).should == 'вещи' Russian.send(method, 3, *variants).should == 'вещи' @@ -99,12 +99,27 @@ Russian.send(method, 131, *variants).should == 'вещь' Russian.send(method, 3.14, *variants).should == 'вещи' end - + + it "should pluralize with %n as number" do + variants = ['Произошла %n ошибка', 'Произошло %n ошибки', 'Произошло %n ошибок', 'Произошло %n ошибки'] + + Russian.send(method, 1, *variants).should == 'Произошла 1 ошибка' + Russian.send(method, 2, *variants).should == 'Произошло 2 ошибки' + Russian.send(method, 3, *variants).should == 'Произошло 3 ошибки' + Russian.send(method, 5, *variants).should == 'Произошло 5 ошибок' + Russian.send(method, 10, *variants).should == 'Произошло 10 ошибок' + Russian.send(method, 21, *variants).should == 'Произошла 21 ошибка' + Russian.send(method, 29, *variants).should == 'Произошло 29 ошибок' + Russian.send(method, 129, *variants).should == 'Произошло 129 ошибок' + Russian.send(method, 131, *variants).should == 'Произошла 131 ошибка' + Russian.send(method, 3.14, *variants).should == 'Произошло 3.14 ошибки' + end + it "should raise an exception when first parameter is not a number" do lambda { Russian.send(method, nil, "вещь", "вещи", "вещей") }.should raise_error(ArgumentError) lambda { Russian.send(method, "вещь", "вещь", "вещи", "вещей") }.should raise_error(ArgumentError) end - + it "should raise an exception when there are not enough variants" do lambda { Russian.send(method, 1) }.should raise_error(ArgumentError) lambda { Russian.send(method, 1, "вещь") }.should raise_error(ArgumentError) From 811e6bc37670f2ae94165be541d2efad7d59c56c Mon Sep 17 00:00:00 2001 From: Alexey Savartsov Date: Thu, 9 Aug 2012 16:23:57 +0400 Subject: [PATCH 02/65] Context-based date to allow flags and width --- lib/russian.rb | 4 ++-- spec/i18n/locale/datetime_spec.rb | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/russian.rb b/lib/russian.rb index a3d70b4..b3e1b4b 100644 --- a/lib/russian.rb +++ b/lib/russian.rb @@ -21,8 +21,8 @@ def locale end # Regexp machers for context-based russian month names and day names translation - LOCALIZE_ABBR_MONTH_NAMES_MATCH = /(%d|%e)(.*)(%b)/ - LOCALIZE_MONTH_NAMES_MATCH = /(%d|%e)(.*)(%B)/ + LOCALIZE_ABBR_MONTH_NAMES_MATCH = /(%[-_0^#:]*(\d+)*[EO]?d|%[-_0^#:]*(\d+)*[EO]?e)(.*)(%b)/ + LOCALIZE_MONTH_NAMES_MATCH = /(%[-_0^#:]*(\d+)*[EO]?d|%[-_0^#:]*(\d+)*[EO]?e)(.*)(%B)/ LOCALIZE_STANDALONE_ABBR_DAY_NAMES_MATCH = /^%a/ LOCALIZE_STANDALONE_DAY_NAMES_MATCH = /^%A/ diff --git a/spec/i18n/locale/datetime_spec.rb b/spec/i18n/locale/datetime_spec.rb index ee2a505..768360e 100644 --- a/spec/i18n/locale/datetime_spec.rb +++ b/spec/i18n/locale/datetime_spec.rb @@ -67,6 +67,14 @@ l(@date, :format => "%b").should == "март" l(@date, :format => "%b %Y").should == "март 1985" end + + it "should take flags and width into account" do + @date = Date.parse("1985-03-01") + l(@date, :format => "%-e %B %Y").should == "1 марта 1985" + l(@date, :format => "%3d %B %Y").should == "001 марта 1985" + l(@date, :format => "%_3d %B %Y").should == " 1 марта 1985" + l(@date, :format => "%3_d %B %Y").should == "%3_d Март 1985" + end end it "should define default date components order: day, month, year" do From ad758639350c8ec45b0cd71297f294f03e1c9d1e Mon Sep 17 00:00:00 2001 From: Alexey Savartsov Date: Thu, 9 Aug 2012 16:23:57 +0400 Subject: [PATCH 03/65] Context-based date to allow flags and width --- lib/russian.rb | 4 ++-- spec/i18n/locale/datetime_spec.rb | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/russian.rb b/lib/russian.rb index 7c426eb..b3e1b4b 100644 --- a/lib/russian.rb +++ b/lib/russian.rb @@ -21,8 +21,8 @@ def locale end # Regexp machers for context-based russian month names and day names translation - LOCALIZE_ABBR_MONTH_NAMES_MATCH = /(%[-\d]?d|%e)(.*)(%b)/ - LOCALIZE_MONTH_NAMES_MATCH = /(%[-\d]?d|%e)(.*)(%B)/ + LOCALIZE_ABBR_MONTH_NAMES_MATCH = /(%[-_0^#:]*(\d+)*[EO]?d|%[-_0^#:]*(\d+)*[EO]?e)(.*)(%b)/ + LOCALIZE_MONTH_NAMES_MATCH = /(%[-_0^#:]*(\d+)*[EO]?d|%[-_0^#:]*(\d+)*[EO]?e)(.*)(%B)/ LOCALIZE_STANDALONE_ABBR_DAY_NAMES_MATCH = /^%a/ LOCALIZE_STANDALONE_DAY_NAMES_MATCH = /^%A/ diff --git a/spec/i18n/locale/datetime_spec.rb b/spec/i18n/locale/datetime_spec.rb index 46d52c7..8572fcb 100644 --- a/spec/i18n/locale/datetime_spec.rb +++ b/spec/i18n/locale/datetime_spec.rb @@ -74,6 +74,14 @@ l(@date, :format => "%b").should == "март" l(@date, :format => "%b %Y").should == "март 1985" end + + it "should take flags and width into account" do + @date = Date.parse("1985-03-01") + l(@date, :format => "%-e %B %Y").should == "1 марта 1985" + l(@date, :format => "%3d %B %Y").should == "001 марта 1985" + l(@date, :format => "%_3d %B %Y").should == " 1 марта 1985" + l(@date, :format => "%3_d %B %Y").should == "%3_d Март 1985" + end end it "should define default date components order: day, month, year" do From f1a1b9e6ea21b6947919db7f18209ee56a3b13be Mon Sep 17 00:00:00 2001 From: Alexey Savartsov Date: Fri, 10 Aug 2012 02:46:02 +0400 Subject: [PATCH 04/65] Move strftime specs into existing group --- spec/i18n/locale/datetime_spec.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/spec/i18n/locale/datetime_spec.rb b/spec/i18n/locale/datetime_spec.rb index 8572fcb..00284f6 100644 --- a/spec/i18n/locale/datetime_spec.rb +++ b/spec/i18n/locale/datetime_spec.rb @@ -48,6 +48,10 @@ if RUBY_VERSION > "1.9.2" l(@date, :format => "%1d %B").should == "1 декабря" l(@date, :format => "%2d %B").should == "01 декабря" + l(@date, :format => "%10d %B").should == "0000000001 декабря" + l(@date, :format => "%-e %B %Y").should == "1 декабря 1985" + l(@date, :format => "%_3d %B %Y").should == " 1 декабря 1985" + l(@date, :format => "%3_d %B %Y").should == "%3_d Декабрь 1985" end l(@date, :format => "%e %B %Y").should == " 1 декабря 1985" @@ -74,14 +78,6 @@ l(@date, :format => "%b").should == "март" l(@date, :format => "%b %Y").should == "март 1985" end - - it "should take flags and width into account" do - @date = Date.parse("1985-03-01") - l(@date, :format => "%-e %B %Y").should == "1 марта 1985" - l(@date, :format => "%3d %B %Y").should == "001 марта 1985" - l(@date, :format => "%_3d %B %Y").should == " 1 марта 1985" - l(@date, :format => "%3_d %B %Y").should == "%3_d Март 1985" - end end it "should define default date components order: day, month, year" do From 3f0a6a95807767c7af4bdc77252e5d62031a9d3f Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 29 Nov 2012 06:05:17 +0400 Subject: [PATCH 05/65] Make short month names shorter (3 letters) --- lib/russian/locale/datetime.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/russian/locale/datetime.yml b/lib/russian/locale/datetime.yml index 2f2a825..337c107 100644 --- a/lib/russian/locale/datetime.yml +++ b/lib/russian/locale/datetime.yml @@ -26,8 +26,8 @@ ru: # Don't forget the nil at the beginning; there's no such thing as a 0th month common_month_names: [~, января, февраля, марта, апреля, мая, июня, июля, августа, сентября, октября, ноября, декабря] standalone_month_names: [~, Январь, Февраль, Март, Апрель, Май, Июнь, Июль, Август, Сентябрь, Октябрь, Ноябрь, Декабрь] - common_abbr_month_names: [~, янв., февр., марта, апр., мая, июня, июля, авг., сент., окт., нояб., дек.] - standalone_abbr_month_names: [~, янв., февр., март, апр., май, июнь, июль, авг., сент., окт., нояб., дек.] + common_abbr_month_names: [~, янв, фев, мар, апр, мая, июн, июл, авг, сен, окт, ноя, дек] + standalone_abbr_month_names: [~, янв, фев, мар, апр, май, июн, июл, авг, сен, окт, ноя, дек] # Порядок компонентов даты для хелперов # From 6c754fdc740d23b9921d428177882bf17f0b9cab Mon Sep 17 00:00:00 2001 From: ujifgc Date: Fri, 18 Jan 2013 10:58:48 +0400 Subject: [PATCH 06/65] Performance optimization for 'russian/transliteration' --- lib/russian/transliteration.rb | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/russian/transliteration.rb b/lib/russian/transliteration.rb index 27f89af..7f04205 100644 --- a/lib/russian/transliteration.rb +++ b/lib/russian/transliteration.rb @@ -44,29 +44,21 @@ module Transliteration LOWER = (LOWER_SINGLE.merge(LOWER_MULTI)).freeze UPPER = (UPPER_SINGLE.merge(UPPER_MULTI)).freeze MULTI_KEYS = (LOWER_MULTI.merge(UPPER_MULTI)).keys.sort_by {|s| s.length}.reverse.freeze + SCAN_REGEX = %r{#{MULTI_KEYS.join '|'}|\w|.}.freeze # Transliterate a string with russian characters # # Возвращает строку, в которой все буквы русского алфавита заменены на похожую по звучанию латиницу def transliterate(str) - chars = str.scan(%r{#{MULTI_KEYS.join '|'}|\w|.}) + chars = str.scan(SCAN_REGEX) - result = "" + result = '' chars.each_with_index do |char, index| - if UPPER.has_key?(char) && LOWER.has_key?(chars[index+1]) - # combined case - result << UPPER[char].downcase.capitalize - elsif UPPER.has_key?(char) - result << UPPER[char] - elsif LOWER.has_key?(char) - result << LOWER[char] - else - result << char - end + result << ( LOWER[char] || ( ( upper = UPPER[char] ) ? LOWER[chars[index+1]] ? upper.capitalize : upper : char ) ) end result end end -end \ No newline at end of file +end From 67af610a8f9d13e23ef1afedc532416b156004b1 Mon Sep 17 00:00:00 2001 From: Anton Davydov Date: Sun, 15 Sep 2013 16:06:47 +0400 Subject: [PATCH 07/65] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=20Issue=20#38.=20=D0=94=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=20=D0=B3=D0=B5=D0=BC=20unicode.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 1 + Gemfile.lock | 2 ++ lib/russian.rb | 17 ++++++++++++++--- .../action_view_ext/helpers/date_helper.rb | 4 +--- russian.gemspec | 1 + spec/i18n/locale/datetime_spec.rb | 10 ++++++++++ 6 files changed, 29 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 5e900fb..52c374b 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,7 @@ source :rubygems gem 'rake' gem 'i18n', '>= 0.5.0' gem 'rspec', '~> 2.7.0' +gem 'unicode', '0.4.4' # Rails 3+ gem 'activesupport', '~> 3.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index c1abb5d..d58fc58 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,6 +13,7 @@ GEM rspec-expectations (2.7.0) diff-lcs (~> 1.1.2) rspec-mocks (2.7.0) + unicode (0.4.4) PLATFORMS ruby @@ -22,3 +23,4 @@ DEPENDENCIES i18n (>= 0.5.0) rake rspec (~> 2.7.0) + unicode (= 0.4.4) diff --git a/lib/russian.rb b/lib/russian.rb index 7c426eb..f457618 100644 --- a/lib/russian.rb +++ b/lib/russian.rb @@ -1,17 +1,17 @@ # -*- encoding: utf-8 -*- - $KCODE = 'u' if RUBY_VERSION < "1.9" require 'i18n' $:.push File.join(File.dirname(__FILE__), 'russian') +require 'unicode' require 'russian_rails' module Russian extend self autoload :Transliteration, 'transliteration' - + # Russian locale LOCALE = :'ru' @@ -50,7 +50,7 @@ def localize(object, options = {}) # strftime() proxy with Russian localization def strftime(object, format = :default) - localize(object, { :format => format }) + localize(object, { :format => check_strftime_format(object, format) }) end # Simple pluralization proxy @@ -78,6 +78,17 @@ def transliterate(str) alias :translit :transliterate protected + + def check_strftime_format(object, format) + %w(A a B b).each do |key| + if format =~ /%\^#{key}/ + format = format.gsub("%^#{key}", Unicode::upcase(localize(object, { format: "%#{key}" } ))) + end + end + + format + end + # Returns all locale files shipped with library def locale_files Dir[File.join(File.dirname(__FILE__), "russian", "locale", "**/*")] diff --git a/lib/russian/action_view_ext/helpers/date_helper.rb b/lib/russian/action_view_ext/helpers/date_helper.rb index 9a1b598..5c973b7 100644 --- a/lib/russian/action_view_ext/helpers/date_helper.rb +++ b/lib/russian/action_view_ext/helpers/date_helper.rb @@ -108,10 +108,8 @@ def translated_month_names key = :'date.month_names' end end - - I18n.translate(key, :locale => @options[:locale]) end - + I18n.translate(key, :locale => @options[:locale]) end end end diff --git a/russian.gemspec b/russian.gemspec index 21076d9..a168693 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -20,6 +20,7 @@ Gem::Specification.new do |s| s.summary = %q{Russian language support for Ruby and Rails} s.add_dependency('i18n', '>= 0.5.0') + s.add_dependency('unicode', '0.4.4') s.add_development_dependency 'activesupport', '>= 3.0.0' s.add_development_dependency 'rspec', '~> 2.7.0' diff --git a/spec/i18n/locale/datetime_spec.rb b/spec/i18n/locale/datetime_spec.rb index 46d52c7..ddb05b1 100644 --- a/spec/i18n/locale/datetime_spec.rb +++ b/spec/i18n/locale/datetime_spec.rb @@ -38,6 +38,11 @@ l(@date, :format => "%a").should == "Вс" l(@date, :format => "%a, %d %b %Y").should == "Вс, 01 дек. 1985" end + + it "should use uppercased day names" do + Russian::strftime(@date, "%^a").should == "ВС" + Russian::strftime(@date, "%^A").should == "ВОСКРЕСЕНЬЕ" + end end describe "with month names" do @@ -69,6 +74,11 @@ l(@date, :format => "%e %b %Y").should == " 1 марта 1985" end + it "should use uppercased month names" do + Russian::strftime(@date, "%^b").should == "ДЕК." + Russian::strftime(@date, "%^B").should == "ДЕКАБРЬ" + end + it "should use standalone abbreviated month names" do @date = Date.parse("1985-03-01") l(@date, :format => "%b").should == "март" From ac5033eb1d7da3253e17fcc8a8d13a1e8270d285 Mon Sep 17 00:00:00 2001 From: Alexander Semyonov Date: Mon, 16 Sep 2013 11:14:08 -0700 Subject: [PATCH 08/65] Fix hash syntax to be 1.8-compatible --- lib/russian.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/russian.rb b/lib/russian.rb index f457618..904bdd0 100644 --- a/lib/russian.rb +++ b/lib/russian.rb @@ -82,7 +82,7 @@ def transliterate(str) def check_strftime_format(object, format) %w(A a B b).each do |key| if format =~ /%\^#{key}/ - format = format.gsub("%^#{key}", Unicode::upcase(localize(object, { format: "%#{key}" } ))) + format = format.gsub("%^#{key}", Unicode::upcase(localize(object, { :format => "%#{key}" } ))) end end From 2bb97307923f59b0734401761456bff2a461df9f Mon Sep 17 00:00:00 2001 From: Anton Davydov Date: Tue, 17 Sep 2013 21:10:05 +0400 Subject: [PATCH 09/65] Fix to be jruby-compatible --- Gemfile | 11 ++++++++--- Gemfile.lock | 5 +++-- lib/russian.rb | 13 +++++++++++-- lib/russian/action_view_ext/helpers/date_helper.rb | 4 +++- russian.gemspec | 8 +++++++- 5 files changed, 32 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index 52c374b..ab21b25 100644 --- a/Gemfile +++ b/Gemfile @@ -3,8 +3,13 @@ source :rubygems gem 'rake' gem 'i18n', '>= 0.5.0' gem 'rspec', '~> 2.7.0' -gem 'unicode', '0.4.4' -# Rails 3+ -gem 'activesupport', '~> 3.0.0' +# JRuby +if RUBY_ENGINE == "jruby" + gem 'unicode_utils', '1.4.0' +else + gem 'unicode', '0.4.4' +end +# Rails 3+ +gem 'activesupport', '~> 3.0.0' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index d58fc58..099fdd6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,9 +13,10 @@ GEM rspec-expectations (2.7.0) diff-lcs (~> 1.1.2) rspec-mocks (2.7.0) - unicode (0.4.4) + unicode_utils (1.4.0) PLATFORMS + java ruby DEPENDENCIES @@ -23,4 +24,4 @@ DEPENDENCIES i18n (>= 0.5.0) rake rspec (~> 2.7.0) - unicode (= 0.4.4) + unicode_utils (= 1.4.0) diff --git a/lib/russian.rb b/lib/russian.rb index 904bdd0..8e0b86c 100644 --- a/lib/russian.rb +++ b/lib/russian.rb @@ -4,9 +4,14 @@ require 'i18n' $:.push File.join(File.dirname(__FILE__), 'russian') -require 'unicode' require 'russian_rails' +if RUBY_ENGINE == "jruby" + require 'unicode_utils/upcase' +else + require 'unicode' +end + module Russian extend self @@ -82,7 +87,11 @@ def transliterate(str) def check_strftime_format(object, format) %w(A a B b).each do |key| if format =~ /%\^#{key}/ - format = format.gsub("%^#{key}", Unicode::upcase(localize(object, { :format => "%#{key}" } ))) + if RUBY_ENGINE == "jruby" + format = format.gsub("%^#{key}", UnicodeUtils.upcase(localize(object, { :format => "%#{key}" } ))) + else + format = format.gsub("%^#{key}", Unicode::upcase(localize(object, { :format => "%#{key}" } ))) + end end end diff --git a/lib/russian/action_view_ext/helpers/date_helper.rb b/lib/russian/action_view_ext/helpers/date_helper.rb index 5c973b7..9a1b598 100644 --- a/lib/russian/action_view_ext/helpers/date_helper.rb +++ b/lib/russian/action_view_ext/helpers/date_helper.rb @@ -108,8 +108,10 @@ def translated_month_names key = :'date.month_names' end end + + I18n.translate(key, :locale => @options[:locale]) end - I18n.translate(key, :locale => @options[:locale]) + end end end diff --git a/russian.gemspec b/russian.gemspec index a168693..6b1bfc3 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -20,7 +20,13 @@ Gem::Specification.new do |s| s.summary = %q{Russian language support for Ruby and Rails} s.add_dependency('i18n', '>= 0.5.0') - s.add_dependency('unicode', '0.4.4') + + # JRuby + if RUBY_ENGINE == "jruby" + s.add_dependency('unicode_utils', '1.4.0') + else + s.add_dependency('unicode', '0.4.4') + end s.add_development_dependency 'activesupport', '>= 3.0.0' s.add_development_dependency 'rspec', '~> 2.7.0' From a87e9ecf28fddac9e435018ee68267d69d66822d Mon Sep 17 00:00:00 2001 From: Anton Davydov Date: Tue, 17 Sep 2013 21:54:04 +0400 Subject: [PATCH 10/65] Fix russian.gemspec --- Gemfile.lock | 4 ++-- russian.gemspec | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 099fdd6..1a5c6d2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,7 +13,7 @@ GEM rspec-expectations (2.7.0) diff-lcs (~> 1.1.2) rspec-mocks (2.7.0) - unicode_utils (1.4.0) + unicode (0.4.4) PLATFORMS java @@ -24,4 +24,4 @@ DEPENDENCIES i18n (>= 0.5.0) rake rspec (~> 2.7.0) - unicode_utils (= 1.4.0) + unicode (= 0.4.4) diff --git a/russian.gemspec b/russian.gemspec index 6b1bfc3..8319b81 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -21,8 +21,7 @@ Gem::Specification.new do |s| s.add_dependency('i18n', '>= 0.5.0') - # JRuby - if RUBY_ENGINE == "jruby" + if RUBY_PLATFORM == 'java' s.add_dependency('unicode_utils', '1.4.0') else s.add_dependency('unicode', '0.4.4') From 778e6a15b99f28198673ae3d16e941581e2665b9 Mon Sep 17 00:00:00 2001 From: Anton Davydov Date: Tue, 17 Sep 2013 22:03:34 +0400 Subject: [PATCH 11/65] Fix Gemfile --- Gemfile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index ab21b25..034c004 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,16 @@ gem 'rake' gem 'i18n', '>= 0.5.0' gem 'rspec', '~> 2.7.0' -# JRuby -if RUBY_ENGINE == "jruby" - gem 'unicode_utils', '1.4.0' + +if RUBY_PLATFORM == 'java' else +end + +platforms :jruby do + gem 'unicode_utils', '1.4.0' +end + +platforms :ruby, :mswin, :mingw do gem 'unicode', '0.4.4' end From 4260b256387e87fa2f2ef77fa32dedf86a2a74ac Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 24 Oct 2013 01:29:13 +0400 Subject: [PATCH 12/65] fix specs, add rvm --- .ruby-gemset | 1 + .ruby-version | 1 + Gemfile.lock | 2 ++ spec/i18n/locale/datetime_spec.rb | 22 +++++++++++----------- 4 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 .ruby-gemset create mode 100644 .ruby-version diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000..26d9537 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +russian \ No newline at end of file diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..227cea2 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.0.0 diff --git a/Gemfile.lock b/Gemfile.lock index 1a5c6d2..193cb8d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,6 +14,7 @@ GEM diff-lcs (~> 1.1.2) rspec-mocks (2.7.0) unicode (0.4.4) + unicode_utils (1.4.0) PLATFORMS java @@ -25,3 +26,4 @@ DEPENDENCIES rake rspec (~> 2.7.0) unicode (= 0.4.4) + unicode_utils (= 1.4.0) diff --git a/spec/i18n/locale/datetime_spec.rb b/spec/i18n/locale/datetime_spec.rb index 9526780..d3995b3 100644 --- a/spec/i18n/locale/datetime_spec.rb +++ b/spec/i18n/locale/datetime_spec.rb @@ -15,7 +15,7 @@ end it "should use short format" do - l(@date, :format => :short).should == "01 дек." + l(@date, :format => :short).should == "01 дек" end it "should use long format" do @@ -36,7 +36,7 @@ it "should use abbreviated day names" do l(@date, :format => "%a").should == "Вс" - l(@date, :format => "%a, %d %b %Y").should == "Вс, 01 дек. 1985" + l(@date, :format => "%a, %d %b %Y").should == "Вс, 01 дек 1985" end it "should use uppercased day names" do @@ -72,21 +72,21 @@ it "should use abbreviated month names" do @date = Date.parse("1985-03-01") - l(@date, :format => "%d %b").should == "01 марта" - l(@date, :format => "%e %b %Y").should == " 1 марта 1985" - l(@date, :format => "%d %b").should == "01 марта" - l(@date, :format => "%e %b %Y").should == " 1 марта 1985" + l(@date, :format => "%d %b").should == "01 мар" + l(@date, :format => "%e %B %Y").should == " 1 марта 1985" + l(@date, :format => "%d %B").should == "01 марта" + l(@date, :format => "%e %B %Y").should == " 1 марта 1985" end it "should use uppercased month names" do - Russian::strftime(@date, "%^b").should == "ДЕК." + Russian::strftime(@date, "%^b").should == "ДЕК" Russian::strftime(@date, "%^B").should == "ДЕКАБРЬ" end it "should use standalone abbreviated month names" do @date = Date.parse("1985-03-01") - l(@date, :format => "%b").should == "март" - l(@date, :format => "%b %Y").should == "март 1985" + l(@date, :format => "%b").should == "мар" + l(@date, :format => "%b %Y").should == "мар 1985" end end @@ -96,11 +96,11 @@ describe "with time formats" do it "should use default format" do - l(@time).should =~ /^Вс, 01 дек. 1985, 16:05:00/ + l(@time).should match(/^Вс, 01 дек 1985, 16:05:00/) end it "should use short format" do - l(@time, :format => :short).should == "01 дек., 16:05" + l(@time, :format => :short).should == "01 дек, 16:05" end it "should use long format" do From 5146ae0335da400cf7cb043ef2b69f6d5a58fa3c Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 24 Oct 2013 01:37:39 +0400 Subject: [PATCH 13/65] fork gem --- Gemfile | 22 ++---------------- Gemfile.lock | 57 +++++++++++++++++++++++++++++++---------------- README.textile | 37 ++++++------------------------ lib/rs_russian.rb | 1 + lib/russian.rb | 3 +-- russian.gemspec | 45 ++++++++++++++++++++----------------- 6 files changed, 74 insertions(+), 91 deletions(-) create mode 100644 lib/rs_russian.rb diff --git a/Gemfile b/Gemfile index 034c004..896d547 100644 --- a/Gemfile +++ b/Gemfile @@ -1,21 +1,3 @@ -source :rubygems +source "https://rubygems.org" -gem 'rake' -gem 'i18n', '>= 0.5.0' -gem 'rspec', '~> 2.7.0' - - -if RUBY_PLATFORM == 'java' -else -end - -platforms :jruby do - gem 'unicode_utils', '1.4.0' -end - -platforms :ruby, :mswin, :mingw do - gem 'unicode', '0.4.4' -end - -# Rails 3+ -gem 'activesupport', '~> 3.0.0' \ No newline at end of file +gemspec \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 193cb8d..db08c45 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,29 +1,48 @@ +PATH + remote: . + specs: + rs_russian (0.6.0) + i18n (>= 0.5.0) + unicode (= 0.4.4) + GEM - remote: http://rubygems.org/ + remote: https://rubygems.org/ specs: - activesupport (3.0.10) - diff-lcs (1.1.3) - i18n (0.6.0) - rake (0.9.2.2) - rspec (2.7.0) - rspec-core (~> 2.7.0) - rspec-expectations (~> 2.7.0) - rspec-mocks (~> 2.7.0) - rspec-core (2.7.1) - rspec-expectations (2.7.0) - diff-lcs (~> 1.1.2) - rspec-mocks (2.7.0) + activesupport (4.0.0) + i18n (~> 0.6, >= 0.6.4) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) + atomic (1.1.14) + atomic (1.1.14-java) + diff-lcs (1.2.4) + i18n (0.6.5) + minitest (4.7.5) + multi_json (1.8.2) + rake (10.1.0) + rspec (2.14.1) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + rspec-core (2.14.6) + rspec-expectations (2.14.3) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.14.4) + thread_safe (0.1.3) + atomic + thread_safe (0.1.3-java) + atomic + tzinfo (0.3.38) unicode (0.4.4) - unicode_utils (1.4.0) PLATFORMS java ruby DEPENDENCIES - activesupport (~> 3.0.0) - i18n (>= 0.5.0) + activesupport (>= 3.0.0) + bundler (~> 1.3) rake - rspec (~> 2.7.0) - unicode (= 0.4.4) - unicode_utils (= 1.4.0) + rs_russian! + rspec diff --git a/README.textile b/README.textile index cf43a1b..41df2af 100644 --- a/README.textile +++ b/README.textile @@ -1,5 +1,10 @@ h1. Russian -"!https://secure.travis-ci.org/yaroslav/russian.png!":http://travis-ci.org/yaroslav/russian +"!https://secure.travis-ci.org/rs-pro/russian.png!":http://travis-ci.org/rs-pro/russian + +h1. Это форк с вытянутыми pull-реквестами, которые мы хотели использовать. + +Нравится -- пользуйтесь, не нравится -- идите на страницу оригинала: "http://github.com/yaroslav/russian/":http://github.com/yaroslav/russian/ + Поддержка русского языка для Ruby и Rails при помощи библиотеки I18n. @@ -32,40 +37,12 @@ h2. Что такое I18n. История Однако, документация по плюрализации и транслитерации в I18n была неочевидной, а поддержка lambda-переводов для локализации даты-времени была практически "спрятана" в исходном коде, поэтому большинство разработчиков в основном использовали самые базовые таблицы переводов: локализацию Rails и, иногда, — плюрализацию. Возникла мысль выпустить @gem russian@ для последней версии @gem i18n@ и Ruby on Rails с поддержкой всех необходимых функций, но, на этот раз, грамотно сделанных через интерфейсы I18n. К сожалению, "хаки" для Ruby on Rails (хелперы даты-времени) вряд ли когда-либо будут включены в дистрибутив Rails, поэтому использовать их придется отдельно. -h1. Требования - -* Ruby 1.8.7 или 1.9.2 (поддерживается совместимость с JRuby и Rubinius); -"!https://secure.travis-ci.org/yaroslav/russian.png!":http://travis-ci.org/yaroslav/russian - -* Для использования с Rails нужна версия не ниже 3.0 (для более старых версий Rails используйте версии gem russian ветки 0.2); -* Для разработки и тестирования библиотеки вам понадобятся Bundler и RSpec. - h1. Установка -Страница Russian на GitHub -- "http://github.com/yaroslav/russian/":http://github.com/yaroslav/russian/ - -Для установки: - -@gem install russian@ - -Чтобы задать локаль по умолчанию в вашем приложении, используйте - -

-I18n.default_locale = :ru
-
- -Чтобы установить локаль для текущего треда, используйте - -

-I18n.locale = :ru
-
- -h2. Ruby on Rails 3.0 и выше - В вашем @Gemfile@ сделайте ссылку на gem @russian@:

-gem 'russian', '~> 0.6.0'
+gem 'rs_russian', '~> 0.6.0'
 
И установите gem в проект с помощью bundler: diff --git a/lib/rs_russian.rb b/lib/rs_russian.rb new file mode 100644 index 0000000..6696867 --- /dev/null +++ b/lib/rs_russian.rb @@ -0,0 +1 @@ +require 'russian' \ No newline at end of file diff --git a/lib/russian.rb b/lib/russian.rb index 94dea7f..d4e8294 100644 --- a/lib/russian.rb +++ b/lib/russian.rb @@ -1,5 +1,4 @@ -# -*- encoding: utf-8 -*- -# -*- encoding: utf-8 -*- +# coding: utf-8 $KCODE = 'u' if RUBY_VERSION < "1.9" diff --git a/russian.gemspec b/russian.gemspec index 8319b81..81333c0 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -3,30 +3,35 @@ $: << File.expand_path('../lib', __FILE__) require 'russian/version' -Gem::Specification.new do |s| - s.name = %q{russian} - s.version = Russian::VERSION::STRING +Gem::Specification.new do |spec| + spec.name = "rs_russian" + spec.version = Russian::VERSION::STRING + spec.authors = ["glebtv", "Yaroslav Markin"] + spec.email = ["glebtv@gmail.com", "yaroslav@markin.net"] + spec.description = %q{Russian language support for Ruby and Rails} + spec.summary = %q{Russian language support for Ruby and Rails} + spec.homepage = "https://github.com/rs-pro/russian" + spec.license = "MIT" - s.required_rubygems_version = '>= 1.3.5' - s.authors = ["Yaroslav Markin"] - s.autorequire = %q{russian} - s.description = %q{Russian language support for Ruby and Rails} - s.email = %q{yaroslav@markin.net} - s.extra_rdoc_files = ["README.textile", "LICENSE", "CHANGELOG", "TODO"] - s.files = Dir.glob("{lib,spec}/**/**") + %w(CHANGELOG Gemfile LICENSE Rakefile README.textile russian.gemspec TODO) - s.platform = Gem::Platform::RUBY - s.homepage = %q{http://github.com/yaroslav/russian/} - s.require_paths = ["lib"] - s.summary = %q{Russian language support for Ruby and Rails} + spec.files = `git ls-files`.split($/) + spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } + spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) + spec.require_paths = ["lib"] - s.add_dependency('i18n', '>= 0.5.0') + spec.add_development_dependency "bundler", "~> 1.3" + spec.add_development_dependency "rake" + spec.add_development_dependency "rspec" + + spec.add_dependency('i18n', '>= 0.5.0') if RUBY_PLATFORM == 'java' - s.add_dependency('unicode_utils', '1.4.0') + spec.add_dependency('unicode_utils', '1.4.0') else - s.add_dependency('unicode', '0.4.4') + spec.add_dependency('unicode', '0.4.4') end - - s.add_development_dependency 'activesupport', '>= 3.0.0' - s.add_development_dependency 'rspec', '~> 2.7.0' + + spec.add_development_dependency "bundler", "~> 1.3" + spec.add_development_dependency "rake" + spec.add_development_dependency "rspec" + spec.add_development_dependency 'activesupport', '>= 3.0.0' end From 14d920f8b12e2fca0d17f84555849d169a37e216 Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 24 Oct 2013 01:39:54 +0400 Subject: [PATCH 14/65] for travis --- README.textile | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/README.textile b/README.textile index 41df2af..6863bf6 100644 --- a/README.textile +++ b/README.textile @@ -1,12 +1,10 @@ -h1. Russian +h1. rs_russian "!https://secure.travis-ci.org/rs-pro/russian.png!":http://travis-ci.org/rs-pro/russian -h1. Это форк с вытянутыми pull-реквестами, которые мы хотели использовать. +h3. Это форк с вытянутыми pull-реквестами, которые мы хотели использовать. Нравится -- пользуйтесь, не нравится -- идите на страницу оригинала: "http://github.com/yaroslav/russian/":http://github.com/yaroslav/russian/ - - Поддержка русского языка для Ruby и Rails при помощи библиотеки I18n. Russian language support for Ruby and Rails, using I18n library. @@ -41,9 +39,7 @@ h1. Установка В вашем @Gemfile@ сделайте ссылку на gem @russian@: -

-gem 'rs_russian', '~> 0.6.0'
-
+
gem 'rs_russian', '~> 0.6.0'
И установите gem в проект с помощью bundler: @@ -51,9 +47,7 @@ gem 'rs_russian', '~> 0.6.0' Далее, укажите -

-config.i18n.default_locale = :ru
-
+
config.i18n.default_locale = :ru
в @config/application.rb@. Если по умолчанию нужна другая локаль, или же нужно переключать локали "на ходу", используйте методы модуля I18n (см. выше). Также ознакомьтесь с "документацией к I18n":http://rdoc.info/github/svenfuchs/i18n/master и "гидом по интернационализации Ruby on Rails":http://guides.rubyonrails.org/i18n.html. From 431fcfe17325aff615f3989c53d7ca04fa1ee50d Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 24 Oct 2013 01:41:22 +0400 Subject: [PATCH 15/65] code in readme [ci skip] --- .README.textile.kate-swp | Bin 0 -> 155 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .README.textile.kate-swp diff --git a/.README.textile.kate-swp b/.README.textile.kate-swp new file mode 100644 index 0000000000000000000000000000000000000000..bf4cfbeb0174698539db1d1ee3424a71a3b07d80 GIT binary patch literal 155 zcmZQzU=Z?7EJ;-eE>A2_aLdd|RWQ;sU|?Vnn5!%Mkuj;G!McB9_GIO|V!=T`QF9;$ yft?_ZDVWK?ARP*1Sbzv~5MkyT45CaS)HW1q4}^CJLY;t6(;<`{gmQsU&aMFK#vcj* literal 0 HcmV?d00001 From 0ea2239daaaec76712cc6a010e65d511a07fbbe1 Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 24 Oct 2013 01:43:38 +0400 Subject: [PATCH 16/65] test with newer rubies --- .README.textile.kate-swp | Bin 155 -> 0 bytes .travis.yml | 11 ++++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) delete mode 100644 .README.textile.kate-swp diff --git a/.README.textile.kate-swp b/.README.textile.kate-swp deleted file mode 100644 index bf4cfbeb0174698539db1d1ee3424a71a3b07d80..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 155 zcmZQzU=Z?7EJ;-eE>A2_aLdd|RWQ;sU|?Vnn5!%Mkuj;G!McB9_GIO|V!=T`QF9;$ yft?_ZDVWK?ARP*1Sbzv~5MkyT45CaS)HW1q4}^CJLY;t6(;<`{gmQsU&aMFK#vcj* diff --git a/.travis.yml b/.travis.yml index 5a7f772..764b2e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,11 @@ +notifications: + email: false + +language: ruby rvm: - - 1.8.7 - 1.9.2 - - ree - rbx - - jruby + - 1.9.3 + - 2.0.0 + - jruby-19mode + - rbx-19mode From 89380bd03a26972d892a18ef4c1bfd677d8823db Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 24 Oct 2013 01:44:10 +0400 Subject: [PATCH 17/65] don't test 1.9.2 - activesupport won't install cleanly --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 764b2e0..1638163 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ notifications: language: ruby rvm: - - 1.9.2 - rbx - 1.9.3 - 2.0.0 From 640e4e850e7057f71dc986ee13eb099185409f21 Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 24 Oct 2013 01:45:00 +0400 Subject: [PATCH 18/65] test only rbx19 [ci skip] --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1638163..73ba5b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ notifications: language: ruby rvm: - - rbx - 1.9.3 - 2.0.0 - jruby-19mode From 63eacf07f1fd51d13573ad3a435042d22ad81a6f Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 24 Oct 2013 02:01:29 +0400 Subject: [PATCH 19/65] travis --- Gemfile.lock | 4 ++-- russian.gemspec | 18 +++++++----------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index db08c45..1972006 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,8 +2,8 @@ PATH remote: . specs: rs_russian (0.6.0) - i18n (>= 0.5.0) - unicode (= 0.4.4) + i18n (~> 0.6.0) + unicode (~> 0.4.4) GEM remote: https://rubygems.org/ diff --git a/russian.gemspec b/russian.gemspec index 81333c0..517dac6 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -18,20 +18,16 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_development_dependency "bundler", "~> 1.3" - spec.add_development_dependency "rake" - spec.add_development_dependency "rspec" - - spec.add_dependency('i18n', '>= 0.5.0') + spec.add_dependency 'i18n', '~> 0.6.0' - if RUBY_PLATFORM == 'java' - spec.add_dependency('unicode_utils', '1.4.0') + unless RUBY_PLATFORM =~ /java/ + spec.add_dependency 'unicode', '~> 0.4.4' else - spec.add_dependency('unicode', '0.4.4') + spec.add_dependency 'unicode_utils', '~> 1.4.0' end - spec.add_development_dependency "bundler", "~> 1.3" - spec.add_development_dependency "rake" - spec.add_development_dependency "rspec" + spec.add_development_dependency 'bundler', '~> 1.3' + spec.add_development_dependency 'rake' + spec.add_development_dependency 'rspec' spec.add_development_dependency 'activesupport', '>= 3.0.0' end From 173eaee5fe8aa32283ceb9b29823bb730b5ff395 Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 24 Oct 2013 02:02:43 +0400 Subject: [PATCH 20/65] add bundler gem tasks [ci skip] --- Rakefile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Rakefile b/Rakefile index 0e65175..493cd35 100644 --- a/Rakefile +++ b/Rakefile @@ -1,10 +1,12 @@ -require 'rubygems' +require 'bundler/setup' +Bundler::GemHelper.install_tasks + require 'rspec/core/rake_task' -require 'rubygems/specification' -task :default => :spec -desc "Run specs" -RSpec::Core::RakeTask.new do |t| - t.pattern = FileList['spec/**/*_spec.rb'] - t.rspec_opts = %w(-fs --color) +desc "Run all examples" +RSpec::Core::RakeTask.new(:spec) do |t| + #t.rspec_path = 'bin/rspec' + t.rspec_opts = %w[--color] end + +task :default => :spec \ No newline at end of file From 7acceee9ac127909bcd3f011b97f410f95a49eb8 Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 24 Oct 2013 02:03:13 +0400 Subject: [PATCH 21/65] bump version --- lib/russian/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/russian/version.rb b/lib/russian/version.rb index 716fd76..26cfe14 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,7 +1,7 @@ module Russian module VERSION MAJOR = 0 - MINOR = 6 + MINOR = 7 TINY = 0 STRING = [MAJOR, MINOR, TINY].join('.') From d2df9d7a70f09014a9921fc6f576f742e69c657e Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 24 Oct 2013 02:03:38 +0400 Subject: [PATCH 22/65] readme [ci skip] --- Gemfile.lock | 2 +- README.textile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1972006..e16d653 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rs_russian (0.6.0) + rs_russian (0.7.0) i18n (~> 0.6.0) unicode (~> 0.4.4) diff --git a/README.textile b/README.textile index 6863bf6..95399df 100644 --- a/README.textile +++ b/README.textile @@ -39,7 +39,7 @@ h1. Установка В вашем @Gemfile@ сделайте ссылку на gem @russian@: -
gem 'rs_russian', '~> 0.6.0'
+
gem 'rs_russian', '~> 0.7.0'
И установите gem в проект с помощью bundler: From f9bc3fe4981a4445cf2b53b3bd9cf513e20990c8 Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 24 Oct 2013 02:47:40 +0400 Subject: [PATCH 23/65] trigger Travis --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 896d547..b4e2a20 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,3 @@ source "https://rubygems.org" -gemspec \ No newline at end of file +gemspec From 2a72e6e116203d62f38d0c41c6ed600c933850aa Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 24 Oct 2013 02:54:31 +0400 Subject: [PATCH 24/65] disable jruby and rbx for now --- .travis.yml | 4 ++-- russian.gemspec | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 73ba5b7..4ff5c59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,5 +5,5 @@ language: ruby rvm: - 1.9.3 - 2.0.0 - - jruby-19mode - - rbx-19mode + #- jruby-19mode + #- rbx-19mode diff --git a/russian.gemspec b/russian.gemspec index 517dac6..150cd7b 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -20,10 +20,10 @@ Gem::Specification.new do |spec| spec.add_dependency 'i18n', '~> 0.6.0' - unless RUBY_PLATFORM =~ /java/ - spec.add_dependency 'unicode', '~> 0.4.4' - else + if RUBY_PLATFORM =~ /java/ spec.add_dependency 'unicode_utils', '~> 1.4.0' + else + spec.add_dependency 'unicode', '~> 0.4.4' end spec.add_development_dependency 'bundler', '~> 1.3' From 1909a4c2978d0d734e21225fe59b810f215dccf2 Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 24 Oct 2013 03:00:04 +0400 Subject: [PATCH 25/65] trailing spaces --- README.textile | 4 ++-- lib/russian.rb | 6 +++--- .../action_view_ext/helpers/date_helper.rb | 18 +++++++++--------- .../active_model_ext/custom_error_message.rb | 16 ++++++++-------- lib/russian/locale/actionview.yml | 16 ++++++++-------- lib/russian/locale/activemodel.yml | 2 +- lib/russian/locale/activerecord.yml | 6 +++--- lib/russian/locale/activesupport.yml | 8 ++++---- lib/russian/locale/datetime.rb | 2 +- lib/russian/locale/datetime.yml | 10 +++++----- lib/russian/locale/pluralization.rb | 6 +++--- lib/russian/locale/transliterator.rb | 2 +- lib/russian/russian_rails.rb | 2 +- lib/russian/transliteration.rb | 4 ++-- russian.gemspec | 2 +- spec/i18n/locale/datetime_spec.rb | 2 +- spec/i18n/locale/pluralization_spec.rb | 4 ++-- spec/locale_spec.rb | 12 ++++++------ spec/spec_helper.rb | 2 +- spec/transliteration_spec.rb | 10 +++++----- 20 files changed, 67 insertions(+), 67 deletions(-) diff --git a/README.textile b/README.textile index 95399df..7530b57 100644 --- a/README.textile +++ b/README.textile @@ -87,7 +87,7 @@ I18n.locale = :ru После загрузки Russian можно использовать все стандартные функции библиотеки I18n, пользоваться измененным функционалом для лучшей поддержки русского языка, или использовать хелперы модуля Russian для еще более простой работы с русским языком. -"Документация I18n":http://rdoc.info/github/svenfuchs/i18n/master +"Документация I18n":http://rdoc.info/github/svenfuchs/i18n/master "Гид по интернационализации Ruby on Rails":http://guides.rubyonrails.org/i18n.html. @@ -137,7 +137,7 @@ h3. Валидация @Соглашение об использовании нужно принять соглашение@ если вы указали перевод для имени атрибута. - + Но @validates_acceptance_of :accepted_terms, :message => '^Нужно принять соглашение'@ diff --git a/lib/russian.rb b/lib/russian.rb index d4e8294..430d6af 100644 --- a/lib/russian.rb +++ b/lib/russian.rb @@ -1,4 +1,4 @@ -# coding: utf-8 +# coding: utf-8 $KCODE = 'u' if RUBY_VERSION < "1.9" @@ -85,10 +85,10 @@ def transliterate(str) alias :translit :transliterate protected - + def check_strftime_format(object, format) %w(A a B b).each do |key| - if format =~ /%\^#{key}/ + if format =~ /%\^#{key}/ if RUBY_ENGINE == "jruby" format = format.gsub("%^#{key}", UnicodeUtils.upcase(localize(object, { :format => "%#{key}" } ))) else diff --git a/lib/russian/action_view_ext/helpers/date_helper.rb b/lib/russian/action_view_ext/helpers/date_helper.rb index 9a1b598..c5e7f43 100644 --- a/lib/russian/action_view_ext/helpers/date_helper.rb +++ b/lib/russian/action_view_ext/helpers/date_helper.rb @@ -1,20 +1,20 @@ -# -*- encoding: utf-8 -*- +# -*- encoding: utf-8 -*- -# Заменяет хелпер Rails select_month и метод translated_month_names +# Заменяет хелпер Rails select_month и метод translated_month_names # для поддержки функционала "отдельностоящих имен месяцев". # # Теперь можно использовать и полные, и сокращенные название месяцев в двух вариантах -- контекстном # (по умолчанию) и отдельностоящем (если в текущем языке есть соответствующие переводы). -# Теперь хелперы поддерживают ключ :use_standalone_month_names, хелпер select_month +# Теперь хелперы поддерживают ключ :use_standalone_month_names, хелпер select_month # устанавливает его по умолчанию. # Отдельностоящие имена месяцев также используютс когда указан ключ :discard_day. # # # Replaces Rails select_month helper and translated_month_names private method to provide -# "standalone month names" feature. +# "standalone month names" feature. # # It is now possible to use both abbreviated and full month names in two variants (if current locale provides them). -# All date helpers support :use_standalone_month_names key now, select_month helper sets +# All date helpers support :use_standalone_month_names key now, select_month helper sets # it to true by default. # Standalone month names are also used when :discard_day key is provided. if defined?(ActionView::Helpers::DateTimeSelector) @@ -27,7 +27,7 @@ module DateHelper # instead of names -- set the :use_month_numbers key in +options+ to true for this to happen. If you # want both numbers and names, set the :add_month_numbers key in +options+ to true. If you would prefer # to show month names as abbreviations, set the :use_short_month key in +options+ to true. If you want - # to use your own month names, set the :use_month_names key in +options+ to an array of 12 month names. + # to use your own month names, set the :use_month_names key in +options+ to an array of 12 month names. # You can also choose if you want to use i18n standalone month names or default month names -- you can # force standalone month names usage by using :use_standalone_month_names key. # Override the field name using the :field_name option, 'month' by default. @@ -66,7 +66,7 @@ def select_month(date, options = {}, html_options = {}) DateTimeSelector.new(date, options.merge(:use_standalone_month_names => true), html_options).select_month end end - + class DateTimeSelector #:nodoc: private # Returns translated month names @@ -108,10 +108,10 @@ def translated_month_names key = :'date.month_names' end end - + I18n.translate(key, :locale => @options[:locale]) end - + end end end diff --git a/lib/russian/active_model_ext/custom_error_message.rb b/lib/russian/active_model_ext/custom_error_message.rb index 4698409..02c7cf7 100644 --- a/lib/russian/active_model_ext/custom_error_message.rb +++ b/lib/russian/active_model_ext/custom_error_message.rb @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- encoding: utf-8 -*- if defined?(ActiveModel::Errors) module ActiveModel @@ -13,19 +13,19 @@ class Errors # теперь не имеют префикса с названием атрибута если в сообщении об ошибке первым символом указан "^". # # Так, например, - # + # # validates_acceptance_of :accepted_terms, :message => 'нужно принять соглашение' - # + # # даст сообщение - # + # # Accepted terms нужно принять соглашение - # + # # однако, - # + # # validates_acceptance_of :accepted_terms, :message => '^Нужно принять соглашение' - # + # # даст сообщение - # + # # Нужно принять соглашение # # diff --git a/lib/russian/locale/actionview.yml b/lib/russian/locale/actionview.yml index 4207a47..c536d90 100644 --- a/lib/russian/locale/actionview.yml +++ b/lib/russian/locale/actionview.yml @@ -14,7 +14,7 @@ ru: precision: 3 significant: false strip_insignificant_zeros: false - + # Used in number_to_currency() currency: format: @@ -30,14 +30,14 @@ ru: precision: 2 significant: false strip_insignificant_zeros: false - + # Used in number_to_percentage() percentage: format: # These three are to override number.format and are optional - # separator: + # separator: delimiter: "" - + # Used in number_to_precision() precision: format: @@ -45,20 +45,20 @@ ru: # separator: delimiter: "" # precision: - + # Used in number_to_human_size() human: format: # These three are to override number.format and are optional - # separator: + # separator: delimiter: "" precision: 1 significant: false strip_insignificant_zeros: false - + # Rails 2.2 # storage_units: [байт, КБ, МБ, ГБ, ТБ] - + # Rails 2.3+ storage_units: # Storage units output formatting. diff --git a/lib/russian/locale/activemodel.yml b/lib/russian/locale/activemodel.yml index 5066327..1aa830b 100644 --- a/lib/russian/locale/activemodel.yml +++ b/lib/russian/locale/activemodel.yml @@ -36,7 +36,7 @@ ru: odd: "может иметь лишь четное значение" even: "может иметь лишь нечетное значение" record_invalid: "Возникли ошибки: %{errors}" - + template: # Заголовок сообщения об ошибке header: diff --git a/lib/russian/locale/activerecord.yml b/lib/russian/locale/activerecord.yml index 8b67531..f22d9a2 100644 --- a/lib/russian/locale/activerecord.yml +++ b/lib/russian/locale/activerecord.yml @@ -13,7 +13,7 @@ ru: # The values :model, :attribute and :value are always available for interpolation # The value :count is available when applicable. Can be used for pluralization. # - # You can use ^-prefixed messages as well to get rid of human attribute name appearing + # You can use ^-prefixed messages as well to get rid of human attribute name appearing # before your message in validation messages. messages: inclusion: "имеет непредусмотренное значение" @@ -82,7 +82,7 @@ ru: # # # Overrides default messages - + # Перевод названий атрибутов моделей. Используется в Model.human_attribute_name(attribute). #attributes: # Например, @@ -92,4 +92,4 @@ ru: # # # Overrides model and default messages. - + diff --git a/lib/russian/locale/activesupport.yml b/lib/russian/locale/activesupport.yml index b67c62e..c19df57 100644 --- a/lib/russian/locale/activesupport.yml +++ b/lib/russian/locale/activesupport.yml @@ -1,16 +1,16 @@ ru: # Используется в array.to_sentence -# -# +# +# # Used in array.to_sentence. support: array: # Rails 2.2 sentence_connector: "и" skip_last_comma: true - + # Rails 2.3 words_connector: ", " two_words_connector: " и " last_word_connector: " и " - + diff --git a/lib/russian/locale/datetime.rb b/lib/russian/locale/datetime.rb index a4e62e3..b763a32 100644 --- a/lib/russian/locale/datetime.rb +++ b/lib/russian/locale/datetime.rb @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- encoding: utf-8 -*- # Context-based month name and day name switching for Russian # diff --git a/lib/russian/locale/datetime.yml b/lib/russian/locale/datetime.yml index 337c107..3fc1293 100644 --- a/lib/russian/locale/datetime.yml +++ b/lib/russian/locale/datetime.yml @@ -12,7 +12,7 @@ ru: default: "%d.%m.%Y" short: "%d %b" long: "%d %B %Y" - + # Названия дней недели -- контекстные и отдельностоящие common_day_names: [воскресенье, понедельник, вторник, среда, четверг, пятница, суббота] standalone_day_names: [Воскресенье, Понедельник, Вторник, Среда, Четверг, Пятница, Суббота] @@ -21,19 +21,19 @@ ru: # Названия месяцев -- сокращенные и полные, плюс отдельностоящие. # Не забудьте nil в начале массиве (~) - # + # # # Don't forget the nil at the beginning; there's no such thing as a 0th month common_month_names: [~, января, февраля, марта, апреля, мая, июня, июля, августа, сентября, октября, ноября, декабря] standalone_month_names: [~, Январь, Февраль, Март, Апрель, Май, Июнь, Июль, Август, Сентябрь, Октябрь, Ноябрь, Декабрь] common_abbr_month_names: [~, янв, фев, мар, апр, мая, июн, июл, авг, сен, окт, ноя, дек] standalone_abbr_month_names: [~, янв, фев, мар, апр, май, июн, июл, авг, сен, окт, ноя, дек] - + # Порядок компонентов даты для хелперов # # # Used in date_select and datime_select. - order: + order: - :day - :month - :year @@ -44,7 +44,7 @@ ru: default: "%a, %d %b %Y, %H:%M:%S %z" short: "%d %b, %H:%M" long: "%d %B %Y, %H:%M" - + # am/pm решено перевести как "утра/вечера" :) am: "утра" pm: "вечера" diff --git a/lib/russian/locale/pluralization.rb b/lib/russian/locale/pluralization.rb index 20c2a38..178cd41 100644 --- a/lib/russian/locale/pluralization.rb +++ b/lib/russian/locale/pluralization.rb @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- encoding: utf-8 -*- # Правило плюрализации для русского языка, взято из CLDR, http://unicode.org/cldr/ # @@ -19,8 +19,8 @@ :ru => { :'i18n' => { :plural => { - :rule => lambda { |n| - n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ? :many : :other + :rule => lambda { |n| + n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ? :many : :other } } } diff --git a/lib/russian/locale/transliterator.rb b/lib/russian/locale/transliterator.rb index 1ef2280..14a6266 100644 --- a/lib/russian/locale/transliterator.rb +++ b/lib/russian/locale/transliterator.rb @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- encoding: utf-8 -*- # I18n transliteration delegates to Russian::Transliteration (we're unable # to use common I18n transliteration tables with Russian) diff --git a/lib/russian/russian_rails.rb b/lib/russian/russian_rails.rb index f036547..bc317b6 100644 --- a/lib/russian/russian_rails.rb +++ b/lib/russian/russian_rails.rb @@ -4,5 +4,5 @@ end if defined?(ActionView::Helpers) - require 'action_view_ext/helpers/date_helper' + require 'action_view_ext/helpers/date_helper' end diff --git a/lib/russian/transliteration.rb b/lib/russian/transliteration.rb index 7f04205..8dbc2d0 100644 --- a/lib/russian/transliteration.rb +++ b/lib/russian/transliteration.rb @@ -1,7 +1,7 @@ -# -*- encoding: utf-8 -*- +# -*- encoding: utf-8 -*- module Russian - # Russian transliteration + # Russian transliteration # # Транслитерация для букв русского алфавита module Transliteration diff --git a/russian.gemspec b/russian.gemspec index 150cd7b..4a1ccf8 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |spec| else spec.add_dependency 'unicode', '~> 0.4.4' end - + spec.add_development_dependency 'bundler', '~> 1.3' spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec' diff --git a/spec/i18n/locale/datetime_spec.rb b/spec/i18n/locale/datetime_spec.rb index d3995b3..810403c 100644 --- a/spec/i18n/locale/datetime_spec.rb +++ b/spec/i18n/locale/datetime_spec.rb @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- encoding: utf-8 -*- require File.dirname(__FILE__) + '/../../spec_helper' diff --git a/spec/i18n/locale/pluralization_spec.rb b/spec/i18n/locale/pluralization_spec.rb index da15865..0135643 100644 --- a/spec/i18n/locale/pluralization_spec.rb +++ b/spec/i18n/locale/pluralization_spec.rb @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- encoding: utf-8 -*- require File.dirname(__FILE__) + '/../../spec_helper' @@ -10,7 +10,7 @@ end @backend = I18n.backend end - + it "should pluralize correctly" do @backend.send(:pluralize, :'ru', @hash, 1).should == 'one' @backend.send(:pluralize, :'ru', @hash, 2).should == 'few' diff --git a/spec/locale_spec.rb b/spec/locale_spec.rb index ebfd56a..1211a07 100644 --- a/spec/locale_spec.rb +++ b/spec/locale_spec.rb @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- encoding: utf-8 -*- require File.dirname(__FILE__) + '/spec_helper' @@ -6,7 +6,7 @@ before(:all) do Russian.init_i18n end - + %w( date.formats.default date.formats.short @@ -19,18 +19,18 @@ date.abbr_month_names date.standalone_abbr_month_names date.order - + time.formats.default time.formats.short time.formats.long time.am time.pm - ).each do |key| + ).each do |key| it "should define '#{key}' in datetime translations" do lookup(key).should_not be_nil end end - + it "should load pluralization rules" do lookup(:'i18n.plural.rule').should_not be_nil lookup(:'i18n.plural.rule').is_a?(Proc).should be_true @@ -40,7 +40,7 @@ lookup(:'i18n.transliterate.rule').should_not be_nil lookup(:'i18n.transliterate.rule').is_a?(Proc).should be_true end - + def lookup(*args) I18n.backend.send(:lookup, Russian.locale, *args) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b533437..4d1a1a4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- encoding: utf-8 -*- $TESTING=true $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') diff --git a/spec/transliteration_spec.rb b/spec/transliteration_spec.rb index a4f256b..4eedb5b 100644 --- a/spec/transliteration_spec.rb +++ b/spec/transliteration_spec.rb @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- encoding: utf-8 -*- require File.dirname(__FILE__) + '/spec_helper' @@ -27,12 +27,12 @@ def t(str) t("Ш").should == "SH" t("ц").should == "ts" end - + it "should properly transliterate mixed russian-english strings" do - t("Это кусок строки русских букв v peremeshku s latinizey i амперсандом (pozor!) & something").should == - "Eto kusok stroki russkih bukv v peremeshku s latinizey i ampersandom (pozor!) & something" + t("Это кусок строки русских букв v peremeshku s latinizey i амперсандом (pozor!) & something").should == + "Eto kusok stroki russkih bukv v peremeshku s latinizey i ampersandom (pozor!) & something" end - + it "should properly transliterate mixed case chars in a string" do t("НЕВЕРОЯТНОЕ УПУЩЕНИЕ").should == "NEVEROYATNOE UPUSCHENIE" t("Невероятное Упущение").should == "Neveroyatnoe Upuschenie" From 1d783f23c34053fccfd12f97c7184547fd92c906 Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 24 Oct 2013 03:05:13 +0400 Subject: [PATCH 26/65] fix gemfile --- Gemfile.lock | 4 ---- README.textile | 1 + russian.gemspec | 7 +------ 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e16d653..d8f30c8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -15,7 +15,6 @@ GEM thread_safe (~> 0.1) tzinfo (~> 0.3.37) atomic (1.1.14) - atomic (1.1.14-java) diff-lcs (1.2.4) i18n (0.6.5) minitest (4.7.5) @@ -31,13 +30,10 @@ GEM rspec-mocks (2.14.4) thread_safe (0.1.3) atomic - thread_safe (0.1.3-java) - atomic tzinfo (0.3.38) unicode (0.4.4) PLATFORMS - java ruby DEPENDENCIES diff --git a/README.textile b/README.textile index 7530b57..b1ece07 100644 --- a/README.textile +++ b/README.textile @@ -4,6 +4,7 @@ h1. rs_russian h3. Это форк с вытянутыми pull-реквестами, которые мы хотели использовать. Нравится -- пользуйтесь, не нравится -- идите на страницу оригинала: "http://github.com/yaroslav/russian/":http://github.com/yaroslav/russian/ +Jruby и Rubinius не тестируются и скорее всего не работают т.к. нам они не нужны. Поддержка русского языка для Ruby и Rails при помощи библиотеки I18n. diff --git a/russian.gemspec b/russian.gemspec index 4a1ccf8..73c3f71 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -19,12 +19,7 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.add_dependency 'i18n', '~> 0.6.0' - - if RUBY_PLATFORM =~ /java/ - spec.add_dependency 'unicode_utils', '~> 1.4.0' - else - spec.add_dependency 'unicode', '~> 0.4.4' - end + spec.add_dependency 'unicode', '~> 0.4.4' spec.add_development_dependency 'bundler', '~> 1.3' spec.add_development_dependency 'rake' From 696e0e9f636ce5685f1ac6a164735ba803eee37e Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 24 Oct 2013 03:07:27 +0400 Subject: [PATCH 27/65] 0.7.1 --- Gemfile.lock | 2 +- lib/russian/version.rb | 8 +------- russian.gemspec | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d8f30c8..4988ba9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rs_russian (0.7.0) + rs_russian (0.7.1) i18n (~> 0.6.0) unicode (~> 0.4.4) diff --git a/lib/russian/version.rb b/lib/russian/version.rb index 26cfe14..deb24d7 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,9 +1,3 @@ module Russian - module VERSION - MAJOR = 0 - MINOR = 7 - TINY = 0 - - STRING = [MAJOR, MINOR, TINY].join('.') - end + VERSION = "0.7.1" end \ No newline at end of file diff --git a/russian.gemspec b/russian.gemspec index 73c3f71..82cefec 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -5,7 +5,7 @@ require 'russian/version' Gem::Specification.new do |spec| spec.name = "rs_russian" - spec.version = Russian::VERSION::STRING + spec.version = Russian::VERSION spec.authors = ["glebtv", "Yaroslav Markin"] spec.email = ["glebtv@gmail.com", "yaroslav@markin.net"] spec.description = %q{Russian language support for Ruby and Rails} From 3a8c9ccdbda710cbe33ac58218c040a9a7ccb69b Mon Sep 17 00:00:00 2001 From: glebtv Date: Mon, 28 Oct 2013 08:38:59 +0300 Subject: [PATCH 28/65] Readme [ci skip] --- README.textile | 56 +++++++++++++++++--------------------------------- 1 file changed, 19 insertions(+), 37 deletions(-) diff --git a/README.textile b/README.textile index b1ece07..362bc2e 100644 --- a/README.textile +++ b/README.textile @@ -64,14 +64,12 @@ h1. Использование Предыдущие версии Russian форсированно выставляли локаль I18n по умолчанию в @:ru@ (Русский язык), от этого решено было отказаться: в Rails стало неудобно работать с мультиязычными приложениями, так как конструкция вида @config.i18n.default_locale = :en@ не работала. Теперь для использования русского языка в Rails по умолчанию нужно использовать строку -

-config.i18n.default_locale = :ru
+
config.i18n.default_locale = :ru
 
в @config/application.rb@. Для использования Russian отдельно от Rails можно выставить локаль I18n в русскую по умолчанию или для текущего треда, соответственно: -

-I18n.default_locale = :ru
+
I18n.default_locale = :ru
 
 I18n.locale = :ru
 
@@ -153,8 +151,7 @@ h3. Параметризация строк Пример: -

-class Person
+
class Person
   def to_param
     "#{id}-#{name.parameterize}"
   end
@@ -164,8 +161,7 @@ end
 # => #
 
 <%= link_to(@person.name, person_path(@person)) %>
-# => Дональд Кнут
-
+# => Дональд Кнут
_NB:_ Для простоты иногда проще воспользоваться методом @Russian::transliterate@ напрямую (чтобы не зависеть от текущей локали). @@ -177,73 +173,59 @@ h2. Примеры и справка по переводам (I18n) h2. Вспомогательные методы модуля Russian -

-Russian.locale
-Russian::LOCALE
-
+
Russian.locale
+Russian::LOCALE
-- возвращает локаль русского языка (@:'ru'@). -

-Russian::init_i18n
-
+
Russian::init_i18n
-- инициализация Russian. Добавление русских переводов в путь загрузки, включение модулей для плюрализации и транслитерации и перегрузка I18n. _NB:_ Выполняется автоматически при загрузке. -

-Russian::translate
-Russian::t
-
+
Russian::translate
+Russian::t
-- прокси для метода @translate@ I18n, форсирует использование русской локали. -

-Russian::localize
-Russian::l
-
+
Russian::localize
+Russian::l
-- прокси для метода @localize@ I18n, форсирует использование русской локали. -

-Russian::strftime
+
Russian::strftime
 
 Russian::strftime(Time.now)
 => "Пн, 01 сент. 2008, 11:12:43 +0300"
 Russian::strftime(Time.now, "%d %B")
 >> "01 сентября"
 Russian::strftime(Time.now, "%B")
-=> "Сентябрь"
-
+=> "Сентябрь"
-- @strftime@ с форсированием русской локали (упрощенный вариант @localize@) -

-Russian::pluralize
+
Russian::pluralize
 Russian::p
 
 Russian.p(1, "вещь", "вещи", "вещей")
 => "вещь"
-Russian.p(2, "вещь", "вещи", "вещей")
-=> "вещи"
+Russian.p(2, "%n вещь", "%n вещи", "%n вещей")
+=> "2 вещи"
 Russian.p(10, "вещь", "вещи", "вещей")
 => "вещей"
 Russian.p(3.14, "вещь", "вещи", "вещей", "вещи") # последний вариант используется для дробных величин
-=> "вещи"
-
+=> "вещи"
-- упрощенная (без использования хешей I18n) плюрализация для русского языка -

-Russian::transliterate
+
Russian::transliterate
 Russian::translit
 
 Russian.translit("рубин")
 => "rubin"
 Russian.translit("Hallo Юлику Тарханову")
-=> "Hallo Yuliku Tarhanovu"
-
+=> "Hallo Yuliku Tarhanovu"
-- транслитерация русских букв в строке. From 99437bde6896303419c8458b7535bd9284eaa138 Mon Sep 17 00:00:00 2001 From: glebtv Date: Mon, 28 Oct 2013 17:56:09 +0400 Subject: [PATCH 29/65] add rails_admin monkeypatch to fix datetime display --- Gemfile.lock | 2 +- lib/russian.rb | 4 +++ lib/russian/rails_admin_datetime.rb | 42 +++++++++++++++++++++++++++++ lib/russian/version.rb | 2 +- 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 lib/russian/rails_admin_datetime.rb diff --git a/Gemfile.lock b/Gemfile.lock index 4988ba9..fc9188f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rs_russian (0.7.1) + rs_russian (0.7.2) i18n (~> 0.6.0) unicode (~> 0.4.4) diff --git a/lib/russian.rb b/lib/russian.rb index 430d6af..8f2b773 100644 --- a/lib/russian.rb +++ b/lib/russian.rb @@ -119,3 +119,7 @@ def pluralization_variants_to_hash(n, *variants) end Russian.init_i18n + +if Object.const_defined?('RailsAdmin') + require 'rails_admin_datetime' +end diff --git a/lib/russian/rails_admin_datetime.rb b/lib/russian/rails_admin_datetime.rb new file mode 100644 index 0000000..91cf8ee --- /dev/null +++ b/lib/russian/rails_admin_datetime.rb @@ -0,0 +1,42 @@ +require 'rails_admin' +require 'rails_admin/config/fields/types/datetime' + +module RailsAdmin + module Config + module Fields + module Types + class Datetime < RailsAdmin::Config::Fields::Base + class << self + alias_method :normalize_without_russian, :normalize + def normalize(date_string, format) + unless I18n.locale == "en" + format.to_s.scan(/%[AaBbp]/) do |match| + case match + when '%B' + english = I18n.t('date.month_names', :locale => :en)[1..-1] + common_month_names = I18n.t('date.common_month_names')[1..-1] + common_month_names.each_with_index {|m, i| date_string = date_string.gsub(/#{m}/i, english[i]) } + when '%b' + english = I18n.t('date.abbr_month_names', :locale => :en)[1..-1] + common_abbr_month_names = I18n.t('date.common_abbr_month_names')[1..-1] + common_abbr_month_names.each_with_index {|m, i| date_string = date_string.gsub(/#{m}/i, english[i]) } + end + end + end + normalize_without_russian(date_string, format) + end + end + + def formatted_date_value + value = bindings[:object].new_record? && self.value.nil? && !self.default_value.nil? ? self.default_value : self.value + value.nil? ? "" : (I18n.l(value, format: '%2d').strip + ' ' + I18n.l(value, format: '%B %Y').strip) + end + + def value + bindings[:object].send(name) + end + end + end + end + end +end diff --git a/lib/russian/version.rb b/lib/russian/version.rb index deb24d7..d5b85c2 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.7.1" + VERSION = "0.7.2" end \ No newline at end of file From 17028f274d9fddefbf1861ffadfd730395e12a35 Mon Sep 17 00:00:00 2001 From: glebtv Date: Fri, 10 Jan 2014 15:26:19 +0300 Subject: [PATCH 30/65] test on 2.1.0 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 4ff5c59..2df4b7e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,5 +5,6 @@ language: ruby rvm: - 1.9.3 - 2.0.0 + - 2.1.0 #- jruby-19mode #- rbx-19mode From cfee4b46a83baac1636ee17fd60f52cdeb15209c Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 1 Mar 2014 21:29:12 +0900 Subject: [PATCH 31/65] gem "rs_russian", :github => "rs-pro/russian" --- README.textile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.textile b/README.textile index 362bc2e..74c07e7 100644 --- a/README.textile +++ b/README.textile @@ -42,6 +42,10 @@ h1. Установка
gem 'rs_russian', '~> 0.7.0'
+или + +
gem "rs_russian", :github => "rs-pro/russian", :branch => "master"
+ И установите gem в проект с помощью bundler: @bundle install@ или @bundle update@. From e9efafd6262ecf08f09f24cf515b1b062f62e847 Mon Sep 17 00:00:00 2001 From: glebtv Date: Wed, 20 Aug 2014 12:53:57 +0400 Subject: [PATCH 32/65] support i18n 0.7.0.beta1 - seems to work ok with no changes, spec passes --- .ruby-version | 2 +- Gemfile.lock | 52 +++++++++++++++++++++--------------------- lib/russian/version.rb | 2 +- russian.gemspec | 8 +++---- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/.ruby-version b/.ruby-version index 227cea2..eca07e4 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.0.0 +2.1.2 diff --git a/Gemfile.lock b/Gemfile.lock index fc9188f..7810047 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,43 +2,43 @@ PATH remote: . specs: rs_russian (0.7.2) - i18n (~> 0.6.0) + i18n (>= 0.6.0, < 0.8.0) unicode (~> 0.4.4) GEM remote: https://rubygems.org/ specs: - activesupport (4.0.0) - i18n (~> 0.6, >= 0.6.4) - minitest (~> 4.2) - multi_json (~> 1.3) + activesupport (4.1.5) + i18n (~> 0.6, >= 0.6.9) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) thread_safe (~> 0.1) - tzinfo (~> 0.3.37) - atomic (1.1.14) - diff-lcs (1.2.4) - i18n (0.6.5) - minitest (4.7.5) - multi_json (1.8.2) - rake (10.1.0) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.6) - rspec-expectations (2.14.3) + tzinfo (~> 1.1) + diff-lcs (1.2.5) + i18n (0.7.0.beta1) + json (1.8.1) + minitest (5.4.0) + rake (10.3.2) + rspec (2.99.0) + rspec-core (~> 2.99.0) + rspec-expectations (~> 2.99.0) + rspec-mocks (~> 2.99.0) + rspec-core (2.99.2) + rspec-expectations (2.99.2) diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.4) - thread_safe (0.1.3) - atomic - tzinfo (0.3.38) - unicode (0.4.4) + rspec-mocks (2.99.2) + thread_safe (0.3.4) + tzinfo (1.2.2) + thread_safe (~> 0.1) + unicode (0.4.4.1) PLATFORMS ruby DEPENDENCIES - activesupport (>= 3.0.0) - bundler (~> 1.3) + activesupport (>= 3.0.0, < 5.0.0) + bundler (~> 1.7) + i18n (~> 0.7.0.beta1) rake rs_russian! - rspec + rspec (~> 2.14) diff --git a/lib/russian/version.rb b/lib/russian/version.rb index d5b85c2..926bd8e 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.7.2" + VERSION = "0.8.0" end \ No newline at end of file diff --git a/russian.gemspec b/russian.gemspec index 82cefec..d71d74f 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -18,11 +18,11 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency 'i18n', '~> 0.6.0' + spec.add_dependency 'i18n', [">= 0.6.0", "< 0.8.0"] spec.add_dependency 'unicode', '~> 0.4.4' - spec.add_development_dependency 'bundler', '~> 1.3' + spec.add_development_dependency 'bundler', '~> 1.7' spec.add_development_dependency 'rake' - spec.add_development_dependency 'rspec' - spec.add_development_dependency 'activesupport', '>= 3.0.0' + spec.add_development_dependency 'rspec', '~> 2.14' + spec.add_development_dependency 'activesupport', ['>= 3.0.0', '< 5.0.0'] end From fbf82295198bd7c56bf01f39f1b81c2482f64b54 Mon Sep 17 00:00:00 2001 From: glebtv Date: Wed, 20 Aug 2014 12:54:48 +0400 Subject: [PATCH 33/65] gems --- Gemfile.lock | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7810047..d9cbf6f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rs_russian (0.7.2) + rs_russian (0.8.0) i18n (>= 0.6.0, < 0.8.0) unicode (~> 0.4.4) @@ -38,7 +38,6 @@ PLATFORMS DEPENDENCIES activesupport (>= 3.0.0, < 5.0.0) bundler (~> 1.7) - i18n (~> 0.7.0.beta1) rake rs_russian! rspec (~> 2.14) From 732cf28029684be5c478dd2b7297efd7c563dc87 Mon Sep 17 00:00:00 2001 From: glebtv Date: Wed, 20 Aug 2014 13:12:30 +0400 Subject: [PATCH 34/65] gems --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index d9cbf6f..9d67632 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -15,7 +15,7 @@ GEM thread_safe (~> 0.1) tzinfo (~> 1.1) diff-lcs (1.2.5) - i18n (0.7.0.beta1) + i18n (0.6.11) json (1.8.1) minitest (5.4.0) rake (10.3.2) From 0b73fba38c894404ef98ddbef6c980f88f84c41a Mon Sep 17 00:00:00 2001 From: glebtv Date: Mon, 22 Sep 2014 14:25:03 +0400 Subject: [PATCH 35/65] gems --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9d67632..d33efc1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,7 +8,7 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (4.1.5) + activesupport (4.1.6) i18n (~> 0.6, >= 0.6.9) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) @@ -17,7 +17,7 @@ GEM diff-lcs (1.2.5) i18n (0.6.11) json (1.8.1) - minitest (5.4.0) + minitest (5.4.1) rake (10.3.2) rspec (2.99.0) rspec-core (~> 2.99.0) From a798633a92b6da438caf3430ce03e19d92a751b5 Mon Sep 17 00:00:00 2001 From: glebtv Date: Mon, 22 Sep 2014 14:46:47 +0400 Subject: [PATCH 36/65] fix gems --- Gemfile.lock | 2 +- russian.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d33efc1..eaefc6f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,6 +2,7 @@ PATH remote: . specs: rs_russian (0.8.0) + activesupport (>= 3.0.0, < 5.0.0) i18n (>= 0.6.0, < 0.8.0) unicode (~> 0.4.4) @@ -36,7 +37,6 @@ PLATFORMS ruby DEPENDENCIES - activesupport (>= 3.0.0, < 5.0.0) bundler (~> 1.7) rake rs_russian! diff --git a/russian.gemspec b/russian.gemspec index d71d74f..7a9a4ab 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -20,9 +20,9 @@ Gem::Specification.new do |spec| spec.add_dependency 'i18n', [">= 0.6.0", "< 0.8.0"] spec.add_dependency 'unicode', '~> 0.4.4' + spec.add_dependency 'activesupport', ['>= 3.0.0', '< 5.0.0'] spec.add_development_dependency 'bundler', '~> 1.7' spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec', '~> 2.14' - spec.add_development_dependency 'activesupport', ['>= 3.0.0', '< 5.0.0'] end From 50367a63eeb9c5382623cde2614f75d630add600 Mon Sep 17 00:00:00 2001 From: Gleb Date: Tue, 30 Dec 2014 13:38:52 +0300 Subject: [PATCH 37/65] Fix json errors --- .../active_model_ext/custom_error_message.rb | 84 +++++++------------ 1 file changed, 31 insertions(+), 53 deletions(-) diff --git a/lib/russian/active_model_ext/custom_error_message.rb b/lib/russian/active_model_ext/custom_error_message.rb index 02c7cf7..16a53bf 100644 --- a/lib/russian/active_model_ext/custom_error_message.rb +++ b/lib/russian/active_model_ext/custom_error_message.rb @@ -8,63 +8,41 @@ class Errors # Non-base messages are prefixed with the attribute name as usual UNLESS they begin with '^' # in which case the attribute name is omitted. # E.g. validates_acceptance_of :accepted_terms, :message => '^Please accept the terms of service' - # - # Переопределяет метод ActiveModel::Errors.full_messages. Сообщения об ошибках для атрибутов - # теперь не имеют префикса с названием атрибута если в сообщении об ошибке первым символом указан "^". - # - # Так, например, - # - # validates_acceptance_of :accepted_terms, :message => 'нужно принять соглашение' - # - # даст сообщение - # - # Accepted terms нужно принять соглашение - # - # однако, - # - # validates_acceptance_of :accepted_terms, :message => '^Нужно принять соглашение' - # - # даст сообщение - # - # Нужно принять соглашение - # - # - # Returns all the full error messages in an array. - # - # class Company - # validates_presence_of :name, :address, :email - # validates_length_of :name, :in => 5..30 - # end - # - # company = Company.create(:address => '123 First St.') - # company.errors.full_messages # => - # ["Name is too short (minimum is 5 characters)", "Name can't be blank", "Address can't be blank"] - def full_messages - full_messages = [] - - each do |attribute, messages| - messages = Array.wrap(messages) - next if messages.empty? - - if attribute == :base - messages.each {|m| full_messages << m } - else - attr_name = attribute.to_s.gsub('.', '_').humanize - attr_name = @base.class.human_attribute_name(attribute, :default => attr_name) - options = { :attribute => attr_name, :default => "%{attribute} %{message}" } - - messages.each do |m| - if m =~ /^\^/ - full_messages << m[1..-1] + + def full_message(attribute, message) + return message if attribute == :base + attr_name = attribute.to_s.tr('.', '_').humanize + attr_name = @base.class.human_attribute_name(attribute, default: attr_name) + + if message =~ /^\^/ + message[1..-1] + else + I18n.t(:"errors.format", { + default: "%{attribute} %{message}", + attribute: attr_name, + message: message + }) + end + end + + def to_hash(full_messages = false) + if full_messages + self.messages.each_with_object({}) do |(attribute, array), messages| + messages[attribute] = array.map { |message| full_message(attribute, message) } + end + else + self.messages.dup.map do |k, vs| + m = vs.map do |v| + if v =~ /^\^/ + v[1..-1] else - full_messages << I18n.t(:"errors.format", options.merge(:message => m)) + v end end - end + {k => m} + end.reduce(:merge) end - - full_messages end end end -end # if defined? +end From 3e58aa3c687d097268ce0a8412b21af7d59df6fa Mon Sep 17 00:00:00 2001 From: glebtv Date: Tue, 30 Dec 2014 13:39:26 +0300 Subject: [PATCH 38/65] bump version --- .ruby-version | 2 +- Gemfile.lock | 14 +++++++------- lib/russian/version.rb | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.ruby-version b/.ruby-version index eca07e4..cd57a8b 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.1.2 +2.1.5 diff --git a/Gemfile.lock b/Gemfile.lock index eaefc6f..3e9d9f6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,17 +9,17 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (4.1.6) - i18n (~> 0.6, >= 0.6.9) + activesupport (4.2.0) + i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.1) + thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) diff-lcs (1.2.5) - i18n (0.6.11) + i18n (0.7.0) json (1.8.1) - minitest (5.4.1) - rake (10.3.2) + minitest (5.5.0) + rake (10.4.2) rspec (2.99.0) rspec-core (~> 2.99.0) rspec-expectations (~> 2.99.0) @@ -31,7 +31,7 @@ GEM thread_safe (0.3.4) tzinfo (1.2.2) thread_safe (~> 0.1) - unicode (0.4.4.1) + unicode (0.4.4.2) PLATFORMS ruby diff --git a/lib/russian/version.rb b/lib/russian/version.rb index 926bd8e..5bb7241 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.8.0" + VERSION = "0.8.1" end \ No newline at end of file From 5ba166e5b5f95192281fd9d1e6a82c6333b13704 Mon Sep 17 00:00:00 2001 From: glebtv Date: Tue, 30 Dec 2014 13:39:36 +0300 Subject: [PATCH 39/65] gem upd --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3e9d9f6..a9ad5ad 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rs_russian (0.8.0) + rs_russian (0.8.1) activesupport (>= 3.0.0, < 5.0.0) i18n (>= 0.6.0, < 0.8.0) unicode (~> 0.4.4) From a6243bbbeef6cb9e4a64a389ffaa0a5ee1749cd6 Mon Sep 17 00:00:00 2001 From: glebtv Date: Tue, 17 Mar 2015 10:34:07 +0300 Subject: [PATCH 40/65] gem update --- Gemfile | 1 + Gemfile.lock | 10 +++++----- spec/locale_spec.rb | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index b4e2a20..f68a903 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,4 @@ source "https://rubygems.org" gemspec + diff --git a/Gemfile.lock b/Gemfile.lock index a9ad5ad..e80d97d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,7 +9,7 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (4.2.0) + activesupport (4.2.1.rc4) i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) @@ -17,8 +17,8 @@ GEM tzinfo (~> 1.1) diff-lcs (1.2.5) i18n (0.7.0) - json (1.8.1) - minitest (5.5.0) + json (1.8.2) + minitest (5.5.1) rake (10.4.2) rspec (2.99.0) rspec-core (~> 2.99.0) @@ -27,8 +27,8 @@ GEM rspec-core (2.99.2) rspec-expectations (2.99.2) diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.99.2) - thread_safe (0.3.4) + rspec-mocks (2.99.3) + thread_safe (0.3.5) tzinfo (1.2.2) thread_safe (~> 0.1) unicode (0.4.4.2) diff --git a/spec/locale_spec.rb b/spec/locale_spec.rb index 1211a07..3f3726e 100644 --- a/spec/locale_spec.rb +++ b/spec/locale_spec.rb @@ -33,12 +33,12 @@ it "should load pluralization rules" do lookup(:'i18n.plural.rule').should_not be_nil - lookup(:'i18n.plural.rule').is_a?(Proc).should be_true + lookup(:'i18n.plural.rule').is_a?(Proc).should be true end it "should load transliteration rule" do lookup(:'i18n.transliterate.rule').should_not be_nil - lookup(:'i18n.transliterate.rule').is_a?(Proc).should be_true + lookup(:'i18n.transliterate.rule').is_a?(Proc).should be true end def lookup(*args) From c536c88ac4dc66d5ba01600102be99d4d5aea112 Mon Sep 17 00:00:00 2001 From: Sergey Malykh Date: Mon, 27 Apr 2015 14:57:06 +0300 Subject: [PATCH 41/65] fix rails_admin datetime --- lib/russian/rails_admin_datetime.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 lib/russian/rails_admin_datetime.rb diff --git a/lib/russian/rails_admin_datetime.rb b/lib/russian/rails_admin_datetime.rb old mode 100644 new mode 100755 index 91cf8ee..bc4d5fe --- a/lib/russian/rails_admin_datetime.rb +++ b/lib/russian/rails_admin_datetime.rb @@ -9,7 +9,7 @@ class Datetime < RailsAdmin::Config::Fields::Base class << self alias_method :normalize_without_russian, :normalize def normalize(date_string, format) - unless I18n.locale == "en" + unless I18n.locale == :en format.to_s.scan(/%[AaBbp]/) do |match| case match when '%B' From 0b9e7a68d21d9b296f3121ae5952ea3d042fef86 Mon Sep 17 00:00:00 2001 From: glebtv Date: Tue, 5 May 2015 14:59:02 +0300 Subject: [PATCH 42/65] bump version --- lib/russian/version.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/russian/version.rb b/lib/russian/version.rb index 5bb7241..842b8c7 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.8.1" -end \ No newline at end of file + VERSION = "0.9.0" +end From 05734459916dd6310356fb711a4beb3ab54d2f81 Mon Sep 17 00:00:00 2001 From: glebtv Date: Tue, 5 May 2015 14:59:37 +0300 Subject: [PATCH 43/65] gems --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e80d97d..1b4a7dc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rs_russian (0.8.1) + rs_russian (0.9.0) activesupport (>= 3.0.0, < 5.0.0) i18n (>= 0.6.0, < 0.8.0) unicode (~> 0.4.4) @@ -9,7 +9,7 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (4.2.1.rc4) + activesupport (4.2.1) i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) @@ -18,7 +18,7 @@ GEM diff-lcs (1.2.5) i18n (0.7.0) json (1.8.2) - minitest (5.5.1) + minitest (5.6.1) rake (10.4.2) rspec (2.99.0) rspec-core (~> 2.99.0) From 12ef9c68412a502b20b870b2bcb7fff859e201c7 Mon Sep 17 00:00:00 2001 From: glebtv Date: Tue, 24 Nov 2015 17:16:02 +0300 Subject: [PATCH 44/65] drop rails_admin hack as its no longer needed --- Gemfile.lock | 13 +++++---- lib/russian.rb | 3 --- lib/russian/rails_admin_datetime.rb | 42 ----------------------------- lib/russian/version.rb | 2 +- 4 files changed, 9 insertions(+), 51 deletions(-) delete mode 100755 lib/russian/rails_admin_datetime.rb diff --git a/Gemfile.lock b/Gemfile.lock index 1b4a7dc..016decd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rs_russian (0.9.0) + rs_russian (0.9.1) activesupport (>= 3.0.0, < 5.0.0) i18n (>= 0.6.0, < 0.8.0) unicode (~> 0.4.4) @@ -9,7 +9,7 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (4.2.1) + activesupport (4.2.5) i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) @@ -17,8 +17,8 @@ GEM tzinfo (~> 1.1) diff-lcs (1.2.5) i18n (0.7.0) - json (1.8.2) - minitest (5.6.1) + json (1.8.3) + minitest (5.8.3) rake (10.4.2) rspec (2.99.0) rspec-core (~> 2.99.0) @@ -27,7 +27,7 @@ GEM rspec-core (2.99.2) rspec-expectations (2.99.2) diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.99.3) + rspec-mocks (2.99.4) thread_safe (0.3.5) tzinfo (1.2.2) thread_safe (~> 0.1) @@ -41,3 +41,6 @@ DEPENDENCIES rake rs_russian! rspec (~> 2.14) + +BUNDLED WITH + 1.10.6 diff --git a/lib/russian.rb b/lib/russian.rb index 8f2b773..5b4a4f8 100644 --- a/lib/russian.rb +++ b/lib/russian.rb @@ -120,6 +120,3 @@ def pluralization_variants_to_hash(n, *variants) Russian.init_i18n -if Object.const_defined?('RailsAdmin') - require 'rails_admin_datetime' -end diff --git a/lib/russian/rails_admin_datetime.rb b/lib/russian/rails_admin_datetime.rb deleted file mode 100755 index bc4d5fe..0000000 --- a/lib/russian/rails_admin_datetime.rb +++ /dev/null @@ -1,42 +0,0 @@ -require 'rails_admin' -require 'rails_admin/config/fields/types/datetime' - -module RailsAdmin - module Config - module Fields - module Types - class Datetime < RailsAdmin::Config::Fields::Base - class << self - alias_method :normalize_without_russian, :normalize - def normalize(date_string, format) - unless I18n.locale == :en - format.to_s.scan(/%[AaBbp]/) do |match| - case match - when '%B' - english = I18n.t('date.month_names', :locale => :en)[1..-1] - common_month_names = I18n.t('date.common_month_names')[1..-1] - common_month_names.each_with_index {|m, i| date_string = date_string.gsub(/#{m}/i, english[i]) } - when '%b' - english = I18n.t('date.abbr_month_names', :locale => :en)[1..-1] - common_abbr_month_names = I18n.t('date.common_abbr_month_names')[1..-1] - common_abbr_month_names.each_with_index {|m, i| date_string = date_string.gsub(/#{m}/i, english[i]) } - end - end - end - normalize_without_russian(date_string, format) - end - end - - def formatted_date_value - value = bindings[:object].new_record? && self.value.nil? && !self.default_value.nil? ? self.default_value : self.value - value.nil? ? "" : (I18n.l(value, format: '%2d').strip + ' ' + I18n.l(value, format: '%B %Y').strip) - end - - def value - bindings[:object].send(name) - end - end - end - end - end -end diff --git a/lib/russian/version.rb b/lib/russian/version.rb index 842b8c7..8c4ded0 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.9.0" + VERSION = "0.9.1" end From 846669812bdbb0ee044534a4df7f205f42d63cd8 Mon Sep 17 00:00:00 2001 From: glebtv Date: Tue, 24 Nov 2015 17:45:56 +0300 Subject: [PATCH 45/65] better fix for rails_admin --- Gemfile.lock | 2 +- lib/russian.rb | 6 ++++ lib/russian/locale/datetime.rb | 8 +++--- lib/russian/rails_admin_datetime.rb | 43 +++++++++++++++++++++++++++++ lib/russian/version.rb | 2 +- 5 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 lib/russian/rails_admin_datetime.rb diff --git a/Gemfile.lock b/Gemfile.lock index 016decd..8e270e7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rs_russian (0.9.1) + rs_russian (0.9.2) activesupport (>= 3.0.0, < 5.0.0) i18n (>= 0.6.0, < 0.8.0) unicode (~> 0.4.4) diff --git a/lib/russian.rb b/lib/russian.rb index 5b4a4f8..3f2511a 100644 --- a/lib/russian.rb +++ b/lib/russian.rb @@ -18,6 +18,8 @@ module Russian autoload :Transliteration, 'transliteration' + cattr_accessor :force_standalone + # Russian locale LOCALE = :'ru' @@ -120,3 +122,7 @@ def pluralization_variants_to_hash(n, *variants) Russian.init_i18n +if Object.const_defined?('RailsAdmin') + require 'rails_admin_datetime' +end + diff --git a/lib/russian/locale/datetime.rb b/lib/russian/locale/datetime.rb index b763a32..3f2c6cb 100644 --- a/lib/russian/locale/datetime.rb +++ b/lib/russian/locale/datetime.rb @@ -7,28 +7,28 @@ :ru => { :date => { :abbr_day_names => lambda { |key, options| - if options[:format] && options[:format] =~ Russian::LOCALIZE_STANDALONE_ABBR_DAY_NAMES_MATCH + if options[:format] && options[:format] =~ Russian::LOCALIZE_STANDALONE_ABBR_DAY_NAMES_MATCH && !Russian.force_standalone :'date.common_abbr_day_names' else :'date.standalone_abbr_day_names' end }, :day_names => lambda { |key, options| - if options[:format] && options[:format] =~ Russian::LOCALIZE_STANDALONE_DAY_NAMES_MATCH + if options[:format] && options[:format] =~ Russian::LOCALIZE_STANDALONE_DAY_NAMES_MATCH && !Russian.force_standalone :'date.standalone_day_names' else :'date.common_day_names' end }, :abbr_month_names => lambda { |key, options| - if options[:format] && options[:format] =~ Russian::LOCALIZE_ABBR_MONTH_NAMES_MATCH + if options[:format] && options[:format] =~ Russian::LOCALIZE_ABBR_MONTH_NAMES_MATCH && !Russian.force_standalone :'date.common_abbr_month_names' else :'date.standalone_abbr_month_names' end }, :month_names => lambda { |key, options| - if options[:format] && options[:format] =~ Russian::LOCALIZE_MONTH_NAMES_MATCH + if options[:format] && options[:format] =~ Russian::LOCALIZE_MONTH_NAMES_MATCH && !Russian.force_standalone :'date.common_month_names' else :'date.standalone_month_names' diff --git a/lib/russian/rails_admin_datetime.rb b/lib/russian/rails_admin_datetime.rb new file mode 100644 index 0000000..b775aaa --- /dev/null +++ b/lib/russian/rails_admin_datetime.rb @@ -0,0 +1,43 @@ +require 'rails_admin/config/fields/types/datetime' + +module RailsAdmin + module Config + module Fields + module Types + class Datetime < RailsAdmin::Config::Fields::Base + def parse_input(params) + str = params[name] + unless I18n.locale == :en + strftime_format.to_s.scan(/%[AaBbp]/) do |match| + case match + when '%B' + english = I18n.t('date.month_names', :locale => :en)[1..-1] + common_month_names = I18n.t('date.common_month_names')[1..-1] + common_month_names.each_with_index {|m, i| str = str.gsub(/#{m}/i, english[i]) } + when '%b' + english = I18n.t('date.abbr_month_names', :locale => :en)[1..-1] + common_abbr_month_names = I18n.t('date.common_abbr_month_names')[1..-1] + common_abbr_month_names.each_with_index {|m, i| str = str.gsub(/#{m}/i, english[i]) } + end + end + end + params[name] = parser.parse_string(str) if params[name] + end + + register_instance_option :formatted_value do + ret = if time = (value || default_value) + opt = {format: strftime_format, standalone: true} + Russian.force_standalone = true + r = ::I18n.l(time, opt) + Russian.force_standalone = false + r + else + ''.html_safe + end + ret + end + end + end + end + end +end diff --git a/lib/russian/version.rb b/lib/russian/version.rb index 8c4ded0..4de7b3f 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.9.1" + VERSION = "0.9.2" end From df3a4baec58ec566d96bbf67b8ee9f575a1a91c3 Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 3 Dec 2015 14:32:12 +0300 Subject: [PATCH 46/65] fix blank case --- Gemfile.lock | 2 +- lib/russian/rails_admin_datetime.rb | 4 ++-- lib/russian/version.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8e270e7..294b519 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rs_russian (0.9.2) + rs_russian (0.9.3) activesupport (>= 3.0.0, < 5.0.0) i18n (>= 0.6.0, < 0.8.0) unicode (~> 0.4.4) diff --git a/lib/russian/rails_admin_datetime.rb b/lib/russian/rails_admin_datetime.rb index b775aaa..ddff62b 100644 --- a/lib/russian/rails_admin_datetime.rb +++ b/lib/russian/rails_admin_datetime.rb @@ -13,11 +13,11 @@ def parse_input(params) when '%B' english = I18n.t('date.month_names', :locale => :en)[1..-1] common_month_names = I18n.t('date.common_month_names')[1..-1] - common_month_names.each_with_index {|m, i| str = str.gsub(/#{m}/i, english[i]) } + common_month_names.each_with_index {|m, i| str = str.gsub(/#{m}/i, english[i]) } unless str.blank? when '%b' english = I18n.t('date.abbr_month_names', :locale => :en)[1..-1] common_abbr_month_names = I18n.t('date.common_abbr_month_names')[1..-1] - common_abbr_month_names.each_with_index {|m, i| str = str.gsub(/#{m}/i, english[i]) } + common_abbr_month_names.each_with_index {|m, i| str = str.gsub(/#{m}/i, english[i]) } unless str.blank? end end end diff --git a/lib/russian/version.rb b/lib/russian/version.rb index 4de7b3f..ded47db 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.9.2" + VERSION = "0.9.3" end From 067b4e68171cf11b47a05c14cedbea1d63f4fe44 Mon Sep 17 00:00:00 2001 From: Gleb Tv Date: Fri, 29 Apr 2016 12:44:27 +0300 Subject: [PATCH 47/65] dont mess other than ru --- Gemfile.lock | 10 +++++----- lib/russian/rails_admin_datetime.rb | 2 +- lib/russian/version.rb | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 294b519..c3d468c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rs_russian (0.9.3) + rs_russian (0.9.4) activesupport (>= 3.0.0, < 5.0.0) i18n (>= 0.6.0, < 0.8.0) unicode (~> 0.4.4) @@ -9,7 +9,7 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (4.2.5) + activesupport (4.2.6) i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) @@ -18,8 +18,8 @@ GEM diff-lcs (1.2.5) i18n (0.7.0) json (1.8.3) - minitest (5.8.3) - rake (10.4.2) + minitest (5.8.4) + rake (11.1.2) rspec (2.99.0) rspec-core (~> 2.99.0) rspec-expectations (~> 2.99.0) @@ -43,4 +43,4 @@ DEPENDENCIES rspec (~> 2.14) BUNDLED WITH - 1.10.6 + 1.11.2 diff --git a/lib/russian/rails_admin_datetime.rb b/lib/russian/rails_admin_datetime.rb index ddff62b..c63ae96 100644 --- a/lib/russian/rails_admin_datetime.rb +++ b/lib/russian/rails_admin_datetime.rb @@ -7,7 +7,7 @@ module Types class Datetime < RailsAdmin::Config::Fields::Base def parse_input(params) str = params[name] - unless I18n.locale == :en + if I18n.locale == :ru strftime_format.to_s.scan(/%[AaBbp]/) do |match| case match when '%B' diff --git a/lib/russian/version.rb b/lib/russian/version.rb index ded47db..9c21bf6 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.9.3" + VERSION = "0.9.4" end From 45cf744cb22b2ec9e9114d451bada1af00a7966c Mon Sep 17 00:00:00 2001 From: glebtv Date: Mon, 4 Jul 2016 23:26:01 +0300 Subject: [PATCH 48/65] raise rails version --- Gemfile.lock | 19 +++++++++---------- lib/russian.rb | 2 ++ lib/russian/version.rb | 2 +- russian.gemspec | 4 ++-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index c3d468c..1d71b7c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,25 +1,24 @@ PATH remote: . specs: - rs_russian (0.9.4) - activesupport (>= 3.0.0, < 5.0.0) + rs_russian (0.9.5) + activesupport (>= 3.0.0, < 5.1.0) i18n (>= 0.6.0, < 0.8.0) unicode (~> 0.4.4) GEM remote: https://rubygems.org/ specs: - activesupport (4.2.6) + activesupport (5.0.0) + concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) + concurrent-ruby (1.0.2) diff-lcs (1.2.5) i18n (0.7.0) - json (1.8.3) - minitest (5.8.4) - rake (11.1.2) + minitest (5.9.0) + rake (11.2.2) rspec (2.99.0) rspec-core (~> 2.99.0) rspec-expectations (~> 2.99.0) @@ -37,10 +36,10 @@ PLATFORMS ruby DEPENDENCIES - bundler (~> 1.7) + bundler (~> 1.12) rake rs_russian! rspec (~> 2.14) BUNDLED WITH - 1.11.2 + 1.12.5 diff --git a/lib/russian.rb b/lib/russian.rb index 3f2511a..f647d17 100644 --- a/lib/russian.rb +++ b/lib/russian.rb @@ -13,6 +13,8 @@ require 'unicode' end +require 'active_support/core_ext/module/attribute_accessors' + module Russian extend self diff --git a/lib/russian/version.rb b/lib/russian/version.rb index 9c21bf6..ca6a1f0 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.9.4" + VERSION = "0.9.5" end diff --git a/russian.gemspec b/russian.gemspec index 7a9a4ab..ebff751 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -20,9 +20,9 @@ Gem::Specification.new do |spec| spec.add_dependency 'i18n', [">= 0.6.0", "< 0.8.0"] spec.add_dependency 'unicode', '~> 0.4.4' - spec.add_dependency 'activesupport', ['>= 3.0.0', '< 5.0.0'] + spec.add_dependency 'activesupport', ['>= 3.0.0', '< 5.1.0'] - spec.add_development_dependency 'bundler', '~> 1.7' + spec.add_development_dependency 'bundler', '~> 1.12' spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec', '~> 2.14' end From d6c71f4d7e5c346cd427573c4ec1d5ba2c11d6b5 Mon Sep 17 00:00:00 2001 From: glebtv Date: Tue, 21 Mar 2017 15:58:44 +0300 Subject: [PATCH 49/65] dependency update --- .travis.yml | 6 +----- Gemfile.lock | 22 +++++++++++----------- russian.gemspec | 6 +++--- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2df4b7e..e4743db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,4 @@ notifications: language: ruby rvm: - - 1.9.3 - - 2.0.0 - - 2.1.0 - #- jruby-19mode - #- rbx-19mode + - 2.3.3 diff --git a/Gemfile.lock b/Gemfile.lock index 1d71b7c..ec810c7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,23 +2,23 @@ PATH remote: . specs: rs_russian (0.9.5) - activesupport (>= 3.0.0, < 5.1.0) - i18n (>= 0.6.0, < 0.8.0) + activesupport (>= 3.0.0, < 6.0.0) + i18n (~> 0.8.0) unicode (~> 0.4.4) GEM remote: https://rubygems.org/ specs: - activesupport (5.0.0) + activesupport (5.0.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) tzinfo (~> 1.1) - concurrent-ruby (1.0.2) - diff-lcs (1.2.5) - i18n (0.7.0) - minitest (5.9.0) - rake (11.2.2) + concurrent-ruby (1.0.5) + diff-lcs (1.3) + i18n (0.8.1) + minitest (5.10.1) + rake (12.0.0) rspec (2.99.0) rspec-core (~> 2.99.0) rspec-expectations (~> 2.99.0) @@ -27,7 +27,7 @@ GEM rspec-expectations (2.99.2) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.99.4) - thread_safe (0.3.5) + thread_safe (0.3.6) tzinfo (1.2.2) thread_safe (~> 0.1) unicode (0.4.4.2) @@ -36,10 +36,10 @@ PLATFORMS ruby DEPENDENCIES - bundler (~> 1.12) + bundler (~> 1.14) rake rs_russian! rspec (~> 2.14) BUNDLED WITH - 1.12.5 + 1.14.6 diff --git a/russian.gemspec b/russian.gemspec index ebff751..5dfecc1 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -18,11 +18,11 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency 'i18n', [">= 0.6.0", "< 0.8.0"] + spec.add_dependency 'i18n', '~> 0.8.0' spec.add_dependency 'unicode', '~> 0.4.4' - spec.add_dependency 'activesupport', ['>= 3.0.0', '< 5.1.0'] + spec.add_dependency 'activesupport', ['>= 3.0.0', '< 6.0.0'] - spec.add_development_dependency 'bundler', '~> 1.12' + spec.add_development_dependency 'bundler', '~> 1.14' spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec', '~> 2.14' end From 10a477ddfe1b3512e4bda000c8d60c026e222a9d Mon Sep 17 00:00:00 2001 From: glebtv Date: Tue, 21 Mar 2017 16:00:39 +0300 Subject: [PATCH 50/65] bump version --- Gemfile.lock | 2 +- lib/russian/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ec810c7..a69cafa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rs_russian (0.9.5) + rs_russian (0.10.0) activesupport (>= 3.0.0, < 6.0.0) i18n (~> 0.8.0) unicode (~> 0.4.4) diff --git a/lib/russian/version.rb b/lib/russian/version.rb index ca6a1f0..08fc339 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.9.5" + VERSION = "0.10.0" end From 1e65871d72ec3ea7ae23db08806cd46b45f287ef Mon Sep 17 00:00:00 2001 From: glebtv Date: Tue, 21 Mar 2017 16:03:44 +0300 Subject: [PATCH 51/65] use lower ver of rake --- Gemfile.lock | 4 ++-- russian.gemspec | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a69cafa..1076888 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,7 +18,7 @@ GEM diff-lcs (1.3) i18n (0.8.1) minitest (5.10.1) - rake (12.0.0) + rake (10.5.0) rspec (2.99.0) rspec-core (~> 2.99.0) rspec-expectations (~> 2.99.0) @@ -37,7 +37,7 @@ PLATFORMS DEPENDENCIES bundler (~> 1.14) - rake + rake (< 11.0) rs_russian! rspec (~> 2.14) diff --git a/russian.gemspec b/russian.gemspec index 5dfecc1..24117ea 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -23,6 +23,6 @@ Gem::Specification.new do |spec| spec.add_dependency 'activesupport', ['>= 3.0.0', '< 6.0.0'] spec.add_development_dependency 'bundler', '~> 1.14' - spec.add_development_dependency 'rake' + spec.add_development_dependency 'rake', '< 11.0' spec.add_development_dependency 'rspec', '~> 2.14' end From f5be30f1890571830cc824052b828e21d5ef50ca Mon Sep 17 00:00:00 2001 From: glebtv Date: Wed, 18 Oct 2017 19:30:14 +0300 Subject: [PATCH 52/65] fix for old rails --- Gemfile.lock | 14 +++++++------- lib/russian.rb | 6 +++++- lib/russian/version.rb | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1076888..1945140 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rs_russian (0.10.0) + rs_russian (0.10.1) activesupport (>= 3.0.0, < 6.0.0) i18n (~> 0.8.0) unicode (~> 0.4.4) @@ -9,15 +9,15 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (5.0.2) + activesupport (5.1.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) tzinfo (~> 1.1) concurrent-ruby (1.0.5) diff-lcs (1.3) - i18n (0.8.1) - minitest (5.10.1) + i18n (0.8.6) + minitest (5.10.3) rake (10.5.0) rspec (2.99.0) rspec-core (~> 2.99.0) @@ -28,9 +28,9 @@ GEM diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.99.4) thread_safe (0.3.6) - tzinfo (1.2.2) + tzinfo (1.2.3) thread_safe (~> 0.1) - unicode (0.4.4.2) + unicode (0.4.4.4) PLATFORMS ruby @@ -42,4 +42,4 @@ DEPENDENCIES rspec (~> 2.14) BUNDLED WITH - 1.14.6 + 1.16.0.pre.3 diff --git a/lib/russian.rb b/lib/russian.rb index f647d17..da172d5 100644 --- a/lib/russian.rb +++ b/lib/russian.rb @@ -20,7 +20,11 @@ module Russian autoload :Transliteration, 'transliteration' - cattr_accessor :force_standalone + if respond_to?(:cattr_accessor) + cattr_accessor :force_standalone + else + mattr_accessor :force_standalone + end # Russian locale LOCALE = :'ru' diff --git a/lib/russian/version.rb b/lib/russian/version.rb index 08fc339..8f43440 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.10.0" + VERSION = "0.10.1" end From 2dec736b89bfe1a526d7ce199bb34cf3ab8acbb1 Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 14 Dec 2017 22:08:42 +0300 Subject: [PATCH 53/65] fix date filters --- lib/russian/rails_admin_datetime.rb | 46 +++++++++++++++++------------ 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/lib/russian/rails_admin_datetime.rb b/lib/russian/rails_admin_datetime.rb index c63ae96..4184732 100644 --- a/lib/russian/rails_admin_datetime.rb +++ b/lib/russian/rails_admin_datetime.rb @@ -1,3 +1,30 @@ +require 'rails_admin/support/datetime' + +class RailsAdmin::Support::Datetime + class << self + alias_method :delocalize_without_russian, :delocalize + def delocalize(date_string, format) + ret = date_string + if I18n.locale == :ru + format.to_s.scan(/%[AaBbp]/) do |match| + case match + when '%B' + english = I18n.t('date.month_names', :locale => :en)[1..-1] + common_month_names = I18n.t('date.common_month_names')[1..-1] + common_month_names.each_with_index {|m, i| ret = ret.gsub(/#{m}/i, english[i]) } unless ret.blank? + when '%b' + english = I18n.t('date.abbr_month_names', :locale => :en)[1..-1] + common_abbr_month_names = I18n.t('date.common_abbr_month_names')[1..-1] + common_abbr_month_names.each_with_index {|m, i| ret = ret.gsub(/#{m}/i, english[i]) } unless ret.blank? + end + end + end + ret = delocalize_without_russian(ret, format) + ret + end + end +end + require 'rails_admin/config/fields/types/datetime' module RailsAdmin @@ -5,25 +32,6 @@ module Config module Fields module Types class Datetime < RailsAdmin::Config::Fields::Base - def parse_input(params) - str = params[name] - if I18n.locale == :ru - strftime_format.to_s.scan(/%[AaBbp]/) do |match| - case match - when '%B' - english = I18n.t('date.month_names', :locale => :en)[1..-1] - common_month_names = I18n.t('date.common_month_names')[1..-1] - common_month_names.each_with_index {|m, i| str = str.gsub(/#{m}/i, english[i]) } unless str.blank? - when '%b' - english = I18n.t('date.abbr_month_names', :locale => :en)[1..-1] - common_abbr_month_names = I18n.t('date.common_abbr_month_names')[1..-1] - common_abbr_month_names.each_with_index {|m, i| str = str.gsub(/#{m}/i, english[i]) } unless str.blank? - end - end - end - params[name] = parser.parse_string(str) if params[name] - end - register_instance_option :formatted_value do ret = if time = (value || default_value) opt = {format: strftime_format, standalone: true} From 0144a54095dd06bea81de421811bc0706457d216 Mon Sep 17 00:00:00 2001 From: glebtv Date: Thu, 14 Dec 2017 22:09:14 +0300 Subject: [PATCH 54/65] bump --- Gemfile.lock | 6 +++--- lib/russian/version.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1945140..f46286a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rs_russian (0.10.1) + rs_russian (0.10.2) activesupport (>= 3.0.0, < 6.0.0) i18n (~> 0.8.0) unicode (~> 0.4.4) @@ -28,7 +28,7 @@ GEM diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.99.4) thread_safe (0.3.6) - tzinfo (1.2.3) + tzinfo (1.2.4) thread_safe (~> 0.1) unicode (0.4.4.4) @@ -42,4 +42,4 @@ DEPENDENCIES rspec (~> 2.14) BUNDLED WITH - 1.16.0.pre.3 + 1.16.0 diff --git a/lib/russian/version.rb b/lib/russian/version.rb index 8f43440..60dd4da 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.10.1" + VERSION = "0.10.2" end From 3a6e21e6bc554608eccb55107c134086aa56c783 Mon Sep 17 00:00:00 2001 From: Gleb Tv Date: Wed, 21 Mar 2018 11:00:11 +0300 Subject: [PATCH 55/65] update i18n to 0.9 --- Gemfile.lock | 15 ++++++++------- lib/russian/version.rb | 2 +- russian.gemspec | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f46286a..9bd794f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,23 +1,24 @@ PATH remote: . specs: - rs_russian (0.10.2) + rs_russian (0.11.0) activesupport (>= 3.0.0, < 6.0.0) - i18n (~> 0.8.0) + i18n (~> 0.9.0) unicode (~> 0.4.4) GEM remote: https://rubygems.org/ specs: - activesupport (5.1.4) + activesupport (5.1.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) tzinfo (~> 1.1) concurrent-ruby (1.0.5) diff-lcs (1.3) - i18n (0.8.6) - minitest (5.10.3) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + minitest (5.11.3) rake (10.5.0) rspec (2.99.0) rspec-core (~> 2.99.0) @@ -28,7 +29,7 @@ GEM diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.99.4) thread_safe (0.3.6) - tzinfo (1.2.4) + tzinfo (1.2.5) thread_safe (~> 0.1) unicode (0.4.4.4) @@ -42,4 +43,4 @@ DEPENDENCIES rspec (~> 2.14) BUNDLED WITH - 1.16.0 + 1.16.1 diff --git a/lib/russian/version.rb b/lib/russian/version.rb index 60dd4da..305dc0f 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.10.2" + VERSION = "0.11.0" end diff --git a/russian.gemspec b/russian.gemspec index 24117ea..99e6bd6 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency 'i18n', '~> 0.8.0' + spec.add_dependency 'i18n', '~> 0.9.0' spec.add_dependency 'unicode', '~> 0.4.4' spec.add_dependency 'activesupport', ['>= 3.0.0', '< 6.0.0'] From 7eba15c70b57ed34a75add81f31ddd972bc61db8 Mon Sep 17 00:00:00 2001 From: glebtv Date: Fri, 4 May 2018 03:00:55 +0300 Subject: [PATCH 56/65] bump i18n --- Gemfile.lock | 10 +++++----- lib/russian/version.rb | 2 +- russian.gemspec | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9bd794f..9a6a1a6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,22 +1,22 @@ PATH remote: . specs: - rs_russian (0.11.0) + rs_russian (0.12.0) activesupport (>= 3.0.0, < 6.0.0) - i18n (~> 0.9.0) + i18n (~> 1.0.0) unicode (~> 0.4.4) GEM remote: https://rubygems.org/ specs: - activesupport (5.1.5) + activesupport (5.2.0) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (~> 0.7) + i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) concurrent-ruby (1.0.5) diff-lcs (1.3) - i18n (0.9.5) + i18n (1.0.1) concurrent-ruby (~> 1.0) minitest (5.11.3) rake (10.5.0) diff --git a/lib/russian/version.rb b/lib/russian/version.rb index 305dc0f..690da57 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.11.0" + VERSION = "0.12.0" end diff --git a/russian.gemspec b/russian.gemspec index 99e6bd6..2128974 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency 'i18n', '~> 0.9.0' + spec.add_dependency 'i18n', '~> 1.0.0' spec.add_dependency 'unicode', '~> 0.4.4' spec.add_dependency 'activesupport', ['>= 3.0.0', '< 6.0.0'] From 21556013e5ff3fe0f4265d0b66b2463064c5cb5b Mon Sep 17 00:00:00 2001 From: Gleb Tv Date: Fri, 7 Sep 2018 12:22:56 +0300 Subject: [PATCH 57/65] bump i18n version --- Gemfile.lock | 10 +++++----- lib/russian/version.rb | 2 +- russian.gemspec | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9a6a1a6..7c05c14 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,22 +1,22 @@ PATH remote: . specs: - rs_russian (0.12.0) + rs_russian (0.13.0) activesupport (>= 3.0.0, < 6.0.0) - i18n (~> 1.0.0) + i18n (~> 1.1.0) unicode (~> 0.4.4) GEM remote: https://rubygems.org/ specs: - activesupport (5.2.0) + activesupport (5.2.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) concurrent-ruby (1.0.5) diff-lcs (1.3) - i18n (1.0.1) + i18n (1.1.0) concurrent-ruby (~> 1.0) minitest (5.11.3) rake (10.5.0) @@ -43,4 +43,4 @@ DEPENDENCIES rspec (~> 2.14) BUNDLED WITH - 1.16.1 + 1.16.3 diff --git a/lib/russian/version.rb b/lib/russian/version.rb index 690da57..13643af 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.12.0" + VERSION = "0.13.0" end diff --git a/russian.gemspec b/russian.gemspec index 2128974..3fb3a53 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency 'i18n', '~> 1.0.0' + spec.add_dependency 'i18n', '~> 1.1.0' spec.add_dependency 'unicode', '~> 0.4.4' spec.add_dependency 'activesupport', ['>= 3.0.0', '< 6.0.0'] From dcdcd52d244b8b739840ff4b9628014303a368f7 Mon Sep 17 00:00:00 2001 From: AnatolyShirykalov Date: Sat, 1 Jun 2019 09:42:39 +0300 Subject: [PATCH 58/65] update i18n --- russian.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/russian.gemspec b/russian.gemspec index 3fb3a53..10c03bc 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency 'i18n', '~> 1.1.0' + spec.add_dependency 'i18n', '~> 1.1' spec.add_dependency 'unicode', '~> 0.4.4' spec.add_dependency 'activesupport', ['>= 3.0.0', '< 6.0.0'] From f271e3643e8b3885c765cb2fb71936c8d8223576 Mon Sep 17 00:00:00 2001 From: Gleb Tv Date: Sat, 1 Jun 2019 09:56:15 +0300 Subject: [PATCH 59/65] bump version --- Gemfile.lock | 10 +++++----- lib/russian/version.rb | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7c05c14..692b652 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,20 +3,20 @@ PATH specs: rs_russian (0.13.0) activesupport (>= 3.0.0, < 6.0.0) - i18n (~> 1.1.0) + i18n (~> 1.1) unicode (~> 0.4.4) GEM remote: https://rubygems.org/ specs: - activesupport (5.2.1) + activesupport (5.2.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - concurrent-ruby (1.0.5) + concurrent-ruby (1.1.5) diff-lcs (1.3) - i18n (1.1.0) + i18n (1.6.0) concurrent-ruby (~> 1.0) minitest (5.11.3) rake (10.5.0) @@ -43,4 +43,4 @@ DEPENDENCIES rspec (~> 2.14) BUNDLED WITH - 1.16.3 + 1.17.2 diff --git a/lib/russian/version.rb b/lib/russian/version.rb index 13643af..10a3c37 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.13.0" + VERSION = "0.14.0" end From 288b595c4c7379cbfc2109064191cac68a76b9af Mon Sep 17 00:00:00 2001 From: Gleb Tv Date: Sat, 1 Jun 2019 09:56:39 +0300 Subject: [PATCH 60/65] bump version --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 692b652..bdbcd89 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rs_russian (0.13.0) + rs_russian (0.14.0) activesupport (>= 3.0.0, < 6.0.0) i18n (~> 1.1) unicode (~> 0.4.4) From 150f0ff17f23885bb47ef95370417b15839b3548 Mon Sep 17 00:00:00 2001 From: AnatolyShirykalov Date: Fri, 23 Aug 2019 17:25:09 +0300 Subject: [PATCH 61/65] Update russian.gemspec --- russian.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/russian.gemspec b/russian.gemspec index 10c03bc..93cfd7c 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'i18n', '~> 1.1' spec.add_dependency 'unicode', '~> 0.4.4' - spec.add_dependency 'activesupport', ['>= 3.0.0', '< 6.0.0'] + spec.add_dependency 'activesupport', ['>= 3.0.0', '< 6.1.0'] spec.add_development_dependency 'bundler', '~> 1.14' spec.add_development_dependency 'rake', '< 11.0' From e0aa8ac5e937f004c5f5a1419f8639f5c798e77c Mon Sep 17 00:00:00 2001 From: Gleb Tv Date: Sun, 25 Aug 2019 23:55:46 +0300 Subject: [PATCH 62/65] relax deps, bump version, add ruby versions to travis --- .travis.yml | 4 +++- Gemfile.lock | 16 +++++++++------- lib/russian/version.rb | 2 +- russian.gemspec | 4 ++-- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index e4743db..51a8524 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,6 @@ notifications: language: ruby rvm: - - 2.3.3 + - 2.4 + - 2.5 + - 2.6 diff --git a/Gemfile.lock b/Gemfile.lock index bdbcd89..50b0026 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,25 +1,26 @@ PATH remote: . specs: - rs_russian (0.14.0) - activesupport (>= 3.0.0, < 6.0.0) + rs_russian (0.15.0) + activesupport (>= 3.0.0, < 6.1.0) i18n (~> 1.1) unicode (~> 0.4.4) GEM remote: https://rubygems.org/ specs: - activesupport (5.2.3) + activesupport (6.0.0) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + zeitwerk (~> 2.1, >= 2.1.8) concurrent-ruby (1.1.5) diff-lcs (1.3) i18n (1.6.0) concurrent-ruby (~> 1.0) minitest (5.11.3) - rake (10.5.0) + rake (12.3.3) rspec (2.99.0) rspec-core (~> 2.99.0) rspec-expectations (~> 2.99.0) @@ -32,15 +33,16 @@ GEM tzinfo (1.2.5) thread_safe (~> 0.1) unicode (0.4.4.4) + zeitwerk (2.1.9) PLATFORMS ruby DEPENDENCIES - bundler (~> 1.14) - rake (< 11.0) + bundler + rake rs_russian! rspec (~> 2.14) BUNDLED WITH - 1.17.2 + 1.17.3 diff --git a/lib/russian/version.rb b/lib/russian/version.rb index 10a3c37..3218ba2 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.14.0" + VERSION = "0.15.0" end diff --git a/russian.gemspec b/russian.gemspec index 93cfd7c..a940653 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'unicode', '~> 0.4.4' spec.add_dependency 'activesupport', ['>= 3.0.0', '< 6.1.0'] - spec.add_development_dependency 'bundler', '~> 1.14' - spec.add_development_dependency 'rake', '< 11.0' + spec.add_development_dependency 'bundler' + spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec', '~> 2.14' end From c33730b12827e5ab5a88b684c11169ed6e8a6c88 Mon Sep 17 00:00:00 2001 From: Gleb Tv Date: Sun, 25 Aug 2019 23:58:35 +0300 Subject: [PATCH 63/65] downgrade rake --- .ruby-version | 2 +- .travis.yml | 1 - Gemfile.lock | 6 +++--- Rakefile | 12 +++++------- TODO | 4 ---- russian.gemspec | 4 ++-- 6 files changed, 11 insertions(+), 18 deletions(-) delete mode 100644 TODO diff --git a/.ruby-version b/.ruby-version index cd57a8b..0cadbc1 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.1.5 +2.5.5 diff --git a/.travis.yml b/.travis.yml index 51a8524..db81c11 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,5 @@ notifications: language: ruby rvm: - - 2.4 - 2.5 - 2.6 diff --git a/Gemfile.lock b/Gemfile.lock index 50b0026..6097b82 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -20,7 +20,7 @@ GEM i18n (1.6.0) concurrent-ruby (~> 1.0) minitest (5.11.3) - rake (12.3.3) + rake (10.5.0) rspec (2.99.0) rspec-core (~> 2.99.0) rspec-expectations (~> 2.99.0) @@ -39,8 +39,8 @@ PLATFORMS ruby DEPENDENCIES - bundler - rake + bundler (~> 1.14) + rake (< 11.0) rs_russian! rspec (~> 2.14) diff --git a/Rakefile b/Rakefile index 493cd35..3e4c4ac 100644 --- a/Rakefile +++ b/Rakefile @@ -1,12 +1,10 @@ require 'bundler/setup' Bundler::GemHelper.install_tasks -require 'rspec/core/rake_task' - -desc "Run all examples" -RSpec::Core::RakeTask.new(:spec) do |t| - #t.rspec_path = 'bin/rspec' - t.rspec_opts = %w[--color] +begin + require 'rspec/core/rake_task' + RSpec::Core::RakeTask.new(:spec) +rescue LoadError end -task :default => :spec \ No newline at end of file +task :default => :spec diff --git a/TODO b/TODO deleted file mode 100644 index cc5550d..0000000 --- a/TODO +++ /dev/null @@ -1,4 +0,0 @@ -TODO -==== -* RDoc - diff --git a/russian.gemspec b/russian.gemspec index a940653..93cfd7c 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'unicode', '~> 0.4.4' spec.add_dependency 'activesupport', ['>= 3.0.0', '< 6.1.0'] - spec.add_development_dependency 'bundler' - spec.add_development_dependency 'rake' + spec.add_development_dependency 'bundler', '~> 1.14' + spec.add_development_dependency 'rake', '< 11.0' spec.add_development_dependency 'rspec', '~> 2.14' end From 710fc7a4de4f8f708ea846b9e8a046bad4332d99 Mon Sep 17 00:00:00 2001 From: Gleb Tv Date: Wed, 23 Dec 2020 03:24:37 +0300 Subject: [PATCH 64/65] allow rails 6.1 --- Gemfile.lock | 31 +++++++++++++++---------------- lib/russian/version.rb | 2 +- russian.gemspec | 4 ++-- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6097b82..8767aa3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,25 +1,25 @@ PATH remote: . specs: - rs_russian (0.15.0) - activesupport (>= 3.0.0, < 6.1.0) - i18n (~> 1.1) + rs_russian (0.16.0) + activesupport (>= 3.0.0, < 6.2.0) + i18n (~> 1.8.0) unicode (~> 0.4.4) GEM remote: https://rubygems.org/ specs: - activesupport (6.0.0) + activesupport (6.1.0) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.1, >= 2.1.8) - concurrent-ruby (1.1.5) - diff-lcs (1.3) - i18n (1.6.0) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + concurrent-ruby (1.1.7) + diff-lcs (1.4.4) + i18n (1.8.5) concurrent-ruby (~> 1.0) - minitest (5.11.3) + minitest (5.14.2) rake (10.5.0) rspec (2.99.0) rspec-core (~> 2.99.0) @@ -29,11 +29,10 @@ GEM rspec-expectations (2.99.2) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.99.4) - thread_safe (0.3.6) - tzinfo (1.2.5) - thread_safe (~> 0.1) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) unicode (0.4.4.4) - zeitwerk (2.1.9) + zeitwerk (2.4.2) PLATFORMS ruby diff --git a/lib/russian/version.rb b/lib/russian/version.rb index 3218ba2..59b2e21 100644 --- a/lib/russian/version.rb +++ b/lib/russian/version.rb @@ -1,3 +1,3 @@ module Russian - VERSION = "0.15.0" + VERSION = "0.16.0" end diff --git a/russian.gemspec b/russian.gemspec index 93cfd7c..4e86089 100644 --- a/russian.gemspec +++ b/russian.gemspec @@ -18,9 +18,9 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency 'i18n', '~> 1.1' + spec.add_dependency 'i18n', '~> 1.8.0' spec.add_dependency 'unicode', '~> 0.4.4' - spec.add_dependency 'activesupport', ['>= 3.0.0', '< 6.1.0'] + spec.add_dependency 'activesupport', ['>= 3.0.0', '< 6.2.0'] spec.add_development_dependency 'bundler', '~> 1.14' spec.add_development_dependency 'rake', '< 11.0' From a573b21db70b1fa2ab5b6d4e1e9702ece34feec1 Mon Sep 17 00:00:00 2001 From: AnatolyShirykalov Date: Sat, 20 Feb 2021 14:35:34 +0300 Subject: [PATCH 65/65] fix stack_level too deep --- lib/russian/active_model_ext/custom_error_message.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/russian/active_model_ext/custom_error_message.rb b/lib/russian/active_model_ext/custom_error_message.rb index 16a53bf..59ca598 100644 --- a/lib/russian/active_model_ext/custom_error_message.rb +++ b/lib/russian/active_model_ext/custom_error_message.rb @@ -25,13 +25,14 @@ def full_message(attribute, message) end end + alias_method :to_hash_old, :to_hash def to_hash(full_messages = false) if full_messages - self.messages.each_with_object({}) do |(attribute, array), messages| + self.to_hash_old.each_with_object({}) do |(attribute, array), messages| messages[attribute] = array.map { |message| full_message(attribute, message) } end else - self.messages.dup.map do |k, vs| + self.to_hash_old.map do |k, vs| m = vs.map do |v| if v =~ /^\^/ v[1..-1]