haml-magic-translations 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -16,7 +16,7 @@ are also more readable and easier to translate, thanks to it you save your
16
16
  time with translations.
17
17
  DESCR
18
18
  gem.email = "jardiniers@potager.org"
19
- gem.homepage = "http://github.com/potager/haml-magic-translations"
19
+ gem.homepage = "https://github.com/potager/haml-magic-translations"
20
20
  gem.authors = ["Kriss Kowalik", "potager.org"]
21
21
  gem.add_dependency "haml", "~> 3.1"
22
22
  gem.add_development_dependency "actionpack"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{haml-magic-translations}
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kriss Kowalik", "potager.org"]
12
- s.date = %q{2013-03-21}
12
+ s.date = %q{2013-04-03}
13
13
  s.description = %q{This plugin provides "magical translations" in your .haml files. What does it
14
14
  mean? It's mean that all your raw texts in templates will be automatically
15
15
  translated by GetText, FastGettext or Gettext backend from I18n. No more
@@ -42,7 +42,7 @@ time with translations.
42
42
  "spec/locales/pl.po",
43
43
  "spec/spec_helper.rb"
44
44
  ]
45
- s.homepage = %q{http://github.com/potager/haml-magic-translations}
45
+ s.homepage = %q{https://github.com/potager/haml-magic-translations}
46
46
  s.require_paths = ["lib"]
47
47
  s.rubygems_version = %q{1.8.23}
48
48
  s.summary = %q{Provides automaticaly translations in haml templates}
@@ -161,7 +161,7 @@ module Haml::MagicTranslations::XGetText
161
161
  should == [['Hello %s! Welcome to %s.', '(haml):1']]
162
162
  end
163
163
  end
164
- context 'for translatable strings in Javascript' do
164
+ context 'for translatable strings in JavaScript' do
165
165
  let(:template) do <<-HAML.strip_heredoc
166
166
  :javascript
167
167
  var lines = [ _('First line'),
@@ -173,7 +173,7 @@ module Haml::MagicTranslations::XGetText
173
173
  ['Second line', '(haml):3']]
174
174
  end
175
175
  end
176
- context 'for Javascript strings with quotes' do
176
+ context 'for JavaScript strings with quotes' do
177
177
  let(:template) do <<-HAML.strip_heredoc
178
178
  :javascript
179
179
  var text = _('L\\'article');
@@ -11,6 +11,10 @@ class String
11
11
  indent = scan(/^[ \t]*(?=\S)/).min.try(:size) || 0
12
12
  gsub(/^[ \t]{#{indent}}/, '')
13
13
  end
14
+
15
+ def translate_unicode
16
+ gsub(/\\u([0-9a-z]{4})/) {|s| [$1.to_i(16)].pack("U")}
17
+ end
14
18
  end
15
19
 
16
20
  module Haml
@@ -128,9 +132,9 @@ module Haml
128
132
  HTML
129
133
  end
130
134
 
131
- context 'when translating strings in Javascript' do
135
+ context 'when translating strings in JavaScript' do
132
136
  it "should translate strings inside _('')" do
133
- render(<<-'HAML'.strip_heredoc).should == <<-'HTML'.strip_heredoc
137
+ render(<<-'HAML'.strip_heredoc).translate_unicode.should == <<-'HTML'.strip_heredoc.translate_unicode
134
138
  :javascript
135
139
  var text = _('Magic translations works!');
136
140
  HAML
@@ -142,7 +146,7 @@ module Haml
142
146
  HTML
143
147
  end
144
148
  it 'should translate strings inside _("")' do
145
- render(<<-'HAML'.strip_heredoc).should == <<-'HTML'.strip_heredoc
149
+ render(<<-'HAML'.strip_heredoc).translate_unicode.should == <<-'HTML'.strip_heredoc.translate_unicode
146
150
  :javascript
147
151
  var text = _("Magic translations works!");
148
152
  HAML
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-magic-translations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-03-21 00:00:00.000000000 Z
13
+ date: 2013-04-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: haml
@@ -154,7 +154,7 @@ files:
154
154
  - spec/locales/en.po
155
155
  - spec/locales/pl.po
156
156
  - spec/spec_helper.rb
157
- homepage: http://github.com/potager/haml-magic-translations
157
+ homepage: https://github.com/potager/haml-magic-translations
158
158
  licenses: []
159
159
  post_install_message:
160
160
  rdoc_options: []