stamp-i18n 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +7 -0
- data/lib/stamp-i18n/version.rb +3 -0
- data/lib/stamp-i18n.rb +18 -0
- data/spec/locales/pl.yml +119 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/stamp/stamp_spec.rb +26 -0
- data/stamp-i18n.gemspec +21 -0
- metadata +108 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Michal Karpinski
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Stamp::I18n
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'stamp-i18n'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install stamp-i18n
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/stamp-i18n.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'time'
|
3
|
+
require 'i18n'
|
4
|
+
|
5
|
+
require "stamp-i18n/version"
|
6
|
+
|
7
|
+
# using stamp gem
|
8
|
+
require 'stamp'
|
9
|
+
|
10
|
+
module StampI18n
|
11
|
+
def localize_stamp(example)
|
12
|
+
I18n.localize self, :format => strftime_format(example)
|
13
|
+
end
|
14
|
+
alias :l_stamp :localize_stamp
|
15
|
+
end
|
16
|
+
|
17
|
+
Date.send(:include,::StampI18n)
|
18
|
+
Time.send(:include,::StampI18n)
|
data/spec/locales/pl.yml
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
pl:
|
2
|
+
date:
|
3
|
+
abbr_day_names:
|
4
|
+
- nie
|
5
|
+
- pon
|
6
|
+
- wto
|
7
|
+
- śro
|
8
|
+
- czw
|
9
|
+
- pią
|
10
|
+
- sob
|
11
|
+
abbr_month_names:
|
12
|
+
-
|
13
|
+
- sty
|
14
|
+
- lut
|
15
|
+
- mar
|
16
|
+
- kwi
|
17
|
+
- maj
|
18
|
+
- cze
|
19
|
+
- lip
|
20
|
+
- sie
|
21
|
+
- wrz
|
22
|
+
- paź
|
23
|
+
- lis
|
24
|
+
- gru
|
25
|
+
day_names:
|
26
|
+
- niedziela
|
27
|
+
- poniedziałek
|
28
|
+
- wtorek
|
29
|
+
- środa
|
30
|
+
- czwartek
|
31
|
+
- piątek
|
32
|
+
- sobota
|
33
|
+
formats:
|
34
|
+
default: ! '%d-%m-%Y'
|
35
|
+
long: ! '%B %d, %Y'
|
36
|
+
short: ! '%d %b'
|
37
|
+
month_names:
|
38
|
+
-
|
39
|
+
- Styczeń
|
40
|
+
- Luty
|
41
|
+
- Marzec
|
42
|
+
- Kwiecień
|
43
|
+
- Maj
|
44
|
+
- Czerwiec
|
45
|
+
- Lipiec
|
46
|
+
- Sierpień
|
47
|
+
- Wrzesień
|
48
|
+
- Październik
|
49
|
+
- Listopad
|
50
|
+
- Grudzień
|
51
|
+
order:
|
52
|
+
- :day
|
53
|
+
- :month
|
54
|
+
- :year
|
55
|
+
datetime:
|
56
|
+
distance_in_words:
|
57
|
+
about_x_hours:
|
58
|
+
few: około %{count} godziny
|
59
|
+
one: około godziny
|
60
|
+
other: około %{count} godzin
|
61
|
+
many: około %{count} godzin
|
62
|
+
about_x_months:
|
63
|
+
few: około %{count} miesiące
|
64
|
+
one: około miesiąca
|
65
|
+
other: około %{count} miesięcy
|
66
|
+
many: około %{count} miesięcy
|
67
|
+
about_x_years:
|
68
|
+
few: około %{count} lata
|
69
|
+
one: około rok
|
70
|
+
other: około %{count} lat
|
71
|
+
many: około %{count} lat
|
72
|
+
almost_x_years:
|
73
|
+
few: prawie %{count} lata
|
74
|
+
one: prawie rok
|
75
|
+
other: prawie %{count} lat
|
76
|
+
many: prawie %{count} lat
|
77
|
+
half_a_minute: pół minuty
|
78
|
+
less_than_x_minutes:
|
79
|
+
few: mniej niż %{count} minuty
|
80
|
+
one: mniej niż minutę
|
81
|
+
other: mniej niż %{count} minut
|
82
|
+
many: mniej niż %{count} minut
|
83
|
+
less_than_x_seconds:
|
84
|
+
few: mniej niż %{count} sekundy
|
85
|
+
one: mniej niż sekundę
|
86
|
+
other: mniej niż %{count} sekund
|
87
|
+
many: mniej niż %{count} sekund
|
88
|
+
over_x_years:
|
89
|
+
few: ponad %{count} lata
|
90
|
+
one: ponad rok
|
91
|
+
other: ponad %{count} lat
|
92
|
+
many: ponad %{count} lat
|
93
|
+
x_days:
|
94
|
+
few: ! '%{count} dni'
|
95
|
+
one: 1 dzień
|
96
|
+
other: ! '%{count} dni'
|
97
|
+
many: ! '%{count} dni'
|
98
|
+
x_minutes:
|
99
|
+
few: ! '%{count} minuty'
|
100
|
+
one: 1 minuta
|
101
|
+
other: ! '%{count} minut'
|
102
|
+
many: ! '%{count} minut'
|
103
|
+
x_months:
|
104
|
+
few: ! '%{count} miesiące'
|
105
|
+
one: 1 miesiąc
|
106
|
+
other: ! '%{count} miesięcy'
|
107
|
+
many: ! '%{count} miesięcy'
|
108
|
+
x_seconds:
|
109
|
+
few: ! '%{count} sekundy'
|
110
|
+
one: 1 sekunda
|
111
|
+
other: ! '%{count} sekund'
|
112
|
+
many: ! '%{count} sekund'
|
113
|
+
prompts:
|
114
|
+
day: Dzień
|
115
|
+
hour: Godzina
|
116
|
+
minute: Minuta
|
117
|
+
month: Miesiąc
|
118
|
+
second: Sekundy
|
119
|
+
year: Rok
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe StampI18n do
|
4
|
+
|
5
|
+
it 'should use old stamp method' do
|
6
|
+
date = Date.new(2011, 6, 9)
|
7
|
+
date.stamp("March 1, 1999").should == "June 9, 2011"
|
8
|
+
date.stamp("Jan 1, 1999").should == "Jun 9, 2011"
|
9
|
+
date.stamp("Jan 01").should == "Jun 09"
|
10
|
+
date.stamp("Sunday, May 1, 2000").should == "Thursday, June 9, 2011"
|
11
|
+
date.stamp("Sun Aug 5").should == "Thu Jun 9"
|
12
|
+
date.stamp("12/31/99").should == "06/09/11"
|
13
|
+
date.stamp("DOB: 12/31/2000").should == "DOB: 06/09/2011"
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should use new localize stamp method' do
|
17
|
+
date = Date.new(2011, 6, 9)
|
18
|
+
date.localize_stamp("March 1, 1999").should == "Czerwiec 9, 2011"
|
19
|
+
date.localize_stamp("Jan 1, 1999").should == "cze 9, 2011"
|
20
|
+
date.localize_stamp("Jan 01").should == "cze 09"
|
21
|
+
date.localize_stamp("Sunday, May 1, 2000").should == "czwartek, Czerwiec 9, 2011"
|
22
|
+
date.localize_stamp("Sun Aug 5").should == "czw cze 9"
|
23
|
+
date.localize_stamp("12/31/99").should == "06/09/11"
|
24
|
+
date.localize_stamp("DOB: 12/31/2000").should == "DOB: 06/09/2011"
|
25
|
+
end
|
26
|
+
end
|
data/stamp-i18n.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/stamp-i18n/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Michal Karpinski"]
|
6
|
+
gem.email = ["karp0506@gmail.com"]
|
7
|
+
gem.description = %q{Fork of stamp gem. Modified for I18n use}
|
8
|
+
gem.summary = %q{Fork of stamp gem. Modified for I18n use}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "stamp-i18n"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = StampI18n::VERSION
|
17
|
+
|
18
|
+
gem.add_development_dependency "rspec"
|
19
|
+
gem.add_development_dependency "stamp"
|
20
|
+
gem.add_development_dependency "i18n"
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: stamp-i18n
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Michal Karpinski
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: stamp
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: i18n
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: Fork of stamp gem. Modified for I18n use
|
63
|
+
email:
|
64
|
+
- karp0506@gmail.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- .rspec
|
71
|
+
- Gemfile
|
72
|
+
- LICENSE
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- lib/stamp-i18n.rb
|
76
|
+
- lib/stamp-i18n/version.rb
|
77
|
+
- spec/locales/pl.yml
|
78
|
+
- spec/spec_helper.rb
|
79
|
+
- spec/stamp/stamp_spec.rb
|
80
|
+
- stamp-i18n.gemspec
|
81
|
+
homepage: ''
|
82
|
+
licenses: []
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
requirements: []
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 1.8.24
|
102
|
+
signing_key:
|
103
|
+
specification_version: 3
|
104
|
+
summary: Fork of stamp gem. Modified for I18n use
|
105
|
+
test_files:
|
106
|
+
- spec/locales/pl.yml
|
107
|
+
- spec/spec_helper.rb
|
108
|
+
- spec/stamp/stamp_spec.rb
|