i18n_link 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,66 +1,5 @@
1
- h1. A helper for links in your translations
1
+ i18n_link is just 2 weeks old, but I rewrote it and released a new, more powerful gem called *it*, since the name is not fitting anymore. I recommend it as a general replacement for this project.
2
2
 
3
- h2. Why?
3
+ https://github.com/iGEL/it
4
4
 
5
- I18n is baked right into Rails, and it's great. But if you want to place links inside your translated copies, things get a little messy.
6
- You need to specify the label of your links separately from the rest of the copy. Writing HTML in your translations is even worse.
7
-
8
- <pre><code>en:
9
- copy: "Did you read the %{guide_link}?"
10
- copy_guide_link: "Rails I18n guide"</code></pre>
11
-
12
- <pre><code><%=raw t("copy", guide_link: link_to(t("copy_guide_link"), "http://guides.rubyonrails.org/i18n.html")) %></code></pre>
13
-
14
- Wouldn't it be much nicer and easier to understand for your translator to have the whole copy in single label? I18n_link lets you do that:
15
-
16
- <pre><code>en:
17
- copy: "Did you read the %{guide_link:Rails I18n guide}?"</code></pre>
18
-
19
- <pre><code><%=t_link "copy", guide_link: "http://guides.rubyonrails.org/i18n.html" %></code></pre>
20
-
21
- You may have noticed in the example above, that @t_link@ doesn't require @raw@ anymore. Of course, all HTML in the translation
22
- gets properly escaped, so you don't have to worry about XSS.
23
-
24
- h2. Installation
25
-
26
- Just add the following line to your Gemfile & run @bundle install@:
27
-
28
- <pre><code>gem 'i18n_link'</code></pre>
29
-
30
- h2. Usage
31
-
32
- You may have as many links inside your translations as you like, and normal interpolations are possible as well:
33
-
34
- <pre><code>en:
35
- copy: "Did you read the %{guide:Rails I18n guide}? It has more than %{advises} useful advises. You may fork the repo at {repo:github}."</code></pre>
36
-
37
- <pre><code><%=t_link "copy", guide: "http://guides.rubyonrails.org/i18n.html", advices: 100, repo: "https://github.com/lifo/docrails/tree/master/railties/guides" %></code></pre>
38
-
39
- You may also specify options for @link_to@. Just give a second option named like the link + @_options@
40
-
41
- <pre><code><%=t_link "copy", guide_link: "http://guides.rubyonrails.org/i18n.html", guide_link_options: {target: '_blank', class: "important"} %></code></pre>
42
-
43
- You may pass any kind of object accepted by @link_to@ as the link target, so your loved named routes like
44
- @article_path(:id => article.id)@ or hashes like @{controller: "articles", action: "index"}@ will all work fine, too.
45
-
46
- Even nested interpolations are possible:
47
-
48
- <pre><code>en:
49
- copy: "Did you read this %{link:nice %{guide}}?"</code></pre>
50
-
51
- <pre><code><%=t_link "copy", link: "http://guides.rubyonrails.org/i18n.html", guide: 'article' %></code></pre>
52
-
53
- h2. isit18.com?
54
-
55
- Sorry, I'm using Ruby 1.9.2 at the time of writing and didn't took the time to port i18n_link back to Ruby 1.8. You either might update to Ruby 1.9 as well
56
- or make the port yourself. It's probably a mater of minutes to do so, since the lib is small. Send me a pull request, if you have a port!
57
-
58
- h2. Abandoned & outdated?
59
-
60
- Everybody hates old and outdated gems, which don't work on with the latest Rails or Ruby version or haven't been updated for ages.
61
- Sadly, rubygems is full of such gems. If you improved i18n_link, send me a pull request. If I have not time to support the lib
62
- anymore, I will happily hand the project over to a new maintainer.
63
-
64
- h2. Broken English?
65
-
66
- I'm not a native speaker, so you'll probably find some spelling errors or clumsy sentences above. If you do, please send me a message.
5
+ https://rubygems.org/gems/it
@@ -2,4 +2,6 @@ require 'i18n_link/helper'
2
2
 
3
3
  ActiveSupport.on_load(:action_view) do
4
4
  include I18nLink::Helper
5
- end
5
+ end
6
+
7
+ puts "DEPRECATION WARNING: You use the deprecated gem 'i18n_link'. Consider to update to the new, more powerful gem 'it'."
@@ -6,6 +6,7 @@ module I18nLink
6
6
  include ERB::Util
7
7
 
8
8
  def t_link(translation, options = {})
9
+ Rails.logger.warn "DEPRECATION WARNING: t_link and the gem i18n_link are deprecated. Consider updating to the new gem 'it'. Called from #{caller.first}"
9
10
  options.symbolize_keys!
10
11
  string = String.new(h(t(translation))) # We want an escaped String, not an ActiveSupport::SafeBuffer
11
12
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: i18n_link
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.5
5
+ version: 0.1.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Johannes Barre
@@ -75,7 +75,7 @@ rubyforge_project:
75
75
  rubygems_version: 1.8.5
76
76
  signing_key:
77
77
  specification_version: 3
78
- summary: A helper for links in your translations
78
+ summary: Deprecated helper for links in your translations. Consider to use 'it' instead
79
79
  test_files:
80
80
  - spec/i18n_link_helper_spec.rb
81
81
  - spec/spec_helper.rb