gettext_i18n_rails 0.10.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +6 -6
- data/Readme.md +2 -1
- data/gemfiles/rails23.gemfile +1 -1
- data/gemfiles/rails23.gemfile.lock +6 -6
- data/gemfiles/rails30.gemfile +1 -1
- data/gemfiles/rails30.gemfile.lock +6 -6
- data/gemfiles/rails31.gemfile +1 -1
- data/gemfiles/rails31.gemfile.lock +6 -6
- data/gemfiles/rails32.gemfile +1 -1
- data/gemfiles/rails32.gemfile.lock +6 -6
- data/lib/gettext_i18n_rails/railtie.rb +2 -1
- data/lib/gettext_i18n_rails/tasks.rb +42 -74
- data/lib/gettext_i18n_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4dd291e15fd76fd0cc3b38c9e08bc2ceb660919
|
4
|
+
data.tar.gz: 23285b33671f71bfffffc2f8d7a98a1234152898
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a692ad8e854d81e8ec9412383e5526b3ee43572480efc53cd08a683bd1bc404d565056a7e127e3491fb1a431c991b7fd1264bf64c9048611624b7da31fb8c7a7
|
7
|
+
data.tar.gz: be798dab60d94e994f60bc16ce5b03240f9c8c0088e675a5640c8110100481940a08c69f1e9be893962fa4b56b97b7bb4e0fbad25a37725fa19142f761a1924b
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gettext_i18n_rails (0.
|
4
|
+
gettext_i18n_rails (1.0.0)
|
5
5
|
fast_gettext (>= 0.4.8)
|
6
6
|
|
7
7
|
GEM
|
@@ -41,14 +41,14 @@ GEM
|
|
41
41
|
diff-lcs (1.2.4)
|
42
42
|
erubis (2.7.0)
|
43
43
|
fast_gettext (0.7.1)
|
44
|
-
gettext (
|
45
|
-
locale
|
44
|
+
gettext (3.0.2)
|
45
|
+
locale (>= 2.0.5)
|
46
46
|
text
|
47
47
|
haml (4.0.3)
|
48
48
|
tilt
|
49
49
|
hike (1.2.3)
|
50
50
|
i18n (0.6.4)
|
51
|
-
locale (2.0.
|
51
|
+
locale (2.0.9)
|
52
52
|
mail (2.5.4)
|
53
53
|
mime-types (~> 1.16)
|
54
54
|
treetop (~> 1.4.8)
|
@@ -98,7 +98,7 @@ GEM
|
|
98
98
|
sprockets (~> 2.8)
|
99
99
|
sqlite3 (1.3.7)
|
100
100
|
temple (0.6.6)
|
101
|
-
text (1.2.
|
101
|
+
text (1.2.3)
|
102
102
|
thor (0.18.1)
|
103
103
|
thread_safe (0.1.2)
|
104
104
|
atomic
|
@@ -114,7 +114,7 @@ PLATFORMS
|
|
114
114
|
DEPENDENCIES
|
115
115
|
appraisal
|
116
116
|
bump
|
117
|
-
gettext
|
117
|
+
gettext (>= 3.0.2)
|
118
118
|
gettext_i18n_rails!
|
119
119
|
haml
|
120
120
|
rails
|
data/Readme.md
CHANGED
@@ -31,7 +31,7 @@ Add `gettext` if you want to find translations or build .mo files<br/>
|
|
31
31
|
Add `ruby_parser` if you want to find translations inside haml/slim files
|
32
32
|
|
33
33
|
# Gemfile
|
34
|
-
gem 'gettext', '>=
|
34
|
+
gem 'gettext', '>=3.0.2', :require => false, :group => :development
|
35
35
|
gem 'ruby_parser', :require => false, :group => :development
|
36
36
|
|
37
37
|
#### Rails 2
|
@@ -235,6 +235,7 @@ If want to use your .PO files on client side javascript you should have a look a
|
|
235
235
|
- [Imre Farkas](https://github.com/ifarkas)
|
236
236
|
- [Trong Tran](https://github.com/trongrg)
|
237
237
|
- [Dmitri Dolguikh](https://github.com/witlessbird)
|
238
|
+
- [Joe Ferris](https://github.com/jferris)
|
238
239
|
|
239
240
|
[Michael Grosser](http://grosser.it)<br/>
|
240
241
|
grosser.michael@gmail.com<br/>
|
data/gemfiles/rails23.gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: /Users/mgrosser/code/tools/gettext_i18n_rails
|
3
3
|
specs:
|
4
|
-
gettext_i18n_rails (0.10.
|
4
|
+
gettext_i18n_rails (0.10.1)
|
5
5
|
fast_gettext (>= 0.4.8)
|
6
6
|
|
7
7
|
GEM
|
@@ -23,11 +23,11 @@ GEM
|
|
23
23
|
bump (0.4.2)
|
24
24
|
diff-lcs (1.2.4)
|
25
25
|
fast_gettext (0.7.1)
|
26
|
-
gettext (
|
27
|
-
locale
|
26
|
+
gettext (3.0.2)
|
27
|
+
locale (>= 2.0.5)
|
28
28
|
text
|
29
29
|
haml (3.1.7)
|
30
|
-
locale (2.0.
|
30
|
+
locale (2.0.9)
|
31
31
|
rack (1.1.6)
|
32
32
|
rails (2.3.18)
|
33
33
|
actionmailer (= 2.3.18)
|
@@ -53,7 +53,7 @@ GEM
|
|
53
53
|
tilt (>= 1.3.3, < 2.1)
|
54
54
|
sqlite3 (1.3.7)
|
55
55
|
temple (0.6.6)
|
56
|
-
text (1.2.
|
56
|
+
text (1.2.3)
|
57
57
|
tilt (1.4.1)
|
58
58
|
|
59
59
|
PLATFORMS
|
@@ -62,7 +62,7 @@ PLATFORMS
|
|
62
62
|
DEPENDENCIES
|
63
63
|
appraisal
|
64
64
|
bump
|
65
|
-
gettext
|
65
|
+
gettext (>= 3.0.2)
|
66
66
|
gettext_i18n_rails!
|
67
67
|
haml (~> 3.0)
|
68
68
|
rails (~> 2.3.0)
|
data/gemfiles/rails30.gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: /Users/mgrosser/code/tools/gettext_i18n_rails
|
3
3
|
specs:
|
4
|
-
gettext_i18n_rails (0.10.
|
4
|
+
gettext_i18n_rails (0.10.1)
|
5
5
|
fast_gettext (>= 0.4.8)
|
6
6
|
|
7
7
|
GEM
|
@@ -44,14 +44,14 @@ GEM
|
|
44
44
|
erubis (2.6.6)
|
45
45
|
abstract (>= 1.0.0)
|
46
46
|
fast_gettext (0.7.1)
|
47
|
-
gettext (
|
48
|
-
locale
|
47
|
+
gettext (3.0.2)
|
48
|
+
locale (>= 2.0.5)
|
49
49
|
text
|
50
50
|
haml (4.0.3)
|
51
51
|
tilt
|
52
52
|
i18n (0.5.0)
|
53
53
|
json (1.8.0)
|
54
|
-
locale (2.0.
|
54
|
+
locale (2.0.9)
|
55
55
|
mail (2.2.20)
|
56
56
|
activesupport (>= 2.3.6)
|
57
57
|
i18n (>= 0.4.0)
|
@@ -97,7 +97,7 @@ GEM
|
|
97
97
|
tilt (>= 1.3.3, < 2.1)
|
98
98
|
sqlite3 (1.3.7)
|
99
99
|
temple (0.6.6)
|
100
|
-
text (1.2.
|
100
|
+
text (1.2.3)
|
101
101
|
thor (0.14.6)
|
102
102
|
tilt (1.4.1)
|
103
103
|
treetop (1.4.14)
|
@@ -111,7 +111,7 @@ PLATFORMS
|
|
111
111
|
DEPENDENCIES
|
112
112
|
appraisal
|
113
113
|
bump
|
114
|
-
gettext
|
114
|
+
gettext (>= 3.0.2)
|
115
115
|
gettext_i18n_rails!
|
116
116
|
haml
|
117
117
|
rails (~> 3.0.0)
|
data/gemfiles/rails31.gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: /Users/mgrosser/code/tools/gettext_i18n_rails
|
3
3
|
specs:
|
4
|
-
gettext_i18n_rails (0.10.
|
4
|
+
gettext_i18n_rails (0.10.1)
|
5
5
|
fast_gettext (>= 0.4.8)
|
6
6
|
|
7
7
|
GEM
|
@@ -44,15 +44,15 @@ GEM
|
|
44
44
|
diff-lcs (1.2.4)
|
45
45
|
erubis (2.7.0)
|
46
46
|
fast_gettext (0.7.1)
|
47
|
-
gettext (
|
48
|
-
locale
|
47
|
+
gettext (3.0.2)
|
48
|
+
locale (>= 2.0.5)
|
49
49
|
text
|
50
50
|
haml (4.0.3)
|
51
51
|
tilt
|
52
52
|
hike (1.2.3)
|
53
53
|
i18n (0.6.4)
|
54
54
|
json (1.8.0)
|
55
|
-
locale (2.0.
|
55
|
+
locale (2.0.9)
|
56
56
|
mail (2.4.4)
|
57
57
|
i18n (>= 0.4.0)
|
58
58
|
mime-types (~> 1.16)
|
@@ -107,7 +107,7 @@ GEM
|
|
107
107
|
tilt (~> 1.1, != 1.3.0)
|
108
108
|
sqlite3 (1.3.7)
|
109
109
|
temple (0.6.6)
|
110
|
-
text (1.2.
|
110
|
+
text (1.2.3)
|
111
111
|
thor (0.14.6)
|
112
112
|
tilt (1.4.1)
|
113
113
|
treetop (1.4.14)
|
@@ -121,7 +121,7 @@ PLATFORMS
|
|
121
121
|
DEPENDENCIES
|
122
122
|
appraisal
|
123
123
|
bump
|
124
|
-
gettext
|
124
|
+
gettext (>= 3.0.2)
|
125
125
|
gettext_i18n_rails!
|
126
126
|
haml
|
127
127
|
rails (~> 3.1.0)
|
data/gemfiles/rails32.gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: /Users/mgrosser/code/tools/gettext_i18n_rails
|
3
3
|
specs:
|
4
|
-
gettext_i18n_rails (0.10.
|
4
|
+
gettext_i18n_rails (0.10.1)
|
5
5
|
fast_gettext (>= 0.4.8)
|
6
6
|
|
7
7
|
GEM
|
@@ -43,8 +43,8 @@ GEM
|
|
43
43
|
diff-lcs (1.2.4)
|
44
44
|
erubis (2.7.0)
|
45
45
|
fast_gettext (0.7.1)
|
46
|
-
gettext (
|
47
|
-
locale
|
46
|
+
gettext (3.0.2)
|
47
|
+
locale (>= 2.0.5)
|
48
48
|
text
|
49
49
|
haml (4.0.3)
|
50
50
|
tilt
|
@@ -52,7 +52,7 @@ GEM
|
|
52
52
|
i18n (0.6.4)
|
53
53
|
journey (1.0.4)
|
54
54
|
json (1.8.0)
|
55
|
-
locale (2.0.
|
55
|
+
locale (2.0.9)
|
56
56
|
mail (2.5.4)
|
57
57
|
mime-types (~> 1.16)
|
58
58
|
treetop (~> 1.4.8)
|
@@ -105,7 +105,7 @@ GEM
|
|
105
105
|
tilt (~> 1.1, != 1.3.0)
|
106
106
|
sqlite3 (1.3.7)
|
107
107
|
temple (0.6.6)
|
108
|
-
text (1.2.
|
108
|
+
text (1.2.3)
|
109
109
|
thor (0.18.1)
|
110
110
|
tilt (1.4.1)
|
111
111
|
treetop (1.4.14)
|
@@ -119,7 +119,7 @@ PLATFORMS
|
|
119
119
|
DEPENDENCIES
|
120
120
|
appraisal
|
121
121
|
bump
|
122
|
-
gettext
|
122
|
+
gettext (>= 3.0.2)
|
123
123
|
gettext_i18n_rails!
|
124
124
|
haml
|
125
125
|
rails (~> 3.2.0)
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module GettextI18nRails
|
2
2
|
class Railtie < ::Rails::Railtie
|
3
3
|
config.gettext_i18n_rails = ActiveSupport::OrderedOptions.new
|
4
|
-
config.gettext_i18n_rails.msgmerge =
|
4
|
+
config.gettext_i18n_rails.msgmerge = nil
|
5
|
+
config.gettext_i18n_rails.xgettext = nil
|
5
6
|
config.gettext_i18n_rails.use_for_active_record_attributes = true
|
6
7
|
|
7
8
|
rake_tasks do
|
@@ -1,55 +1,49 @@
|
|
1
|
+
require "gettext/tools/task"
|
2
|
+
gem "gettext", ">= 3.0.2"
|
3
|
+
|
1
4
|
namespace :gettext do
|
2
|
-
def
|
3
|
-
|
4
|
-
|
5
|
+
def locale_path
|
6
|
+
path = FastGettext.translation_repositories[text_domain].instance_variable_get(:@options)[:path] rescue nil
|
7
|
+
path || File.join(Rails.root, "locale")
|
8
|
+
end
|
9
|
+
|
10
|
+
def text_domain
|
11
|
+
# if your textdomain is not 'app': require the environment before calling e.g. gettext:find OR add TEXTDOMAIN=my_domain
|
12
|
+
ENV['TEXTDOMAIN'] || (FastGettext.text_domain rescue nil) || "app"
|
13
|
+
end
|
14
|
+
|
15
|
+
# do not rename, gettext_i18n_rails_js overwrites this to inject coffee + js
|
16
|
+
def files_to_translate
|
17
|
+
Dir.glob("{app,lib,config,#{locale_path}}/**/*.{rb,erb,haml,slim}")
|
18
|
+
end
|
19
|
+
|
20
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__),'..','..','lib') # needed when installed as plugin
|
21
|
+
|
22
|
+
require "gettext_i18n_rails/haml_parser"
|
23
|
+
require "gettext_i18n_rails/slim_parser"
|
24
|
+
|
25
|
+
GetText::Tools::Task.define do |task|
|
26
|
+
task.package_name = text_domain
|
27
|
+
task.package_version = "1.0.0"
|
28
|
+
task.domain = text_domain
|
29
|
+
task.po_base_directory = locale_path
|
30
|
+
task.mo_base_directory = locale_path
|
31
|
+
task.files = files_to_translate
|
32
|
+
task.enable_description = false
|
33
|
+
|
34
|
+
default = %w[--sort-by-msgid --no-location --no-wrap]
|
35
|
+
config = (Rails.application.config.gettext_i18n_rails.msgmerge if defined?(Rails.application))
|
36
|
+
task.msgmerge_options = config || default
|
37
|
+
config = (Rails.application.config.gettext_i18n_rails.xgettext if defined?(Rails.application))
|
38
|
+
task.xgettext_options = config || default
|
5
39
|
end
|
6
40
|
|
7
41
|
desc "Create mo-files for L10n"
|
8
|
-
task :pack => :environment do
|
9
|
-
load_gettext
|
10
|
-
GetText.create_mofiles(true, locale_path, locale_path)
|
42
|
+
task :pack => [:environment, "gettext:gettext:mo:update"] do
|
11
43
|
end
|
12
44
|
|
13
45
|
desc "Update pot/po files."
|
14
|
-
task :find => :environment do
|
15
|
-
load_gettext
|
16
|
-
$LOAD_PATH << File.join(File.dirname(__FILE__),'..','..','lib') # needed when installed as plugin
|
17
|
-
|
18
|
-
require "gettext_i18n_rails/haml_parser"
|
19
|
-
require "gettext_i18n_rails/slim_parser"
|
20
|
-
|
21
|
-
if GetText.respond_to? :update_pofiles_org
|
22
|
-
if defined?(Rails.application)
|
23
|
-
msgmerge = Rails.application.config.gettext_i18n_rails.msgmerge
|
24
|
-
end
|
25
|
-
msgmerge ||= %w[--sort-output --no-location --no-wrap]
|
26
|
-
|
27
|
-
GetText.update_pofiles_org(
|
28
|
-
text_domain,
|
29
|
-
files_to_translate,
|
30
|
-
"version 0.0.1",
|
31
|
-
:po_root => locale_path,
|
32
|
-
:msgmerge => msgmerge
|
33
|
-
)
|
34
|
-
else #we are on a version < 2.0
|
35
|
-
puts "install new GetText with gettext:install to gain more features..."
|
36
|
-
#kill ar parser...
|
37
|
-
require 'gettext/parser/active_record'
|
38
|
-
module GetText
|
39
|
-
module ActiveRecordParser
|
40
|
-
module_function
|
41
|
-
def init(x);end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
#parse files.. (models are simply parsed as ruby files)
|
46
|
-
GetText.update_pofiles(
|
47
|
-
text_domain,
|
48
|
-
files_to_translate,
|
49
|
-
"version 0.0.1",
|
50
|
-
locale_path
|
51
|
-
)
|
52
|
-
end
|
46
|
+
task :find => [:environment, "gettext:gettext:po:update"] do
|
53
47
|
end
|
54
48
|
|
55
49
|
# This is more of an example, ignoring
|
@@ -92,35 +86,9 @@ namespace :gettext do
|
|
92
86
|
puts "You need to specify the language to add. Either 'LANGUAGE=eo rake gettext:add_languange' or 'rake gettext:add_languange[eo]'"
|
93
87
|
next
|
94
88
|
end
|
95
|
-
pot = File.join(locale_path, "#{text_domain}.pot")
|
96
|
-
if !File.exists? pot
|
97
|
-
puts "You don't have a pot file yet, you probably should run 'rake gettext:find' at least once. Tried '#{pot}'."
|
98
|
-
next
|
99
|
-
end
|
100
|
-
|
101
|
-
# Create the directory for the new language.
|
102
|
-
dir = File.join(locale_path, language)
|
103
|
-
puts "Creating directory #{dir}"
|
104
|
-
Dir.mkdir dir
|
105
|
-
|
106
|
-
# Create the po file for the new language.
|
107
|
-
new_po = File.join(locale_path, language, "#{text_domain}.po")
|
108
|
-
puts "Initializing #{new_po} from #{pot}."
|
109
|
-
system "msginit --locale=#{language} --input=#{pot} --output=#{new_po}"
|
110
|
-
end
|
111
|
-
|
112
|
-
def locale_path
|
113
|
-
path = FastGettext.translation_repositories[text_domain].instance_variable_get(:@options)[:path] rescue nil
|
114
|
-
path || File.join(Rails.root, "locale")
|
115
|
-
end
|
116
89
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
end
|
121
|
-
|
122
|
-
# do not rename, gettext_i18n_rails_js overwrites this to inject coffee + js
|
123
|
-
def files_to_translate
|
124
|
-
Dir.glob("{app,lib,config,#{locale_path}}/**/*.{rb,erb,haml,slim}")
|
90
|
+
language_path = File.join(locale_path, language)
|
91
|
+
mkdir_p(language_path)
|
92
|
+
ruby($0, "gettext:find")
|
125
93
|
end
|
126
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gettext_i18n_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fast_gettext
|