i18n_lookup_tracer 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in i18n_lookup.gemspec
4
+ gemspec
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "i18n_lookup_tracer/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "i18n_lookup_tracer"
7
+ s.version = I18nLookupTracer::VERSION
8
+ s.authors = ["Clément Alexandre"]
9
+ s.email = ["clmntlxndr@gmail.com"]
10
+ s.homepage = "https://github.com/clmntlxndr/i18n_lookup_tracer"
11
+ s.summary = %q{Traces the i18n translation keys lookup}
12
+ s.description = %q{Traces the i18n translation keys lookup}
13
+
14
+ s.rubyforge_project = "i18n_lookup_tracer"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ s.add_runtime_dependency "i18n"
24
+ s.add_runtime_dependency "rails"
25
+ end
@@ -0,0 +1,16 @@
1
+ require "i18n_lookup_tracer/version"
2
+
3
+ module I18nLookupTracer
4
+ def self.setup
5
+ I18n::Backend::Simple::Implementation.class_eval do
6
+ alias :old_lookup :lookup
7
+ protected
8
+ def lookup(locale, key, scope = [], options = {})
9
+ init_translations unless initialized?
10
+ keys = I18n.normalize_keys(locale, key, scope, options[:separator])
11
+ Rails.logger.info "I18n key lookup: #{keys.join(".")}"
12
+ old_lookup(locale, key, scope, options)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module I18nLookupTracer
2
+ VERSION = "0.0.6"
3
+ end
@@ -0,0 +1,30 @@
1
+ I18nLookupTracer
2
+ ----------------
3
+
4
+ Traces I18n translation keys lookup.
5
+
6
+ Works with Rails 3.1.3
7
+
8
+ Just doing something like what is shown in [this post from Tilo Sloboda](http://unixgods.org/~tilo/Rails/where_is_Rails_trying_to_lookup_L10N_strings.html), kind of gemified.
9
+
10
+ Usage
11
+ -----
12
+
13
+ #Gemfile
14
+ gem 'i18n_lookup_tracer'
15
+
16
+ #config/initializers/i18n_lookup_tracer.rb
17
+ I18nLookupTracer.setup if Rails.env.development?
18
+
19
+ As it's very bad for the rendering speed, you may want to add an extra condition.
20
+
21
+ Then, calling the label related to the *name* attribute of an *Organization* model in a form builder, you're going to see in your in console :
22
+
23
+ I18n key lookup: fr.helpers.label.organization.name
24
+ I18n key lookup: fr.activerecord.attributes.organization.name
25
+ I18n key lookup: fr.attributes.name
26
+
27
+ License
28
+ -------
29
+
30
+ Feel free to contribute and just say hi [@clmntlxndr](http://www.twitter.com/clmntlxndr)
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: i18n_lookup_tracer
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 6
9
+ version: 0.0.6
10
+ platform: ruby
11
+ authors:
12
+ - "Cl\xC3\xA9ment Alexandre"
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-01-10 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: i18n
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: rails
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :runtime
43
+ version_requirements: *id002
44
+ description: Traces the i18n translation keys lookup
45
+ email:
46
+ - clmntlxndr@gmail.com
47
+ executables: []
48
+
49
+ extensions: []
50
+
51
+ extra_rdoc_files: []
52
+
53
+ files:
54
+ - .gitignore
55
+ - Gemfile
56
+ - Rakefile
57
+ - i18n_lookup_tracer.gemspec
58
+ - lib/i18n_lookup_tracer.rb
59
+ - lib/i18n_lookup_tracer/version.rb
60
+ - readme.md
61
+ has_rdoc: true
62
+ homepage: https://github.com/clmntlxndr/i18n_lookup_tracer
63
+ licenses: []
64
+
65
+ post_install_message:
66
+ rdoc_options: []
67
+
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ segments:
82
+ - 0
83
+ version: "0"
84
+ requirements: []
85
+
86
+ rubyforge_project: i18n_lookup_tracer
87
+ rubygems_version: 1.3.6
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Traces the i18n translation keys lookup
91
+ test_files: []
92
+