afalkear_translation_center 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +293 -0
- data/Rakefile +40 -0
- data/app/assets/images/translation_center/badr_it.png +0 -0
- data/app/assets/images/translation_center/loading.gif +0 -0
- data/app/assets/images/translation_center/translation_center_logo.png +0 -0
- data/app/assets/javascripts/translation_center/application.js +75 -0
- data/app/assets/javascripts/translation_center/bootstrap.js +2025 -0
- data/app/assets/javascripts/translation_center/categories.js +18 -0
- data/app/assets/javascripts/translation_center/center.js +55 -0
- data/app/assets/javascripts/translation_center/inspector.js.erb +59 -0
- data/app/assets/javascripts/translation_center/jquery-ui.js +14912 -0
- data/app/assets/javascripts/translation_center/jquery.jeditable.mini.js +38 -0
- data/app/assets/javascripts/translation_center/routes.js +15 -0
- data/app/assets/javascripts/translation_center/spin.min.js +1 -0
- data/app/assets/javascripts/translation_center/translation_keys.js +31 -0
- data/app/assets/javascripts/translation_center/translations.js +245 -0
- data/app/assets/stylesheets/translation_center/application.css +49 -0
- data/app/assets/stylesheets/translation_center/bootstrap.css +5894 -0
- data/app/assets/stylesheets/translation_center/categories.css +29 -0
- data/app/assets/stylesheets/translation_center/center.css +28 -0
- data/app/assets/stylesheets/translation_center/inspector.css +110 -0
- data/app/assets/stylesheets/translation_center/translation_keys.css +48 -0
- data/app/assets/stylesheets/translation_center/translations.css +32 -0
- data/app/controllers/translation_center/application_controller.rb +42 -0
- data/app/controllers/translation_center/categories_controller.rb +61 -0
- data/app/controllers/translation_center/center_controller.rb +67 -0
- data/app/controllers/translation_center/translation_keys_controller.rb +93 -0
- data/app/controllers/translation_center/translations_controller.rb +78 -0
- data/app/helpers/translation_center/application_helper.rb +58 -0
- data/app/helpers/translation_center/categories_helper.rb +4 -0
- data/app/helpers/translation_center/center_helper.rb +19 -0
- data/app/helpers/translation_center/translation_keys_helper.rb +4 -0
- data/app/helpers/translation_center/translations_helper.rb +4 -0
- data/app/models/translation_center/activity_query.rb +46 -0
- data/app/models/translation_center/category.rb +46 -0
- data/app/models/translation_center/translation.rb +94 -0
- data/app/models/translation_center/translation_key.rb +188 -0
- data/app/views/layouts/translation_center/application.html.haml +82 -0
- data/app/views/translation_center/categories/_category.html.haml +11 -0
- data/app/views/translation_center/categories/index.html.haml +7 -0
- data/app/views/translation_center/categories/keys.js.haml +10 -0
- data/app/views/translation_center/categories/show.html.haml +32 -0
- data/app/views/translation_center/categories/show.js.haml +7 -0
- data/app/views/translation_center/center/_activity.html.haml +49 -0
- data/app/views/translation_center/center/dashboard.html.haml +102 -0
- data/app/views/translation_center/center/manage.js.haml +3 -0
- data/app/views/translation_center/center/search_activity.js.haml +1 -0
- data/app/views/translation_center/errors/exception.html.haml +50 -0
- data/app/views/translation_center/translation_keys/_form.html.haml +18 -0
- data/app/views/translation_center/translation_keys/_show.html.haml +27 -0
- data/app/views/translation_center/translation_keys/_show_keys.html.haml +25 -0
- data/app/views/translation_center/translation_keys/_translation_keys.html.haml +16 -0
- data/app/views/translation_center/translation_keys/destroy.js.haml +4 -0
- data/app/views/translation_center/translation_keys/show.html.haml +8 -0
- data/app/views/translation_center/translation_keys/translations.js.haml +3 -0
- data/app/views/translation_center/translations/_accept_translation.html.haml +6 -0
- data/app/views/translation_center/translations/_index.html.haml +9 -0
- data/app/views/translation_center/translations/_search_results.html.haml +30 -0
- data/app/views/translation_center/translations/_show.html.haml +35 -0
- data/app/views/translation_center/translations/accept.js.haml +18 -0
- data/app/views/translation_center/translations/destroy.js.haml +11 -0
- data/app/views/translation_center/translations/search.html.haml +2 -0
- data/app/views/translation_center/translations/search.js.haml +1 -0
- data/app/views/translation_center/translations/unaccept.js.haml +9 -0
- data/app/views/translation_center/translations/unvote.js.haml +1 -0
- data/app/views/translation_center/translations/vote.js.haml +1 -0
- data/config/routes.rb +34 -0
- data/lib/afalkear_translation_center.rb +12 -0
- data/lib/generators/translation_center/USAGE +6 -0
- data/lib/generators/translation_center/add_lang/add_lang_generator.rb +31 -0
- data/lib/generators/translation_center/add_lang/templates/migrations/add_lang_status_translation_keys.rb +5 -0
- data/lib/generators/translation_center/install/install_generator.rb +38 -0
- data/lib/generators/translation_center/install/templates/assets/translation_center_logo.png +0 -0
- data/lib/generators/translation_center/install/templates/config/translation_center.yml +55 -0
- data/lib/generators/translation_center/install/templates/migrations/create_translation_center_categories.rb +9 -0
- data/lib/generators/translation_center/install/templates/migrations/create_translation_center_translation_keys.rb +16 -0
- data/lib/generators/translation_center/install/templates/migrations/create_translation_center_translations.rb +32 -0
- data/lib/tasks/translation_center.rake +56 -0
- data/lib/translation_center/acts_as_translator.rb +22 -0
- data/lib/translation_center/engine.rb +15 -0
- data/lib/translation_center/locale/en.yml +75 -0
- data/lib/translation_center/translation_helpers.rb +133 -0
- data/lib/translation_center/translations_transfer.rb +131 -0
- data/lib/translation_center/version.rb +3 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/images/translation_center_logo.png +0 -0
- data/test/dummy/app/assets/javascripts/application.js +16 -0
- data/test/dummy/app/assets/javascripts/articles.js +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +14 -0
- data/test/dummy/app/assets/stylesheets/articles.css +4 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/controllers/application_controller.rb +6 -0
- data/test/dummy/app/controllers/articles_controller.rb +85 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/articles_helper.rb +2 -0
- data/test/dummy/app/models/article.rb +7 -0
- data/test/dummy/app/models/user.rb +16 -0
- data/test/dummy/app/views/articles/_form.html.haml +16 -0
- data/test/dummy/app/views/articles/edit.html.haml +7 -0
- data/test/dummy/app/views/articles/index.html.haml +32 -0
- data/test/dummy/app/views/articles/new.html.haml +5 -0
- data/test/dummy/app/views/articles/show.html.haml +14 -0
- data/test/dummy/app/views/layouts/application.html.erb +15 -0
- data/test/dummy/config/application.rb +60 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +42 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/devise.rb +240 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/ar.yml +6 -0
- data/test/dummy/config/locales/de.yml +2 -0
- data/test/dummy/config/locales/devise.en.yml +59 -0
- data/test/dummy/config/locales/en.yml +361 -0
- data/test/dummy/config/routes.rb +10 -0
- data/test/dummy/config/translation_center.yml +58 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/migrate/20130410082611_devise_create_users.rb +46 -0
- data/test/dummy/db/migrate/20130410082701_create_articles.rb +10 -0
- data/test/dummy/db/migrate/20130410084711234392_create_translation_center_categories.rb +9 -0
- data/test/dummy/db/migrate/20130410084711235054_create_translation_center_translation_keys.rb +14 -0
- data/test/dummy/db/migrate/20130410084711235601_create_translation_center_translations.rb +13 -0
- data/test/dummy/db/migrate/20130410084711235602_install_audited.rb +28 -0
- data/test/dummy/db/migrate/20130410084711_acts_as_votable_migration.rb +23 -0
- data/test/dummy/db/migrate/20130410113111070575_add_de_status_translation_center_translation_keys.rb +5 -0
- data/test/dummy/db/migrate/20130417134539377014_add_ar_status_translation_center_translation_keys.rb +5 -0
- data/test/dummy/db/migrate/20130506103956_fix_translation_user_relation.rb +12 -0
- data/test/dummy/db/migrate/20130801102022_add_indicies.rb +8 -0
- data/test/dummy/db/schema.rb +110 -0
- data/test/dummy/log/test.log +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/spec/spec_helper.rb +38 -0
- data/test/dummy/test/fixtures/articles.yml +9 -0
- data/test/dummy/test/fixtures/posts.yml +9 -0
- data/test/dummy/test/fixtures/users.yml +11 -0
- data/test/dummy/test/functional/articles_controller_test.rb +49 -0
- data/test/dummy/test/functional/posts_controller_test.rb +49 -0
- data/test/dummy/test/unit/article_test.rb +7 -0
- data/test/dummy/test/unit/helpers/articles_helper_test.rb +4 -0
- data/test/dummy/test/unit/helpers/posts_helper_test.rb +4 -0
- data/test/dummy/test/unit/post_test.rb +7 -0
- data/test/dummy/test/unit/user_test.rb +7 -0
- data/test/fixtures/translation_center/categories.yml +7 -0
- data/test/fixtures/translation_center/translation_keys.yml +11 -0
- data/test/fixtures/translation_center/translations.yml +15 -0
- data/test/functional/translation_center/categories_controller_test.rb +51 -0
- data/test/functional/translation_center/center_controller_test.rb +9 -0
- data/test/functional/translation_center/translation_keys_controller_test.rb +51 -0
- data/test/functional/translation_center/translations_controller_test.rb +51 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- data/test/translation_center_test.rb +7 -0
- data/test/unit/helpers/translation_center/categories_helper_test.rb +6 -0
- data/test/unit/helpers/translation_center/center_helper_test.rb +6 -0
- data/test/unit/helpers/translation_center/translation_keys_helper_test.rb +6 -0
- data/test/unit/helpers/translation_center/translations_helper_test.rb +6 -0
- data/test/unit/translation_center/category_test.rb +9 -0
- data/test/unit/translation_center/translation_key_test.rb +9 -0
- data/test/unit/translation_center/translation_test.rb +9 -0
- metadata +418 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c7e797778fb7cc8e6df68b6e83084caafd16fc8d
|
4
|
+
data.tar.gz: 3e895fcbb80ad876ae8a129b101fcbfbc9640c7e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5a3be959ca721e763e9612c4be463a66c825d06cb0d1e80f11d8ea95b74baefd78c29c06b6b4559a66f9f6decc9ac3e079d2d2f9d0007b385f4874896a2a58f9
|
7
|
+
data.tar.gz: 1ddb30065206e20c6b9fc71629771f2e077d76c852c1c53422ec5e37b776509cb1640afd0fb23657e0e6c8189d7726060115708610e7f291d2793968c9f8a37d
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2012 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,293 @@
|
|
1
|
+
## Translation Center Status
|
2
|
+
[![Code Climate](https://codeclimate.com/github/BadrIT/translation_center.png)](https://codeclimate.com/github/BadrIT/translation_center)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/translation_center.png)](http://badge.fury.io/rb/translation_center)
|
4
|
+
[![Dependency Status](https://gemnasium.com/BadrIT/translation_center.png)](https://gemnasium.com/BadrIT/translation_center)
|
5
|
+
|
6
|
+
## Introduction
|
7
|
+
|
8
|
+
Translation Center is a multi lingual web engine for Rails 3 apps. It builds a translation center community with translators and admins from your system users.
|
9
|
+
|
10
|
+
![Alt text](https://raw.github.com/BadrIT/translation_center/master/samples/view_keys.png "View category translations")
|
11
|
+
|
12
|
+
## Translation Center can be used by:
|
13
|
+
|
14
|
+
###App Users
|
15
|
+
Contribute in translating your app in different locales using easy web interface.
|
16
|
+
|
17
|
+
###Rails Developers
|
18
|
+
Avoid updating many yaml files as you will just use the easy web interface to manage translations.
|
19
|
+
|
20
|
+
###Site Admin
|
21
|
+
Manage all app translations; collect stats, accept, add, edit, remove translations...etc
|
22
|
+
|
23
|
+
|
24
|
+
## Features
|
25
|
+
|
26
|
+
* Different roles: translators and admins
|
27
|
+
* Add new locales easily
|
28
|
+
* Support right-to-left and left-to-right translations
|
29
|
+
* Detect new translation keys in code and store them in DB for users to translate
|
30
|
+
* Inspect translation keys from your application view directly
|
31
|
+
* Import and Export translations in yaml format
|
32
|
+
* Switch translations backend between DB and yaml
|
33
|
+
* Admin dashboard for languages status and activity
|
34
|
+
* Users can vote up translations
|
35
|
+
* Default translation in English for keys
|
36
|
+
|
37
|
+
## Getting started
|
38
|
+
|
39
|
+
TranslationCenter works with Rails 3.1 onwards. You can add it to your Gemfile with:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
gem 'translation_center'
|
43
|
+
```
|
44
|
+
|
45
|
+
Run bundle install command.
|
46
|
+
|
47
|
+
TranslationCenter depends on Devise, so make sure you installed it successfully https://github.com/plataformatec/devise#starting-with-rails
|
48
|
+
|
49
|
+
After you install TranslationCenter and add it to your Gemfile, you need to run the generator:
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
rails generate translation_center:install en ar de
|
53
|
+
```
|
54
|
+
|
55
|
+
This will add three languages to the translation center, you need to add them in the config/translation_center.yaml
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
development:
|
59
|
+
lang:
|
60
|
+
en:
|
61
|
+
name: 'English'
|
62
|
+
direction: 'ltr'
|
63
|
+
ar:
|
64
|
+
name: 'Arabic'
|
65
|
+
direction: 'rtl'
|
66
|
+
de:
|
67
|
+
name: 'German'
|
68
|
+
direction: 'ltr'
|
69
|
+
```
|
70
|
+
|
71
|
+
if you don't supply languages for the generator it will support only English.
|
72
|
+
|
73
|
+
And run the migrations
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
rake db:migrate
|
77
|
+
```
|
78
|
+
|
79
|
+
Add this line to the translator model (typically `User`)
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
acts_as_translator
|
83
|
+
```
|
84
|
+
|
85
|
+
And then run this rake to get all current translations to the db
|
86
|
+
```ruby
|
87
|
+
rake translation_center:synch
|
88
|
+
```
|
89
|
+
|
90
|
+
and change the `translator_type` in `translation_center.yml` to the translator model name (if it is `User` keep it commented)
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
# tranlator_type: 'User'
|
94
|
+
```
|
95
|
+
|
96
|
+
In routes file add
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
mount TranslationCenter::Engine => "/translation_center"
|
100
|
+
```
|
101
|
+
|
102
|
+
By default, all users are admins, you need to define who is the translation center admin. Admin can accept translations, manage translation keys and do more things. To define your admin, you need to override User#can_admin_translations? method like the following....
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
def can_admin_translations?
|
106
|
+
self.email == 'admin@tc.com'
|
107
|
+
end
|
108
|
+
```
|
109
|
+
|
110
|
+
## How to use
|
111
|
+
|
112
|
+
Add new key to your views, for example:
|
113
|
+
|
114
|
+
```ruby
|
115
|
+
t('posts.index.title')
|
116
|
+
```
|
117
|
+
|
118
|
+
When you visit the page where this key is rendered, a new translation key will be stored with name 'index.title' under category 'posts'.
|
119
|
+
You then visit the TranslationCenter and translate the key (by default translations added by admins are considered accepted).
|
120
|
+
|
121
|
+
To migrate translations from TranslationCenter database to yaml files
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
rake translation_center:db2yaml
|
125
|
+
```
|
126
|
+
|
127
|
+
To migrate translations from yaml files to TranslationCenter database
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
rake translation_center:yaml2db
|
131
|
+
```
|
132
|
+
|
133
|
+
If you want to export or import just one locale, provide the locale as an attribute to the rakes, for example:
|
134
|
+
|
135
|
+
```ruby
|
136
|
+
rake translation_center:yaml2db[ar]
|
137
|
+
```
|
138
|
+
|
139
|
+
Or you could use the Controls section in the Dashboard page to run these rakes
|
140
|
+
|
141
|
+
![Alt text](https://raw.github.com/BadrIT/translation_center/master/samples/controls_shot.png "View category translations")
|
142
|
+
|
143
|
+
Imported translations should have a translator. You can edit translator identifier (usually email address) in `translation_center.yml` The rake task `yaml2db` will create this user if it doesn't exist.
|
144
|
+
|
145
|
+
```ruby
|
146
|
+
yaml_translator_identifier: 'coder@tc.com'
|
147
|
+
```
|
148
|
+
|
149
|
+
The imported translations status will be accepted by default. If you want to disable this, comment the following line in `translation_center.yaml`
|
150
|
+
|
151
|
+
```ruby
|
152
|
+
yaml2db_translations_accepted: true
|
153
|
+
```
|
154
|
+
|
155
|
+
You can control the translations source by changing the value of `i18n_source` in `translation_center.yaml`
|
156
|
+
|
157
|
+
```ruby
|
158
|
+
i18n_source: 'yaml' # can be db or yaml; default is yaml
|
159
|
+
```
|
160
|
+
|
161
|
+
##Without Devise
|
162
|
+
|
163
|
+
If your application doesn't use devise for authentication then you have to
|
164
|
+
provide helper named `current_user` that returns the current user in the session and a before_filter named `authenticate_user!` that redirects a user
|
165
|
+
to login page if not already signed in.
|
166
|
+
|
167
|
+
You also need to add these methods in an initialize, for example `translation_authentication.rb` :
|
168
|
+
```ruby
|
169
|
+
module TranslationCenter
|
170
|
+
class ApplicationController < ActionController::Base
|
171
|
+
|
172
|
+
# current_user is needed in views
|
173
|
+
helper_method :current_user
|
174
|
+
|
175
|
+
def authenticate_user!
|
176
|
+
# redirect to login if user not signed in
|
177
|
+
end
|
178
|
+
|
179
|
+
def current_user
|
180
|
+
# write code that returns the current user in session
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
184
|
+
end
|
185
|
+
```
|
186
|
+
|
187
|
+
**Email attribute:**
|
188
|
+
|
189
|
+
Translation Center assumes that the translator model (for example `User`) has an `email` attribute, this attribute is used when showing translations, activity log in dashboard and updating existing translations.
|
190
|
+
|
191
|
+
If your `User` model has no `email` attribute then change the `identifier_type` in your `translation_center.yml` to a unique attribute of your translator model (`User`), for example to use username instead of email:
|
192
|
+
|
193
|
+
```ruby
|
194
|
+
identifier_type: 'username' # Uncomment and change the identifier if your User model has no email attribute
|
195
|
+
```
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
##Inspector
|
200
|
+
|
201
|
+
Another nice option is the inspector that allows the users to go directly to the key from your application view.
|
202
|
+
Just set `inspector` option in `translation_center.yml` to `all` if you want to inspect all keys otherwise set it to `missing` to inspect only untranslated keys, and then add this line to your `application.css`
|
203
|
+
|
204
|
+
```ruby
|
205
|
+
*= require translation_center/inspector
|
206
|
+
```
|
207
|
+
|
208
|
+
and this line to your `application.js`
|
209
|
+
|
210
|
+
```ruby
|
211
|
+
//= require translation_center/inspector
|
212
|
+
```
|
213
|
+
|
214
|
+
Now when you reload your page you will see a small icon beside your keys.
|
215
|
+
|
216
|
+
![Alt text](https://raw.github.com/BadrIT/translation_center/master/samples/inspector_shot.png "Inspected keys")
|
217
|
+
|
218
|
+
In the previous image, if you click on the icon of 'Betrachten', you will be directed to the key page, where you can add/edit translations directly.
|
219
|
+
|
220
|
+
![Alt text](https://raw.github.com/BadrIT/translation_center/master/samples/inspector_visit_key.png "Visit a key from inspector")
|
221
|
+
|
222
|
+
|
223
|
+
##Add new language
|
224
|
+
|
225
|
+
If you want to add a language to the translation center, you need to run the generator:
|
226
|
+
|
227
|
+
```ruby
|
228
|
+
rails g translation_center:add_lang es fr
|
229
|
+
rake db:migrate
|
230
|
+
```
|
231
|
+
|
232
|
+
You will also need to add the language to config/translation_center.yml
|
233
|
+
|
234
|
+
```ruby
|
235
|
+
development:
|
236
|
+
lang:
|
237
|
+
en:
|
238
|
+
name: 'English'
|
239
|
+
direction: 'ltr'
|
240
|
+
ar:
|
241
|
+
name: 'Arabic'
|
242
|
+
direction: 'rtl'
|
243
|
+
de:
|
244
|
+
name: 'German'
|
245
|
+
direction: 'ltr'
|
246
|
+
```
|
247
|
+
|
248
|
+
##Screen Shots
|
249
|
+
|
250
|
+
When you visit `/translation_center` you will see the list of all categories and how many keys they have.
|
251
|
+
|
252
|
+
![Alt text](https://raw.github.com/BadrIT/translation_center/master/samples/categories_screen.png "Listing Categories")
|
253
|
+
|
254
|
+
Click on category to view all the keys, keys are divided into untranslated (has no translations), pending (has translations but not approved yet), translated (has accepted translations)
|
255
|
+
|
256
|
+
![Alt text](https://raw.github.com/BadrIT/translation_center/master/samples/view_keys.png "View a category")
|
257
|
+
|
258
|
+
|
259
|
+
Click on a key to view all translations for that key, then you can add or edit your translation for that key, users can also vote for translations.
|
260
|
+
|
261
|
+
![Alt text](https://raw.github.com/BadrIT/translation_center/master/samples/many_translations.png "View a translation key")
|
262
|
+
|
263
|
+
As an admin you can accept pending translations that have been added by other users, you can also edit and remove keys.
|
264
|
+
|
265
|
+
![Alt text](https://raw.github.com/BadrIT/translation_center/master/samples/accept_pending.png "Accept pending")
|
266
|
+
|
267
|
+
Admin also can view the dashboard to know the status of every language
|
268
|
+
|
269
|
+
![Alt text](https://raw.github.com/BadrIT/translation_center/master/samples/dashboard.png "Dashboard")
|
270
|
+
|
271
|
+
or monitor activity of changes to translations.
|
272
|
+
|
273
|
+
![Alt text](https://raw.github.com/BadrIT/translation_center/master/samples/activity.png "Activity")
|
274
|
+
|
275
|
+
##Video
|
276
|
+
|
277
|
+
Watch it on YouTube.
|
278
|
+
http://www.youtube.com/watch?v=BTy6ZI31JmU
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
## Credits
|
283
|
+
|
284
|
+
![BadrIT](http://www.badrit.com/images/logo-main.png)
|
285
|
+
|
286
|
+
Translation Center is maintained and developed by [BadrIT](http://badrit.com/)
|
287
|
+
|
288
|
+
## Support
|
289
|
+
|
290
|
+
Help us make this engine better by submitting any bugs or enhancments in the issues page for this project.
|
291
|
+
We also added an error page that will appear to you if any error goes with translation_center.
|
292
|
+
|
293
|
+
![Alt text](https://raw.github.com/BadrIT/translation_center/master/samples/support.png "Support")
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'TranslationCenter'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.md')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
Bundler::GemHelper.install_tasks
|
29
|
+
|
30
|
+
require 'rake/testtask'
|
31
|
+
|
32
|
+
Rake::TestTask.new(:test) do |t|
|
33
|
+
t.libs << 'lib'
|
34
|
+
t.libs << 'test'
|
35
|
+
t.pattern = 'test/**/*_test.rb'
|
36
|
+
t.verbose = false
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
task :default => :test
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,75 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require_tree .
|
16
|
+
|
17
|
+
|
18
|
+
function Category() {
|
19
|
+
}
|
20
|
+
|
21
|
+
Category.key = function() {
|
22
|
+
return $('#category_key').val();
|
23
|
+
}
|
24
|
+
|
25
|
+
function Filter() {
|
26
|
+
}
|
27
|
+
|
28
|
+
Filter.key = function() {
|
29
|
+
return $('#current_filter').val();
|
30
|
+
}
|
31
|
+
|
32
|
+
function capitaliseFirstLetter(string)
|
33
|
+
{
|
34
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
35
|
+
}
|
36
|
+
|
37
|
+
var spinner_params = {
|
38
|
+
lines: 13, // The number of lines to draw
|
39
|
+
length: 0, // The length of each line
|
40
|
+
width: 4, // The line thickness
|
41
|
+
radius: 14, // The radius of the inner circle
|
42
|
+
corners: 1, // Corner roundness (0..1)
|
43
|
+
rotate: 33, // The rotation offset
|
44
|
+
direction: 1, // 1: clockwise, -1: counterclockwise
|
45
|
+
color: '#000', // #rgb or #rrggbb
|
46
|
+
speed: 1.1, // Rounds per second
|
47
|
+
trail: 41, // Afterglow percentage
|
48
|
+
shadow: false, // Whether to render a shadow
|
49
|
+
hwaccel: false, // Whether to use hardware acceleration
|
50
|
+
className: 'spinner', // The CSS class to assign to the spinner
|
51
|
+
zIndex: 2e9, // The z-index (defaults to 2000000000)
|
52
|
+
top: 'auto', // Top position relative to parent in px
|
53
|
+
left: 'auto' // Left position relative to parent in px
|
54
|
+
};
|
55
|
+
|
56
|
+
$(document).ready(function(){
|
57
|
+
|
58
|
+
$('.dropdown-toggle').dropdown()
|
59
|
+
|
60
|
+
// search for key with that name and jump to it when clicked
|
61
|
+
$('#search_keys').typeahead({
|
62
|
+
// note that "value" is the default setting for the property option
|
63
|
+
source: function (query, process) {
|
64
|
+
return $.get(Routes['translation_center_search_translation_keys_path'] + '.json', { query: query }, function (data) {
|
65
|
+
return process(data);
|
66
|
+
});
|
67
|
+
},
|
68
|
+
updater: function(item) {
|
69
|
+
document.location = Routes['translation_center_search_translation_keys_path'] + '?search_key_name=' + item
|
70
|
+
}
|
71
|
+
|
72
|
+
});
|
73
|
+
|
74
|
+
|
75
|
+
});
|