haml-magic-translations 0.2.2 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/TODO DELETED
@@ -1,3 +0,0 @@
1
- * More info about .po files generator
2
- * Basic examples of usage .po files generator for Rails
3
- * Tests for GetText and FastGettext
@@ -1,65 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '../spec_helper.rb')
2
-
3
- Haml::Template.enable_magic_translations(:i18n)
4
- I18n.load_path += Dir[File.join(File.dirname(__FILE__), "../locales/*.{po}")]
5
-
6
- describe 'Haml magic translations with I18n' do
7
-
8
- it 'should allow to set :magic_translations option in Haml::Template' do
9
- Haml::Template.options.key?(:magic_translations).should be_true
10
- end
11
-
12
- it 'should translate text using existing locales' do
13
- Haml::Template.options[:magic_translations] = true
14
- I18n.locale = :pl
15
- <<HTML.should == render(<<HAML)
16
- <p>Magiczne tłumaczenie działa!</p>
17
- <p>A tutaj razem z interpolacją, a to wszystko dzięki połączeniu I18n i GetText</p>
18
- HTML
19
- %p Magic translations works!
20
- %p Here with interpolation, and everything thanks to \#{I18n.name} and \#{GetText.name}
21
- HAML
22
- end
23
-
24
- it 'should leave text without changes when translation was not found' do
25
- Haml::Template.options[:magic_translations] = true
26
- I18n.locale = :en
27
- <<HTML.should == render(<<HAML)
28
- <p>Magic translations works!</p>
29
- <p>And this one does not exist</p>
30
- <p>Here with interpolation, and everything thanks to I18n and GetText</p>
31
- HTML
32
- %p Magic translations works!
33
- %p And this one does not exist
34
- %p Here with interpolation, and everything thanks to \#{I18n.name} and \#{GetText.name}
35
- HAML
36
- end
37
-
38
- it 'should translate text with multiline plain text' do
39
- Haml::Template.options[:magic_translations] = true
40
- I18n.locale = :pl
41
- <<HTML.should == render(<<HAML)
42
- <p>Magiczne tłumaczenie działa!</p>
43
- <p>
44
- Kolejny wieloliniowy tekst,
45
- który powinien zostać przetłumaczony,
46
- interpolacja INTERPOLATION też działa!
47
- </p>
48
- HTML
49
- %p Magic translations works!
50
- %p
51
- Now we will check multiline strings,
52
- which should be also translated,
53
- with interpolation \#{'Interpolation'.upcase}
54
- HAML
55
- end
56
-
57
- it 'should leave text without changes when :magic_translations option is off' do
58
- Haml::Template.options[:magic_translations] = false
59
- <<HTML.should == render(<<HAML)
60
- <p>Text without changes</p>
61
- HTML
62
- %p Text without changes
63
- HAML
64
- end
65
- end