gettext_simple_rails 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/config/default.po +11 -0
  3. data/config/poedit_ruby_parser.conf +6 -0
  4. data/lib/gettext_simple_rails/cache_handler.rb +45 -0
  5. data/lib/gettext_simple_rails/i18n_injector.rb +22 -3
  6. data/lib/gettext_simple_rails/model_inspector.rb +1 -5
  7. data/lib/gettext_simple_rails/setup_helper.rb +50 -0
  8. data/lib/gettext_simple_rails/version.rb +1 -1
  9. data/lib/gettext_simple_rails.rb +18 -0
  10. data/lib/tasks/gettext_simple_rails_tasks.rake +53 -3
  11. data/spec/active_record_spec.rb +8 -12
  12. data/spec/cache_handler_spec.rb +26 -0
  13. data/spec/date_translator_spec.rb +8 -12
  14. data/spec/dummy/config/locales_gettext/da/LC_MESSAGES/default.mo +0 -0
  15. data/spec/dummy/config/locales_gettext/da/LC_MESSAGES/default.po +361 -0
  16. data/spec/dummy/config/locales_gettext/en/LC_MESSAGES/default.po +11 -0
  17. data/spec/dummy/config/locales_gettext/static_translation_file.json +1 -0
  18. data/spec/dummy/lib/gettext_simple_rails/models/role_model_translations.rb +21 -0
  19. data/spec/dummy/lib/gettext_simple_rails/models/user_model_translations.rb +22 -0
  20. data/spec/dummy/log/test.log +193 -0
  21. data/spec/gettext_simple_rails_spec.rb +8 -12
  22. data/spec/poedit_config_with_ruby.conf +116 -0
  23. data/spec/poedit_config_without_ruby.conf +101 -0
  24. data/spec/setup_helper_spec.rb +41 -0
  25. metadata +25 -7
  26. data/spec/dummy/lib/gettext_simple_rails/active_record_translator_translations.rb +0 -18
  27. data/spec/dummy/lib/gettext_simple_rails/date_translator_translations.rb +0 -60
  28. data/spec/dummy/lib/gettext_simple_rails/number_translator_translations.rb +0 -48
@@ -0,0 +1,116 @@
1
+ version=1.5.4
2
+ last_file_path=/home/kaspernj/Dev/Rails/gettext_simple_rails/spec/dummy/config/locales_gettext/da/LC_MESSAGES
3
+ translator_name=Kasper Johansen
4
+ translator_email=k@spernj.org
5
+ compile_mo=1
6
+ show_summary=1
7
+ manager_startup=0
8
+ focus_to_text=0
9
+ comment_window_editable=0
10
+ keep_crlf=1
11
+ enable_spellchecking=1
12
+ custom_font_list_use=0
13
+ custom_font_text_use=0
14
+ custom_font_list_name=Droid Sans 10
15
+ custom_font_text_name=Droid Sans 10
16
+ crlf_format=unix
17
+ use_tm_when_updating=1
18
+ bottom_splitter=1080
19
+ splitter=412
20
+ display_quotes=0
21
+ display_lines=0
22
+ display_comment_win=0
23
+ display_auto_comments_win=1
24
+ file1=/home/kaspernj/Dev/Rails/gettext_simple_rails/spec/dummy/config/locales_gettext/da/LC_MESSAGES/default.po
25
+ file2=/home/kaspernj/Dev/Rails/taste_of_moen/config/locales_gettext/da/LC_MESSAGES/default.po
26
+ file3=/home/kaspernj/Dev/Rails/techsup/config/locales_gettext/da/LC_MESSAGES/default.po
27
+ file4=/home/kaspernj/Dev/Rails/cafe_app/config/locales_gettext/da/LC_MESSAGES/default.po
28
+ file5=/home/kaspernj/Dev/Rails/translateable_menus/config/locales_gettext/en/LC_MESSAGES/default.po
29
+ file6=/home/kaspernj/Dev/Rails/beach-inspectors/locales_gettext/da/LC_MESSAGES/default.po
30
+ file7=/home/kaspernj/Dev/Rails/beach-inspectors/locales_gettext/de/LC_MESSAGES/default.po
31
+ file8=/home/kaspernj/Dev/Rails/techsup/config/locales_gettext/en/LC_MESSAGES/default.po
32
+ file9=/home/kaspernj/Dev/Rails/techsup/locales_gettext/da/LC_MESSAGES/default.po
33
+ sort_by=file-order
34
+ sort_untrans_first=1
35
+ find_in_orig=1
36
+ find_in_trans=1
37
+ find_in_comments=1
38
+ find_in_auto_comments=1
39
+ find_case_sensitive=0
40
+ find_from_first=1
41
+ whole_words=0
42
+ [Parsers]
43
+ List=C/C++;C#;Java;Perl;PHP;Python;TCL;Ruby
44
+ DefaultsVersion=1.5.4
45
+ [Parsers/C_C\+\+]
46
+ Extensions=*.c;*.cpp;*.h;*.hpp;*.cc;*.C;*.cxx;*.hxx
47
+ Command=xgettext --language=C++ --force-po -o %o %C %K %F
48
+ KeywordItem=-k%k
49
+ FileItem=%f
50
+ CharsetItem=--from-code=%c
51
+ [Parsers/C\#]
52
+ Extensions=*.cs
53
+ Command=xgettext --language=C# --force-po -o %o %C %K %F
54
+ KeywordItem=-k%k
55
+ FileItem=%f
56
+ CharsetItem=--from-code=%c
57
+ [Parsers/Java]
58
+ Extensions=*.java
59
+ Command=xgettext --language=Java --force-po -o %o %C %K %F
60
+ KeywordItem=-k%k
61
+ FileItem=%f
62
+ CharsetItem=--from-code=%c
63
+ [Parsers/Perl]
64
+ Extensions=*.pl
65
+ Command=xgettext --language=Perl --force-po -o %o %C %K %F
66
+ KeywordItem=-k%k
67
+ FileItem=%f
68
+ CharsetItem=--from-code=%c
69
+ [Parsers/PHP]
70
+ Extensions=*.php
71
+ Command=xgettext --language=PHP --force-po -o %o %C %K %F
72
+ KeywordItem=-k%k
73
+ FileItem=%f
74
+ CharsetItem=--from-code=%c
75
+ [Parsers/Python]
76
+ Extensions=*.py
77
+ Command=xgettext --language=Python --force-po -o %o %C %K %F
78
+ KeywordItem=-k%k
79
+ FileItem=%f
80
+ CharsetItem=--from-code=%c
81
+ [Parsers/TCL]
82
+ Extensions=*.tcl
83
+ Command=xgettext --language=TCL --force-po -o %o %C %K %F
84
+ KeywordItem=-k%k
85
+ FileItem=%f
86
+ CharsetItem=--from-code=%c
87
+ [Parsers/Ruby]
88
+ Extensions=*.rb;*.rhtml;*.erb;*.haml
89
+ Command=ruby /home/kaspernj/Dev/Ruby/rgettext_poedit/bin/rgettext_poedit -o %o %F
90
+ KeywordItem=-k%k
91
+ FileItem=%f
92
+ CharsetItem=--from-code=%c
93
+ [TM]
94
+ search_paths=/home/kaspernj:/usr/share/locale:/usr/local/share/locale
95
+ languages=
96
+ max_omitted=2
97
+ max_delta=2
98
+ [donate]
99
+ dont_bug=1
100
+ last_asked=1394979984
101
+ [windows]
102
+ [windows/mainwin]
103
+ maximized=1
104
+ w=1426
105
+ h=819
106
+ [windows/summary]
107
+ w=875
108
+ h=582
109
+ maximized=0
110
+ [windows/manager]
111
+ w=928
112
+ h=525
113
+ maximized=0
114
+ [messages]
115
+ [messages/dont_show]
116
+ missing-spell-dict=1
@@ -0,0 +1,101 @@
1
+ version=1.5.4
2
+ last_file_path=/home/kaspernj/Dev/Rails/gettext_simple_rails/spec/dummy/config/locales_gettext/da/LC_MESSAGES
3
+ translator_name=Kasper Johansen
4
+ translator_email=k@spernj.org
5
+ compile_mo=1
6
+ show_summary=1
7
+ manager_startup=0
8
+ focus_to_text=0
9
+ comment_window_editable=0
10
+ keep_crlf=1
11
+ enable_spellchecking=1
12
+ custom_font_list_use=0
13
+ custom_font_text_use=0
14
+ custom_font_list_name=Droid Sans 10
15
+ custom_font_text_name=Droid Sans 10
16
+ crlf_format=unix
17
+ use_tm_when_updating=1
18
+ bottom_splitter=1080
19
+ splitter=412
20
+ display_quotes=0
21
+ display_lines=0
22
+ display_comment_win=0
23
+ display_auto_comments_win=1
24
+ sort_by=file-order
25
+ sort_untrans_first=1
26
+ find_in_orig=1
27
+ find_in_trans=1
28
+ find_in_comments=1
29
+ find_in_auto_comments=1
30
+ find_case_sensitive=0
31
+ find_from_first=1
32
+ whole_words=0
33
+ [Parsers]
34
+ List=C/C++;C#;Java;Perl;PHP;Python;TCL
35
+ DefaultsVersion=1.5.4
36
+ [Parsers/C_C\+\+]
37
+ Extensions=*.c;*.cpp;*.h;*.hpp;*.cc;*.C;*.cxx;*.hxx
38
+ Command=xgettext --language=C++ --force-po -o %o %C %K %F
39
+ KeywordItem=-k%k
40
+ FileItem=%f
41
+ CharsetItem=--from-code=%c
42
+ [Parsers/C\#]
43
+ Extensions=*.cs
44
+ Command=xgettext --language=C# --force-po -o %o %C %K %F
45
+ KeywordItem=-k%k
46
+ FileItem=%f
47
+ CharsetItem=--from-code=%c
48
+ [Parsers/Java]
49
+ Extensions=*.java
50
+ Command=xgettext --language=Java --force-po -o %o %C %K %F
51
+ KeywordItem=-k%k
52
+ FileItem=%f
53
+ CharsetItem=--from-code=%c
54
+ [Parsers/Perl]
55
+ Extensions=*.pl
56
+ Command=xgettext --language=Perl --force-po -o %o %C %K %F
57
+ KeywordItem=-k%k
58
+ FileItem=%f
59
+ CharsetItem=--from-code=%c
60
+ [Parsers/PHP]
61
+ Extensions=*.php
62
+ Command=xgettext --language=PHP --force-po -o %o %C %K %F
63
+ KeywordItem=-k%k
64
+ FileItem=%f
65
+ CharsetItem=--from-code=%c
66
+ [Parsers/Python]
67
+ Extensions=*.py
68
+ Command=xgettext --language=Python --force-po -o %o %C %K %F
69
+ KeywordItem=-k%k
70
+ FileItem=%f
71
+ CharsetItem=--from-code=%c
72
+ [Parsers/TCL]
73
+ Extensions=*.tcl
74
+ Command=xgettext --language=TCL --force-po -o %o %C %K %F
75
+ KeywordItem=-k%k
76
+ FileItem=%f
77
+ CharsetItem=--from-code=%c
78
+ [TM]
79
+ search_paths=/home/kaspernj:/usr/share/locale:/usr/local/share/locale
80
+ languages=
81
+ max_omitted=2
82
+ max_delta=2
83
+ [donate]
84
+ dont_bug=1
85
+ last_asked=1394979984
86
+ [windows]
87
+ [windows/mainwin]
88
+ maximized=1
89
+ w=1426
90
+ h=819
91
+ [windows/summary]
92
+ w=875
93
+ h=582
94
+ maximized=0
95
+ [windows/manager]
96
+ w=928
97
+ h=525
98
+ maximized=0
99
+ [messages]
100
+ [messages/dont_show]
101
+ missing-spell-dict=1
@@ -0,0 +1,41 @@
1
+ require "spec_helper"
2
+
3
+ describe GettextSimpleRails::SetupHelper do
4
+ it "should detect if a config doesnt contains ruby parser and ruby in the list and add them to the list" do
5
+ tmp_config_path = "/tmp/poedit_config_file"
6
+ sample_config_without_ruby = "#{File.dirname(__FILE__)}/poedit_config_without_ruby.conf"
7
+ FileUtils.cp(sample_config_without_ruby, tmp_config_path)
8
+
9
+ cache_handler = GettextSimpleRails::SetupHelper.new(
10
+ :poedit_config_path => tmp_config_path
11
+ )
12
+ cache_handler.poedit_config_path.should eq tmp_config_path
13
+
14
+ cache_handler.poedit_config_has_ruby_parser?.should eq false
15
+ cache_handler.poedit_config_has_ruby_in_list_of_parsers?.should eq false
16
+
17
+ cache_handler.poedit_add_ruby_parser_to_config
18
+
19
+ cache_handler.poedit_config_has_ruby_parser?.should eq true
20
+ cache_handler.poedit_config_has_ruby_in_list_of_parsers?.should eq false
21
+
22
+ cache_handler.poedit_config_add_ruby_to_list_of_parsers
23
+
24
+ cache_handler.poedit_config_has_ruby_parser?.should eq true
25
+ cache_handler.poedit_config_has_ruby_in_list_of_parsers?.should eq true
26
+ end
27
+
28
+ it "should detect if a config already contains ruby parser and ruby in the list" do
29
+ tmp_config_path = "/tmp/poedit_config_file"
30
+ sample_config_with_ruby = "#{File.dirname(__FILE__)}/poedit_config_with_ruby.conf"
31
+ FileUtils.cp(sample_config_with_ruby, tmp_config_path)
32
+
33
+ cache_handler = GettextSimpleRails::SetupHelper.new(
34
+ :poedit_config_path => tmp_config_path
35
+ )
36
+ cache_handler.poedit_config_path.should eq tmp_config_path
37
+
38
+ cache_handler.poedit_config_has_ruby_parser?.should eq true
39
+ cache_handler.poedit_config_has_ruby_in_list_of_parsers?.should eq true
40
+ end
41
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettext_simple_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Johansen
@@ -108,6 +108,9 @@ files:
108
108
  - app/controllers/gettext_simple_rails/application_controller.rb
109
109
  - app/views/layouts/gettext_simple_rails/application.html.erb
110
110
  - config/routes.rb
111
+ - config/poedit_ruby_parser.conf
112
+ - config/default.po
113
+ - lib/gettext_simple_rails/setup_helper.rb
111
114
  - lib/gettext_simple_rails/engine.rb
112
115
  - lib/gettext_simple_rails/i18n_injector.rb
113
116
  - lib/gettext_simple_rails/version.rb
@@ -118,19 +121,22 @@ files:
118
121
  - lib/gettext_simple_rails/translators/number_translator.rb
119
122
  - lib/gettext_simple_rails/translators/devise_translator.rb
120
123
  - lib/gettext_simple_rails/translators/date_translator.rb
124
+ - lib/gettext_simple_rails/cache_handler.rb
121
125
  - lib/gettext_simple_rails.rb
122
126
  - lib/tasks/gettext_simple_rails_tasks.rake
123
127
  - MIT-LICENSE
124
128
  - Rakefile
129
+ - spec/poedit_config_with_ruby.conf
130
+ - spec/poedit_config_without_ruby.conf
131
+ - spec/cache_handler_spec.rb
125
132
  - spec/dummy/bin/rails
126
133
  - spec/dummy/bin/bundle
127
134
  - spec/dummy/bin/rake
128
135
  - spec/dummy/config.ru
129
136
  - spec/dummy/README.rdoc
130
137
  - spec/dummy/Rakefile
131
- - spec/dummy/lib/gettext_simple_rails/date_translator_translations.rb
132
- - spec/dummy/lib/gettext_simple_rails/active_record_translator_translations.rb
133
- - spec/dummy/lib/gettext_simple_rails/number_translator_translations.rb
138
+ - spec/dummy/lib/gettext_simple_rails/models/user_model_translations.rb
139
+ - spec/dummy/lib/gettext_simple_rails/models/role_model_translations.rb
134
140
  - spec/dummy/test/models/user_test.rb
135
141
  - spec/dummy/test/models/role_test.rb
136
142
  - spec/dummy/test/fixtures/users.yml
@@ -167,10 +173,15 @@ files:
167
173
  - spec/dummy/config/initializers/inflections.rb
168
174
  - spec/dummy/config/database.yml
169
175
  - spec/dummy/config/environment.rb
176
+ - spec/dummy/config/locales_gettext/da/LC_MESSAGES/default.po
177
+ - spec/dummy/config/locales_gettext/da/LC_MESSAGES/default.mo
178
+ - spec/dummy/config/locales_gettext/en/LC_MESSAGES/default.po
179
+ - spec/dummy/config/locales_gettext/static_translation_file.json
170
180
  - spec/dummy/config/boot.rb
171
181
  - spec/dummy/config/environments/development.rb
172
182
  - spec/dummy/config/environments/test.rb
173
183
  - spec/dummy/config/environments/production.rb
184
+ - spec/setup_helper_spec.rb
174
185
  - spec/gettext_simple_rails_spec.rb
175
186
  - spec/spec_helper.rb
176
187
  - spec/date_translator_spec.rb
@@ -200,15 +211,17 @@ signing_key:
200
211
  specification_version: 4
201
212
  summary: Helpers for translating a Rails app with Gettext and POEdit.
202
213
  test_files:
214
+ - spec/poedit_config_with_ruby.conf
215
+ - spec/poedit_config_without_ruby.conf
216
+ - spec/cache_handler_spec.rb
203
217
  - spec/dummy/bin/rails
204
218
  - spec/dummy/bin/bundle
205
219
  - spec/dummy/bin/rake
206
220
  - spec/dummy/config.ru
207
221
  - spec/dummy/README.rdoc
208
222
  - spec/dummy/Rakefile
209
- - spec/dummy/lib/gettext_simple_rails/date_translator_translations.rb
210
- - spec/dummy/lib/gettext_simple_rails/active_record_translator_translations.rb
211
- - spec/dummy/lib/gettext_simple_rails/number_translator_translations.rb
223
+ - spec/dummy/lib/gettext_simple_rails/models/user_model_translations.rb
224
+ - spec/dummy/lib/gettext_simple_rails/models/role_model_translations.rb
212
225
  - spec/dummy/test/models/user_test.rb
213
226
  - spec/dummy/test/models/role_test.rb
214
227
  - spec/dummy/test/fixtures/users.yml
@@ -245,10 +258,15 @@ test_files:
245
258
  - spec/dummy/config/initializers/inflections.rb
246
259
  - spec/dummy/config/database.yml
247
260
  - spec/dummy/config/environment.rb
261
+ - spec/dummy/config/locales_gettext/da/LC_MESSAGES/default.po
262
+ - spec/dummy/config/locales_gettext/da/LC_MESSAGES/default.mo
263
+ - spec/dummy/config/locales_gettext/en/LC_MESSAGES/default.po
264
+ - spec/dummy/config/locales_gettext/static_translation_file.json
248
265
  - spec/dummy/config/boot.rb
249
266
  - spec/dummy/config/environments/development.rb
250
267
  - spec/dummy/config/environments/test.rb
251
268
  - spec/dummy/config/environments/production.rb
269
+ - spec/setup_helper_spec.rb
252
270
  - spec/gettext_simple_rails_spec.rb
253
271
  - spec/spec_helper.rb
254
272
  - spec/date_translator_spec.rb
@@ -1,18 +0,0 @@
1
- class GettextSimpleRails::MonthNames
2
- def translations
3
- #. Default value: Invalid record
4
- _('activerecord.errors.messages.record_invalid')
5
- #. Default value: is too short. The minimum is %{count}
6
- _('activerecord.errors.models.user.attributes.name.too_short')
7
- #. Default value: is too long. The maximum is %{count}
8
- _('activerecord.errors.models.user.attributes.name.too_long')
9
- #. Default value: has already been taken
10
- _('activerecord.errors.models.user.attributes.name.taken')
11
- #. Default value: cannot be blank
12
- _('activerecord.errors.models.user.attributes.name.blank')
13
- #. Default value: is invalid
14
- _('activerecord.errors.models.user.attributes.name.invalid')
15
- #. Default value: is invalid
16
- _('activerecord.errors.models.user.attributes.email.invalid')
17
- end
18
- end
@@ -1,60 +0,0 @@
1
- class GettextSimpleRails::MonthNames
2
- def translations
3
- #. Default value: %Y-%m-%d
4
- _('date.formats.default')
5
- #. Default value: %b %d
6
- _('date.formats.short')
7
- #. Default value: %B %d, %Y
8
- _('date.formats.long')
9
- _('date.day_names.0')
10
- _('date.day_names.1')
11
- _('date.day_names.2')
12
- _('date.day_names.3')
13
- _('date.day_names.4')
14
- _('date.day_names.5')
15
- _('date.day_names.6')
16
- _('date.abbr_day_names.0')
17
- _('date.abbr_day_names.1')
18
- _('date.abbr_day_names.2')
19
- _('date.abbr_day_names.3')
20
- _('date.abbr_day_names.4')
21
- _('date.abbr_day_names.5')
22
- _('date.abbr_day_names.6')
23
- _('date.month_names.0')
24
- _('date.month_names.1')
25
- _('date.month_names.2')
26
- _('date.month_names.3')
27
- _('date.month_names.4')
28
- _('date.month_names.5')
29
- _('date.month_names.6')
30
- _('date.month_names.7')
31
- _('date.month_names.8')
32
- _('date.month_names.9')
33
- _('date.month_names.10')
34
- _('date.month_names.11')
35
- _('date.month_names.12')
36
- _('date.abbr_month_names.0')
37
- _('date.abbr_month_names.1')
38
- _('date.abbr_month_names.2')
39
- _('date.abbr_month_names.3')
40
- _('date.abbr_month_names.4')
41
- _('date.abbr_month_names.5')
42
- _('date.abbr_month_names.6')
43
- _('date.abbr_month_names.7')
44
- _('date.abbr_month_names.8')
45
- _('date.abbr_month_names.9')
46
- _('date.abbr_month_names.10')
47
- _('date.abbr_month_names.11')
48
- _('date.abbr_month_names.12')
49
- #. Default value: %a, %d %b %Y %H:%M:%S %z
50
- _('time.formats.default')
51
- #. Default value: %d %b %H:%M
52
- _('time.formats.short')
53
- #. Default value: %B %d, %Y %H:%M
54
- _('time.formats.long')
55
- #. Default value: am
56
- _('time.am')
57
- #. Default value: pm
58
- _('time.pm')
59
- end
60
- end
@@ -1,48 +0,0 @@
1
- class GettextSimpleRails::MonthNames
2
- def translations
3
- #. Default value: ,
4
- _('number.currency.format.delimiter')
5
- #. Default value: %n %u
6
- _('number.currency.format.format')
7
- #. Default value: .
8
- _('number.currency.format.separator')
9
- #. Default value: $
10
- _('number.currency.format.unit')
11
- #. Default value: ,
12
- _('number.format.delimiter')
13
- #. Default value: .
14
- _('number.format.separator')
15
- #. Default value: %n %u
16
- _('number.human.decimal_units.format')
17
- #. Default value: Billion
18
- _('number.human.decimal_units.units.billion')
19
- #. Default value: Million
20
- _('number.human.decimal_units.units.million')
21
- #. Default value: Quadrillion
22
- _('number.human.decimal_units.units.quadrillion')
23
- #. Default value: Thousand
24
- _('number.human.decimal_units.units.thousand')
25
- #. Default value: Trillion
26
- _('number.human.decimal_units.units.trillion')
27
- #. Default value:
28
- _('number.human.decimal_units.units.unit')
29
- #. Default value:
30
- _('number.human.format.delimiter')
31
- #. Default value: %n %u
32
- _('number.human.storage_units.format')
33
- #. Default value: Byte
34
- _('number.human.storage_units.units.byte.one')
35
- #. Default value: Bytes
36
- _('number.human.storage_units.units.byte.other')
37
- #. Default value: GB
38
- _('number.human.storage_units.units.gb')
39
- #. Default value: KB
40
- _('number.human.storage_units.units.kb')
41
- #. Default value: MB
42
- _('number.human.storage_units.units.mb')
43
- #. Default value: TB
44
- _('number.human.storage_units.units.tb')
45
- #. Default value:
46
- _('number.percentage.format.delimiter')
47
- end
48
- end