i18n_backend_database_rails3 0.2.0
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.
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.textile +125 -0
- data/Rakefile +1 -0
- data/data/locales.yml +4 -0
- data/generators/i18n_backend_database/i18n_backend_database_generator.rb +8 -0
- data/generators/i18n_backend_database/templates/migrate/create_i18n_tables.rb +19 -0
- data/i18n_backend_database.gemspec +24 -0
- data/init.rb +1 -0
- data/lib/controllers/locales_controller.rb +86 -0
- data/lib/controllers/translations_controller.rb +141 -0
- data/lib/ext/i18n.rb +68 -0
- data/lib/google_language.rb +30 -0
- data/lib/i18n_backend_database.rb +9 -0
- data/lib/i18n_backend_database/database.rb +263 -0
- data/lib/i18n_backend_database/version.rb +7 -0
- data/lib/i18n_util.rb +148 -0
- data/lib/models/locale.rb +67 -0
- data/lib/models/translation.rb +46 -0
- data/lib/models/translation_option.rb +26 -0
- data/lib/public/images/custom1_bar.gif +0 -0
- data/lib/public/images/custom1_box.gif +0 -0
- data/lib/public/images/percentImage.png +0 -0
- data/lib/public/images/percentImage_back.png +0 -0
- data/lib/public/images/percentImage_back1.png +0 -0
- data/lib/public/images/percentImage_back2.png +0 -0
- data/lib/public/images/percentImage_back3.png +0 -0
- data/lib/public/images/percentImage_back4.png +0 -0
- data/lib/public/javascripts/jsProgressBarHandler.js +509 -0
- data/lib/routing.rb +15 -0
- data/lib/views/layouts/translations.html.haml +16 -0
- data/lib/views/locales/edit.html.haml +16 -0
- data/lib/views/locales/index.html.haml +14 -0
- data/lib/views/locales/new.html.haml +14 -0
- data/lib/views/locales/show.html.haml +10 -0
- data/lib/views/translations/asset_translations.html.haml +23 -0
- data/lib/views/translations/edit.html.haml +24 -0
- data/lib/views/translations/index.html.haml +21 -0
- data/lib/views/translations/new.html.haml +14 -0
- data/lib/views/translations/show.html.haml +21 -0
- data/lib/views/translations/translations.html.haml +20 -0
- data/lib/views/translations/update.rjs +7 -0
- data/routes.rb +3 -0
- data/spec/assets/public/es/favicons/favicon1.gif +0 -0
- data/spec/assets/public/es/images/icons/icon1.gif +0 -0
- data/spec/assets/public/es/images/image1.gif +0 -0
- data/spec/assets/public/favicons/favicon1.gif +0 -0
- data/spec/assets/public/favicons/favicon2.gif +0 -0
- data/spec/assets/public/images/icons/icon1.gif +0 -0
- data/spec/assets/public/images/icons/icon2.gif +0 -0
- data/spec/assets/public/images/image1.gif +0 -0
- data/spec/assets/public/images/image2.gif +0 -0
- data/spec/assets/public/images/promo/sfc08_140x400_3.gif +0 -0
- data/spec/assets/views/test_view1.html.erb +1 -0
- data/spec/assets/views/test_view2.html.erb +30 -0
- data/spec/caching_spec.rb +87 -0
- data/spec/controllers/locales_controller_spec.rb +173 -0
- data/spec/controllers/locales_routing_spec.rb +59 -0
- data/spec/controllers/translations_controller_spec.rb +189 -0
- data/spec/controllers/translations_routing_spec.rb +59 -0
- data/spec/database_spec.rb +199 -0
- data/spec/i18n_ext_spec.rb +40 -0
- data/spec/localize_spec.rb +66 -0
- data/spec/localize_text_spec.rb +76 -0
- data/spec/models/locale_spec.rb +111 -0
- data/spec/models/translation_spec.rb +44 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/translate_asset_spec.rb +57 -0
- data/spec/translate_spec.rb +546 -0
- data/tasks/i18n.rake +60 -0
- metadata +143 -0
data/tasks/i18n.rake
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
def load_default_locales(path_to_file=nil)
|
2
|
+
path_to_file ||= File.join(File.dirname(__FILE__), "../data", "locales.yml")
|
3
|
+
data = YAML::load(IO.read(path_to_file))
|
4
|
+
data.each do |code, y|
|
5
|
+
Locale.create({:code => code, :name => y["name"]}) unless Locale.exists?(:code => code)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
namespace :i18n do
|
10
|
+
desc 'Clear cache'
|
11
|
+
task :clear_cache => :environment do
|
12
|
+
I18n.backend.cache_store.clear
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Install admin panel assets'
|
16
|
+
task :install_admin_assets => :environment do
|
17
|
+
images_dir = Rails.root + '/public/images/'
|
18
|
+
javascripts_dir = Rails.root + '/public/javascripts/'
|
19
|
+
images = Dir[File.join(File.dirname(__FILE__), '..') + '/lib/public/images/*.*']
|
20
|
+
scripts = Dir[File.join(File.dirname(__FILE__), '..') + '/lib/public/javascripts/*.*']
|
21
|
+
FileUtils.cp(images, images_dir)
|
22
|
+
FileUtils.cp(scripts, javascripts_dir)
|
23
|
+
end
|
24
|
+
|
25
|
+
namespace :populate do
|
26
|
+
desc 'Populate the locales and translations tables from all Rails Locale YAML files. Can set LOCALE_YAML_FILES to comma separated list of files to overide'
|
27
|
+
task :from_rails => :environment do
|
28
|
+
yaml_files = ENV['LOCALE_YAML_FILES'] ? ENV['LOCALE_YAML_FILES'].split(',') : I18n.load_path
|
29
|
+
yaml_files.each do |file|
|
30
|
+
I18nUtil.load_from_yml file
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
desc 'Populate the translation tables from translation calls within the application. This only works on basic text translations. Can set DIR to override starting directory.'
|
35
|
+
task :from_application => :environment do
|
36
|
+
dir = ENV['DIR'] ? ENV['DIR'] : "."
|
37
|
+
I18nUtil.seed_application_translations(dir)
|
38
|
+
end
|
39
|
+
|
40
|
+
desc 'Create translation records from all default locale translations if none exists.'
|
41
|
+
task :synchronize_translations => :environment do
|
42
|
+
I18nUtil.synchronize_translations
|
43
|
+
end
|
44
|
+
|
45
|
+
desc 'Populate default locales'
|
46
|
+
task :load_default_locales => :environment do
|
47
|
+
load_default_locales(ENV['LOCALE_FILE'])
|
48
|
+
end
|
49
|
+
|
50
|
+
desc 'Runs all populate methods in this order: load_default_locales, from_rails, from_application, synchronize_translations'
|
51
|
+
task :all => ["load_default_locales", "from_rails", "from_application", "synchronize_translations"]
|
52
|
+
end
|
53
|
+
|
54
|
+
namespace :translate do
|
55
|
+
desc 'Translate all untranslated values using Google Language Translation API. Does not translate interpolated strings, date formats, or YAML'
|
56
|
+
task :google => :environment do
|
57
|
+
I18nUtil.google_translate
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: i18n_backend_database_rails3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dylan Stamat
|
9
|
+
- Hector Bustillos
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-01-23 00:00:00.000000000Z
|
14
|
+
dependencies: []
|
15
|
+
description: This is a gem based on the original repo of Dylan Stamat, which add's
|
16
|
+
cool functions to manage i18n
|
17
|
+
email:
|
18
|
+
- hector.bustillos@crowdint.com
|
19
|
+
executables: []
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- Gemfile
|
24
|
+
- LICENSE
|
25
|
+
- README.textile
|
26
|
+
- Rakefile
|
27
|
+
- data/locales.yml
|
28
|
+
- generators/i18n_backend_database/i18n_backend_database_generator.rb
|
29
|
+
- generators/i18n_backend_database/templates/migrate/create_i18n_tables.rb
|
30
|
+
- i18n_backend_database.gemspec
|
31
|
+
- init.rb
|
32
|
+
- lib/controllers/locales_controller.rb
|
33
|
+
- lib/controllers/translations_controller.rb
|
34
|
+
- lib/ext/i18n.rb
|
35
|
+
- lib/google_language.rb
|
36
|
+
- lib/i18n_backend_database.rb
|
37
|
+
- lib/i18n_backend_database/database.rb
|
38
|
+
- lib/i18n_backend_database/version.rb
|
39
|
+
- lib/i18n_util.rb
|
40
|
+
- lib/models/locale.rb
|
41
|
+
- lib/models/translation.rb
|
42
|
+
- lib/models/translation_option.rb
|
43
|
+
- lib/public/images/custom1_bar.gif
|
44
|
+
- lib/public/images/custom1_box.gif
|
45
|
+
- lib/public/images/percentImage.png
|
46
|
+
- lib/public/images/percentImage_back.png
|
47
|
+
- lib/public/images/percentImage_back1.png
|
48
|
+
- lib/public/images/percentImage_back2.png
|
49
|
+
- lib/public/images/percentImage_back3.png
|
50
|
+
- lib/public/images/percentImage_back4.png
|
51
|
+
- lib/public/javascripts/jsProgressBarHandler.js
|
52
|
+
- lib/routing.rb
|
53
|
+
- lib/views/layouts/translations.html.haml
|
54
|
+
- lib/views/locales/edit.html.haml
|
55
|
+
- lib/views/locales/index.html.haml
|
56
|
+
- lib/views/locales/new.html.haml
|
57
|
+
- lib/views/locales/show.html.haml
|
58
|
+
- lib/views/translations/asset_translations.html.haml
|
59
|
+
- lib/views/translations/edit.html.haml
|
60
|
+
- lib/views/translations/index.html.haml
|
61
|
+
- lib/views/translations/new.html.haml
|
62
|
+
- lib/views/translations/show.html.haml
|
63
|
+
- lib/views/translations/translations.html.haml
|
64
|
+
- lib/views/translations/update.rjs
|
65
|
+
- routes.rb
|
66
|
+
- spec/assets/public/es/favicons/favicon1.gif
|
67
|
+
- spec/assets/public/es/images/icons/icon1.gif
|
68
|
+
- spec/assets/public/es/images/image1.gif
|
69
|
+
- spec/assets/public/favicons/favicon1.gif
|
70
|
+
- spec/assets/public/favicons/favicon2.gif
|
71
|
+
- spec/assets/public/images/icons/icon1.gif
|
72
|
+
- spec/assets/public/images/icons/icon2.gif
|
73
|
+
- spec/assets/public/images/image1.gif
|
74
|
+
- spec/assets/public/images/image2.gif
|
75
|
+
- spec/assets/public/images/promo/sfc08_140x400_3.gif
|
76
|
+
- spec/assets/views/test_view1.html.erb
|
77
|
+
- spec/assets/views/test_view2.html.erb
|
78
|
+
- spec/caching_spec.rb
|
79
|
+
- spec/controllers/locales_controller_spec.rb
|
80
|
+
- spec/controllers/locales_routing_spec.rb
|
81
|
+
- spec/controllers/translations_controller_spec.rb
|
82
|
+
- spec/controllers/translations_routing_spec.rb
|
83
|
+
- spec/database_spec.rb
|
84
|
+
- spec/i18n_ext_spec.rb
|
85
|
+
- spec/localize_spec.rb
|
86
|
+
- spec/localize_text_spec.rb
|
87
|
+
- spec/models/locale_spec.rb
|
88
|
+
- spec/models/translation_spec.rb
|
89
|
+
- spec/spec_helper.rb
|
90
|
+
- spec/translate_asset_spec.rb
|
91
|
+
- spec/translate_spec.rb
|
92
|
+
- tasks/i18n.rake
|
93
|
+
homepage: https://github.com/hecbuma/i18n_backend_database
|
94
|
+
licenses: []
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project: compass-bootstrap
|
113
|
+
rubygems_version: 1.8.6
|
114
|
+
signing_key:
|
115
|
+
specification_version: 3
|
116
|
+
summary: Cool utils and admin for I18n
|
117
|
+
test_files:
|
118
|
+
- spec/assets/public/es/favicons/favicon1.gif
|
119
|
+
- spec/assets/public/es/images/icons/icon1.gif
|
120
|
+
- spec/assets/public/es/images/image1.gif
|
121
|
+
- spec/assets/public/favicons/favicon1.gif
|
122
|
+
- spec/assets/public/favicons/favicon2.gif
|
123
|
+
- spec/assets/public/images/icons/icon1.gif
|
124
|
+
- spec/assets/public/images/icons/icon2.gif
|
125
|
+
- spec/assets/public/images/image1.gif
|
126
|
+
- spec/assets/public/images/image2.gif
|
127
|
+
- spec/assets/public/images/promo/sfc08_140x400_3.gif
|
128
|
+
- spec/assets/views/test_view1.html.erb
|
129
|
+
- spec/assets/views/test_view2.html.erb
|
130
|
+
- spec/caching_spec.rb
|
131
|
+
- spec/controllers/locales_controller_spec.rb
|
132
|
+
- spec/controllers/locales_routing_spec.rb
|
133
|
+
- spec/controllers/translations_controller_spec.rb
|
134
|
+
- spec/controllers/translations_routing_spec.rb
|
135
|
+
- spec/database_spec.rb
|
136
|
+
- spec/i18n_ext_spec.rb
|
137
|
+
- spec/localize_spec.rb
|
138
|
+
- spec/localize_text_spec.rb
|
139
|
+
- spec/models/locale_spec.rb
|
140
|
+
- spec/models/translation_spec.rb
|
141
|
+
- spec/spec_helper.rb
|
142
|
+
- spec/translate_asset_spec.rb
|
143
|
+
- spec/translate_spec.rb
|