r18n-core 0.4.7.1 → 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.4.8 (En ni to)
2
+ * Fix support for Ruby 1.9.2.
3
+ * Fix caching issue (by Viktors Rotanovs).
4
+ * Add Danish locale (by Hans Czajkowski Jørgensen)
5
+ * Fix Italian locale (by Viktors Rotanovs).
6
+ * Move untranslated filters with html highlight to r18n-core.
7
+
1
8
  == 0.4.7.1 (Kyū)
2
9
  * Fix Japanese locale in Ruby 1.9.1.
3
10
 
data/README.rdoc CHANGED
@@ -94,7 +94,8 @@ plugins).
94
94
 
95
95
  === Object Translation
96
96
 
97
- You can translate any class, including ORM models:
97
+ You can translate any class, including ORM models (ActiveRecord, DataMapper,
98
+ MongoMapper, Mongoid or others):
98
99
 
99
100
  require 'r18n-core/translated'
100
101
 
@@ -360,7 +361,8 @@ and <tt>:standard</tt> (the default):
360
361
 
361
362
  === Model
362
363
 
363
- You can add i18n support to any classes, including ORM models:
364
+ You can add i18n support to any classes, including ORM models (ActiveRecord,
365
+ DataMapper, MongoMapper, Mongoid or others):
364
366
 
365
367
  require 'r18n-core/translated'
366
368
 
data/base/da.yml ADDED
@@ -0,0 +1,31 @@
1
+ ok: OK
2
+ save: Gem
3
+ cancel: Annullér
4
+ 'yes': 'Ja'
5
+ 'no': 'Nej'
6
+ exit: Afslut
7
+ delete: Slet
8
+
9
+ human_time:
10
+ after_days: !!pl
11
+ 1: efter %1 dag
12
+ n: efter %1 dage
13
+ tomorrow: i morgen
14
+ after_hours: !!pl
15
+ 1: efter %1 time
16
+ n: efter %1 timer
17
+ after_minutes: !!pl
18
+ 1: efter %1 minut
19
+ n: efter %1 minutter
20
+ now: nu
21
+ today: i dag
22
+ minutes_ago: !!pl
23
+ 1: %1 minut siden
24
+ n: %1 minutter siden
25
+ hours_ago: !!pl
26
+ 1: %1 time siden
27
+ n: %1 timer siden
28
+ yesterday: i går
29
+ days_ago: !!pl
30
+ 1: %1 dag siden
31
+ n: %1 dage siden
@@ -247,6 +247,12 @@ module R18n
247
247
  "#{translated}[#{untranslated}]"
248
248
  end
249
249
 
250
+ Filters.add(Untranslated, :untranslated_html) do |v, c, transl, untransl|
251
+ Utils.escape_html(transl) <<
252
+ '<span style="color: red">' << Utils.escape_html(untransl) << '</span>'
253
+ end
254
+ Filters.off(:untranslated_html)
255
+
250
256
  Filters.add('escape', :escape_html, :passive => true) do |content, config|
251
257
  config[:dont_escape_html] = true
252
258
  Utils.escape_html(content)
@@ -183,7 +183,7 @@ module R18n
183
183
  # Return unique key for current locales in translation and places.
184
184
  def translation_cache_key
185
185
  @available_codes ||= @translation_places.inject([]) { |all, i|
186
- all + i.available }.uniq.map { |i| i.code }
186
+ all + i.available }.uniq.map { |i| i.code.downcase }
187
187
  (@locales_codes & @available_codes).join(',') + '@' +
188
188
  R18n.default_loader.hash.to_s +
189
189
  @translation_places.hash.to_s + R18n.extension_places.hash.to_s
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module R18n
3
- VERSION = '0.4.7.1' unless defined? R18n::VERSION
3
+ VERSION = '0.4.8' unless defined? R18n::VERSION
4
4
  end
data/locales/da.rb ADDED
@@ -0,0 +1,23 @@
1
+ # encoding: utf-8
2
+ module R18n
3
+ class Locales::Da < Locale
4
+ set :title => 'Dansk',
5
+
6
+ :wday_names => %w{søndag mandag tirsdag onsdag torsdag fredag
7
+ lørdag},
8
+ :wday_abbrs => %w{søn man tir ons tor fre lør},
9
+
10
+ :month_names => %w{januar februar marts april Maj juni juli august
11
+ september oktober november december},
12
+ :month_abbrs => %w{jan. feb. mar. apr. maj jun. jul. aug. sep. okt.
13
+ nov. dec.},
14
+
15
+ :time_am => 'om formiddagen',
16
+ :time_pm => 'om eftermiddagen',
17
+ :date_format => '%d.%m.%Y',
18
+ :full_format => '%d. %B %Y',
19
+
20
+ :number_decimal => ",",
21
+ :number_group => "."
22
+ end
23
+ end
data/locales/it.rb CHANGED
@@ -7,7 +7,8 @@ module R18n
7
7
  sabato},
8
8
  :wday_abbrs => %w{dom lun mar mer gio ven sab},
9
9
 
10
- :month_names => %w{gennaio febbraio marzo aprile maggio giugno luglio},
10
+ :month_names => %w{gennaio febbraio marzo aprile maggio giugno
11
+ luglio agosto settembre ottobre novembre dicembre},
11
12
  :month_abbrs => %w{gen feb mar apr mag giu lug ago set ott nov dic},
12
13
 
13
14
  :date_format => '%d/%m/%Y',
data/spec/filters_spec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
+ require File.expand_path('../spec_helper', __FILE__)
3
3
 
4
4
  describe R18n::Filters do
5
5
  before do
@@ -188,6 +188,13 @@ describe R18n::Filters do
188
188
  @i18n.in.another.to_s.should == 'in.another in.another[]'
189
189
  end
190
190
 
191
+ it "should format untranslated for web" do
192
+ R18n::Filters.off(:untranslated)
193
+ R18n::Filters.on(:untranslated_html)
194
+ @i18n.in.not.to_s.should == 'in.<span style="color: red">not</span>'
195
+ @i18n['<b>'].to_s.should == '<span style="color: red">&lt;b&gt;</span>'
196
+ end
197
+
191
198
  it "should have filter for escape HTML" do
192
199
  @i18n.html.should == '&lt;script&gt;true &amp;&amp; false&lt;/script&gt;'
193
200
  end
data/spec/i18n_spec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
+ require File.expand_path('../spec_helper', __FILE__)
3
3
 
4
4
  describe R18n::I18n do
5
5
  before do
data/spec/locale_spec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
+ require File.expand_path('../spec_helper', __FILE__)
3
3
 
4
4
  describe R18n::Locale do
5
5
  before :all do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
2
 
3
3
  describe R18n::Locales::Cs do
4
4
  it "should use Czech pluralization" do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
2
 
3
3
  describe R18n::Locales::EnUs do
4
4
  it "should format American English date" do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
2
 
3
3
  describe R18n::Locales::En do
4
4
  it "should format English date" do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
2
 
3
3
  describe R18n::Locales::Fr do
4
4
  it "should format French date" do
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
2
+ require File.expand_path('../../spec_helper', __FILE__)
3
3
 
4
4
  describe R18n::Locales::Hu do
5
5
  it "should use Hungarian digits groups" do
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
2
+ require File.expand_path('../../spec_helper', __FILE__)
3
3
 
4
4
  describe R18n::Locales::It do
5
5
  it "should format Italian date" do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
2
 
3
3
  describe R18n::Locales::Pl do
4
4
  it "should use Polish pluralization" do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
2
 
3
3
  describe R18n::Locales::Ru do
4
4
  it "should use Russian pluralization" do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
2
 
3
3
  describe R18n::Locales::Sk do
4
4
  it "should use Slovak pluralization" do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
2
 
3
3
  describe R18n::Locales::Ru do
4
4
  it "should use Thai calendar" do
data/spec/r18n_spec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
+ require File.expand_path('../spec_helper', __FILE__)
3
3
 
4
4
  describe R18n do
5
5
  include R18n::Helpers
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
- require File.join(File.dirname(__FILE__), 'spec_helper')
3
- require File.join(File.dirname(__FILE__), '..', 'lib', 'r18n-core', 'translated')
2
+ require File.expand_path('../spec_helper', __FILE__)
3
+ require File.expand_path('../../lib/r18n-core/translated', __FILE__)
4
4
 
5
5
  describe R18n::Translated do
6
6
  before do
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
+ require File.expand_path('../spec_helper', __FILE__)
3
3
 
4
4
  describe R18n::Translation do
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
+ require File.expand_path('../spec_helper', __FILE__)
3
3
 
4
4
  describe R18n::Loader::YAML do
5
5
  before do
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r18n-core
3
3
  version: !ruby/object:Gem::Version
4
- hash: 113
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 7
10
- - 1
11
- version: 0.4.7.1
9
+ - 8
10
+ version: 0.4.8
12
11
  platform: ruby
13
12
  authors:
14
13
  - Andrey "A.I." Sitnik
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2010-08-08 00:00:00 +04:00
18
+ date: 2010-09-22 00:00:00 +04:00
20
19
  default_executable:
21
20
  dependencies: []
22
21
 
@@ -39,6 +38,7 @@ files:
39
38
  - base/sk.yml
40
39
  - base/kk.yml
41
40
  - base/es.yml
41
+ - base/da.yml
42
42
  - base/fi.yml
43
43
  - base/lv.yml
44
44
  - base/de.yml
@@ -79,6 +79,7 @@ files:
79
79
  - locales/ru.rb
80
80
  - locales/en-us.rb
81
81
  - locales/ja.rb
82
+ - locales/da.rb
82
83
  - locales/en-gb.rb
83
84
  - locales/de.rb
84
85
  - locales/hu.rb