1
Gemfile
1
Gemfile
@@ -53,6 +53,7 @@ gem 'pg_search'
|
||||
|
||||
gem 'ahoy_matey', '~> 1.2.1'
|
||||
gem 'groupdate' # group temporary data
|
||||
gem 'tolk' # Web interface for translations
|
||||
|
||||
gem 'browser'
|
||||
gem 'turnout'
|
||||
|
||||
@@ -344,6 +344,7 @@ GEM
|
||||
rspec-support (~> 3.4.0)
|
||||
rspec-support (3.4.1)
|
||||
ruby-progressbar (1.7.5)
|
||||
safe_yaml (1.0.4)
|
||||
sass (3.4.21)
|
||||
sass-rails (5.0.4)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
@@ -397,6 +398,9 @@ GEM
|
||||
thread_safe (0.3.5)
|
||||
tilt (2.0.2)
|
||||
tins (1.6.0)
|
||||
tolk (1.9.3)
|
||||
rails (>= 4.0, < 4.3)
|
||||
safe_yaml (>= 0.8.6)
|
||||
turbolinks (2.5.3)
|
||||
coffee-rails
|
||||
turnout (2.2.1)
|
||||
@@ -496,6 +500,7 @@ DEPENDENCIES
|
||||
social-share-button!
|
||||
spring
|
||||
spring-commands-rspec
|
||||
tolk
|
||||
turbolinks
|
||||
turnout
|
||||
uglifier (>= 1.3.0)
|
||||
|
||||
25
config/initializers/tolk.rb
Normal file
25
config/initializers/tolk.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
# encoding: utf-8
|
||||
|
||||
# Tolk config file. Generated on January 14, 2016 12:09
|
||||
# See github.com/tolk/tolk for more informations
|
||||
|
||||
Tolk.config do |config|
|
||||
|
||||
# If you need to add a mapping do it like this :
|
||||
# May we suggest you use http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
||||
# config.mapping['en-AU'] = 'English (Australia)'
|
||||
# config.mapping['es-MX'] = 'Spanish (Mexico)'
|
||||
# config.mapping['fr-ES'] = 'Frañol !'
|
||||
# config.mapping['is'] = 'Icelandic'
|
||||
# config.mapping['vi'] = 'Vietnamese'
|
||||
|
||||
# Master source of strings to be translated
|
||||
config.primary_locale_name = 'en'
|
||||
end
|
||||
|
||||
Tolk::ApplicationController.authenticator = proc {
|
||||
authenticate_or_request_with_http_basic do |username, password|
|
||||
username == Rails.application.secrets.translate_username &&
|
||||
password == Rails.application.secrets.translate_password
|
||||
end
|
||||
}
|
||||
@@ -280,6 +280,8 @@ Rails.application.routes.draw do
|
||||
mount LetterOpenerWeb::Engine, at: "/letter_opener"
|
||||
end
|
||||
|
||||
mount Tolk::Engine => '/translate', :as => 'tolk'
|
||||
|
||||
# static pages
|
||||
|
||||
get '/blog' => redirect("http://diario.madrid.es/participa/")
|
||||
|
||||
@@ -33,9 +33,12 @@ production: &production
|
||||
google_oauth2_key: ""
|
||||
google_oauth2_secret: ""
|
||||
|
||||
translate_username: ""
|
||||
translate_password: ""
|
||||
|
||||
rollbar_server_token: ""
|
||||
server_name: ""
|
||||
|
||||
preproduction:
|
||||
server_name: ""
|
||||
<<: *production
|
||||
<<: *production
|
||||
|
||||
38
db/migrate/20160114110933_create_tolk_tables.rb
Normal file
38
db/migrate/20160114110933_create_tolk_tables.rb
Normal file
@@ -0,0 +1,38 @@
|
||||
class CreateTolkTables < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :tolk_locales do |t|
|
||||
t.string :name
|
||||
t.datetime :created_at
|
||||
t.datetime :updated_at
|
||||
end
|
||||
|
||||
add_index :tolk_locales, :name, :unique => true
|
||||
|
||||
create_table :tolk_phrases do |t|
|
||||
t.text :key
|
||||
t.datetime :created_at
|
||||
t.datetime :updated_at
|
||||
end
|
||||
|
||||
create_table :tolk_translations do |t|
|
||||
t.integer :phrase_id
|
||||
t.integer :locale_id
|
||||
t.text :text
|
||||
t.text :previous_text
|
||||
t.boolean :primary_updated, :default => false
|
||||
t.datetime :created_at
|
||||
t.datetime :updated_at
|
||||
end
|
||||
|
||||
add_index :tolk_translations, [:phrase_id, :locale_id], :unique => true
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :tolk_translations, :column => [:phrase_id, :locale_id]
|
||||
remove_index :tolk_locales, :column => :name
|
||||
|
||||
drop_table :tolk_translations
|
||||
drop_table :tolk_phrases
|
||||
drop_table :tolk_locales
|
||||
end
|
||||
end
|
||||
28
db/schema.rb
28
db/schema.rb
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20160108133501) do
|
||||
ActiveRecord::Schema.define(version: 20160114110933) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -323,6 +323,32 @@ ActiveRecord::Schema.define(version: 20160108133501) do
|
||||
add_index "tags", ["proposals_count"], name: "index_tags_on_proposals_count", using: :btree
|
||||
add_index "tags", ["spending_proposals_count"], name: "index_tags_on_spending_proposals_count", using: :btree
|
||||
|
||||
create_table "tolk_locales", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "tolk_locales", ["name"], name: "index_tolk_locales_on_name", unique: true, using: :btree
|
||||
|
||||
create_table "tolk_phrases", force: :cascade do |t|
|
||||
t.text "key"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "tolk_translations", force: :cascade do |t|
|
||||
t.integer "phrase_id"
|
||||
t.integer "locale_id"
|
||||
t.text "text"
|
||||
t.text "previous_text"
|
||||
t.boolean "primary_updated", default: false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "tolk_translations", ["phrase_id", "locale_id"], name: "index_tolk_translations_on_phrase_id_and_locale_id", unique: true, using: :btree
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.string "email", default: ""
|
||||
t.string "encrypted_password", default: "", null: false
|
||||
|
||||
Reference in New Issue
Block a user