Translations
This commit is contained in:
parent
cc948937bc
commit
52e5e10232
8
Gemfile
8
Gemfile
@ -21,7 +21,7 @@ gem 'pg'
|
|||||||
|
|
||||||
# Security
|
# Security
|
||||||
# gem 'secure_headers'
|
# gem 'secure_headers'
|
||||||
gem 'dotenv-rails', :groups => [:development, :test]
|
#gem 'dotenv-rails', :groups => [:development, :test]
|
||||||
|
|
||||||
# Miscellanea
|
# Miscellanea
|
||||||
# gem 'google-analytics-rails'
|
# gem 'google-analytics-rails'
|
||||||
@ -43,7 +43,7 @@ gem 'jquery-turbolinks'
|
|||||||
gem 'sass-rails', '~> 4.0.0'
|
gem 'sass-rails', '~> 4.0.0'
|
||||||
gem "compass-rails", "~> 1.1.3"
|
gem "compass-rails", "~> 1.1.3"
|
||||||
gem 'foundation-rails'
|
gem 'foundation-rails'
|
||||||
gem 'turbolinks'
|
#gem 'turbolinks' # This would be great to have working, right now lets focus on gettting it working without it.
|
||||||
gem 'uglifier', '>= 1.3.0'
|
gem 'uglifier', '>= 1.3.0'
|
||||||
gem 'sorcery', '>= 0.8.1'
|
gem 'sorcery', '>= 0.8.1'
|
||||||
gem 'oauth2', '~> 0.8.0'
|
gem 'oauth2', '~> 0.8.0'
|
||||||
@ -52,7 +52,9 @@ gem 'redis'
|
|||||||
gem 'carrierwave'
|
gem 'carrierwave'
|
||||||
gem 'carrierwave-imageoptimizer'
|
gem 'carrierwave-imageoptimizer'
|
||||||
gem 'mini_magick'
|
gem 'mini_magick'
|
||||||
#gem 'carmen', :path => '../carmen /'
|
if File.directory?('../carmen/')
|
||||||
|
gem 'carmen', :path => '../carmen/', require: false
|
||||||
|
end
|
||||||
gem 'carmen-rails'
|
gem 'carmen-rails'
|
||||||
gem 'nested_form'
|
gem 'nested_form'
|
||||||
gem 'acts_as_list'
|
gem 'acts_as_list'
|
||||||
|
17
Gemfile.lock
17
Gemfile.lock
@ -12,6 +12,11 @@ GIT
|
|||||||
i18n-active_record (0.0.2)
|
i18n-active_record (0.0.2)
|
||||||
i18n (>= 0.5.0)
|
i18n (>= 0.5.0)
|
||||||
|
|
||||||
|
PATH
|
||||||
|
remote: ../carmen/
|
||||||
|
specs:
|
||||||
|
carmen (1.0.1)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: http://rubygems.org/
|
remote: http://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
@ -66,8 +71,6 @@ GEM
|
|||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
rack-test (>= 0.5.4)
|
rack-test (>= 0.5.4)
|
||||||
xpath (~> 2.0)
|
xpath (~> 2.0)
|
||||||
carmen (1.0.1)
|
|
||||||
unicode_utils (~> 1.4.0)
|
|
||||||
carmen-rails (1.0.1)
|
carmen-rails (1.0.1)
|
||||||
carmen (~> 1.0.0)
|
carmen (~> 1.0.0)
|
||||||
rails
|
rails
|
||||||
@ -124,11 +127,6 @@ GEM
|
|||||||
chronic
|
chronic
|
||||||
diff-lcs (1.2.5)
|
diff-lcs (1.2.5)
|
||||||
docile (1.1.3)
|
docile (1.1.3)
|
||||||
dotenv (0.11.1)
|
|
||||||
dotenv-deployment (~> 0.0.2)
|
|
||||||
dotenv-deployment (0.0.2)
|
|
||||||
dotenv-rails (0.11.1)
|
|
||||||
dotenv (= 0.11.1)
|
|
||||||
email_spec (1.5.0)
|
email_spec (1.5.0)
|
||||||
launchy (~> 2.1)
|
launchy (~> 2.1)
|
||||||
mail (~> 2.2)
|
mail (~> 2.2)
|
||||||
@ -340,14 +338,12 @@ GEM
|
|||||||
uglifier (2.5.0)
|
uglifier (2.5.0)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
json (>= 1.8.0)
|
json (>= 1.8.0)
|
||||||
unicode_utils (1.4.0)
|
|
||||||
uniform_notifier (1.4.0)
|
uniform_notifier (1.4.0)
|
||||||
wdm (0.1.0)
|
wdm (0.1.0)
|
||||||
webmock (1.17.4)
|
webmock (1.17.4)
|
||||||
addressable (>= 2.2.7)
|
addressable (>= 2.2.7)
|
||||||
crack (>= 0.3.2)
|
crack (>= 0.3.2)
|
||||||
websocket (1.0.7)
|
websocket (1.0.7)
|
||||||
win32console (1.3.2)
|
|
||||||
win32console (1.3.2-x86-mingw32)
|
win32console (1.3.2-x86-mingw32)
|
||||||
xpath (2.0.0)
|
xpath (2.0.0)
|
||||||
nokogiri (~> 1.3)
|
nokogiri (~> 1.3)
|
||||||
@ -363,6 +359,7 @@ DEPENDENCIES
|
|||||||
binding_of_caller
|
binding_of_caller
|
||||||
bullet
|
bullet
|
||||||
capybara
|
capybara
|
||||||
|
carmen!
|
||||||
carmen-rails
|
carmen-rails
|
||||||
carrierwave
|
carrierwave
|
||||||
carrierwave-imageoptimizer
|
carrierwave-imageoptimizer
|
||||||
@ -372,7 +369,6 @@ DEPENDENCIES
|
|||||||
database_cleaner
|
database_cleaner
|
||||||
debugger
|
debugger
|
||||||
delorean
|
delorean
|
||||||
dotenv-rails
|
|
||||||
email_spec
|
email_spec
|
||||||
eventmachine
|
eventmachine
|
||||||
factory_girl_rails
|
factory_girl_rails
|
||||||
@ -407,7 +403,6 @@ DEPENDENCIES
|
|||||||
selenium-webdriver
|
selenium-webdriver
|
||||||
simplecov
|
simplecov
|
||||||
sorcery (>= 0.8.1)
|
sorcery (>= 0.8.1)
|
||||||
turbolinks
|
|
||||||
uglifier (>= 1.3.0)
|
uglifier (>= 1.3.0)
|
||||||
wdm (>= 0.1.0)
|
wdm (>= 0.1.0)
|
||||||
webmock
|
webmock
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#= require jquery
|
#= require jquery
|
||||||
#= require jquery_ujs
|
#= require jquery_ujs
|
||||||
#= require jquery.ui.sortable
|
#= require jquery.ui.sortable
|
||||||
#= require jquery.turbolinks
|
# = #require jquery.turbolinks
|
||||||
#= require turbolinks
|
# = #require turbolinks
|
||||||
#= require foundation
|
#= require foundation
|
||||||
|
|
||||||
# FRONT END
|
# FRONT END
|
||||||
@ -123,6 +123,50 @@ updateFormFieldList = () ->
|
|||||||
updateFormFieldList()
|
updateFormFieldList()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
saveTranslation = ($td, $move_to, auto_translate) ->
|
||||||
|
val = ''
|
||||||
|
do_auto_translate = true
|
||||||
|
if typeof auto_translate == "undefined" || !auto_translate
|
||||||
|
val = $td.find('textarea').val()
|
||||||
|
do_auto_translate = false
|
||||||
|
key = $td.parent().data().key
|
||||||
|
params = {translationkey: key, translationvalue: val, translationlang: window.location.href.replace(/^.*\/(\w+)\/$/, '$1')}
|
||||||
|
if do_auto_translate
|
||||||
|
params['auto_translate'] = true
|
||||||
|
$.post '/translate/', params,
|
||||||
|
(json) ->
|
||||||
|
#console.log json
|
||||||
|
$td.html(json.translation)
|
||||||
|
if $td.parent().hasClass('not-exists')
|
||||||
|
$td.parent().removeClass('not-exists')
|
||||||
|
$td.parent().addClass('exists')
|
||||||
|
$('.translation-form').remove()
|
||||||
|
if typeof $move_to != "undefined" && $move_to
|
||||||
|
startTranslating $move_to
|
||||||
|
return
|
||||||
|
return
|
||||||
|
|
||||||
|
stopTranslating = () -> $('.translation-form').remove()
|
||||||
|
|
||||||
|
startTranslating = ($td) ->
|
||||||
|
stopTranslating()
|
||||||
|
value = if $td.parent().hasClass('not-exists') then '' else $td.html().trim()
|
||||||
|
$tr = $td.parent()
|
||||||
|
key = $tr.data().key
|
||||||
|
$td.append('<div class="translation-form"><textarea>' + value + '</textarea><button class="small" data-key="' + key + '">Save</textarea>')
|
||||||
|
$textarea = $td.find('textarea')
|
||||||
|
$textarea.select()
|
||||||
|
$td.find('.translation-form button').click () -> saveTranslation($td)
|
||||||
|
$textarea.keydown (event) ->
|
||||||
|
if event.keyCode == 9
|
||||||
|
event.preventDefault()
|
||||||
|
$new_tr = if event.shiftKey then $tr.prev() else $tr.next()
|
||||||
|
saveTranslation $td, $new_tr.find('.value')
|
||||||
|
else if event.keyCode == 27
|
||||||
|
stopTranslating()
|
||||||
|
return
|
||||||
|
return
|
||||||
|
|
||||||
$ ->
|
$ ->
|
||||||
$(document).foundation();
|
$(document).foundation();
|
||||||
$('.field.country-select select').change () ->
|
$('.field.country-select select').change () ->
|
||||||
@ -169,3 +213,16 @@ $ ->
|
|||||||
# (json) ->
|
# (json) ->
|
||||||
# console.log json
|
# console.log json
|
||||||
#, 'json'
|
#, 'json'
|
||||||
|
$('table#translations td.value').click () ->
|
||||||
|
$this = $(this)
|
||||||
|
if !$this.find('.translation-form').length
|
||||||
|
startTranslating($this)
|
||||||
|
if $('table#translations').length
|
||||||
|
$(document).click (event) ->
|
||||||
|
$target = $(event.target)
|
||||||
|
if $target.closest('table#translations').length < 1 && !$target.hasClass('auto-translate')
|
||||||
|
stopTranslating()
|
||||||
|
$('.auto-translate').click (event) ->
|
||||||
|
event.preventDefault()
|
||||||
|
$td = $(this).parent()
|
||||||
|
saveTranslation($td, null, true)
|
@ -22,3 +22,4 @@
|
|||||||
// Local settings (also edit foundation_and_overrides.scss to modify global variables)
|
// Local settings (also edit foundation_and_overrides.scss to modify global variables)
|
||||||
@import "sass/layout";
|
@import "sass/layout";
|
||||||
@import "sass/typography";
|
@import "sass/typography";
|
||||||
|
@import "sass/base";
|
||||||
|
88
app/assets/stylesheets/sass/_base.scss
Normal file
88
app/assets/stylesheets/sass/_base.scss
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
table#translations {
|
||||||
|
td.value {
|
||||||
|
position: relative;
|
||||||
|
cursor: text;
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
.translation-form {
|
||||||
|
color: $white;
|
||||||
|
background-color: $body-font-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.not-exists {
|
||||||
|
td.value {
|
||||||
|
font-style: italic;
|
||||||
|
color: lighten($body-font-color, 45);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.translation-form {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 10;
|
||||||
|
padding: inherit;
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
height: 100%;
|
||||||
|
font-size: inherit;
|
||||||
|
padding: 0;
|
||||||
|
color: inherit;
|
||||||
|
background-color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
right: 100%;
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.auto-translate {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid.links {
|
||||||
|
li > a {
|
||||||
|
display: block;
|
||||||
|
background-color: $color-5;
|
||||||
|
color: $white;
|
||||||
|
padding: 1em;
|
||||||
|
min-height: 7em;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: $color-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.tags,
|
||||||
|
.tags > ul {
|
||||||
|
display: inline;
|
||||||
|
list-style: none;
|
||||||
|
font-size: 0.9em;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tags {
|
||||||
|
li {
|
||||||
|
display: inline-block;
|
||||||
|
background-color: $black;
|
||||||
|
color: $white;
|
||||||
|
padding: 0 0.5em;
|
||||||
|
margin: 0.6em 0 0 0.3em;
|
||||||
|
}
|
||||||
|
h5 {
|
||||||
|
float: left;
|
||||||
|
color: lighten($body-font-color, 10);
|
||||||
|
}
|
||||||
|
}
|
@ -379,3 +379,13 @@ body.organizations-show {
|
|||||||
text-align: inherit;
|
text-align: inherit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
td {
|
||||||
|
vertical-align: top;
|
||||||
|
|
||||||
|
&.primary {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -14,7 +14,13 @@ class PagesController < ApplicationController
|
|||||||
def translate
|
def translate
|
||||||
key = params[:translationkey]
|
key = params[:translationkey]
|
||||||
value = params[:translationvalue]
|
value = params[:translationvalue]
|
||||||
if params[:translationhascount] == '1'
|
if params[:auto_translate]
|
||||||
|
if params[:translationlang] == 'en'
|
||||||
|
value = I18n::MissingTranslationExceptionHandler.note(key)
|
||||||
|
else
|
||||||
|
value = I18n.backend.request_translation(key, {}, {fallback: true, locale: params[:translationlang]})
|
||||||
|
end
|
||||||
|
elsif params[:translationhascount] == '1'
|
||||||
['zero', 'one', 'two', 'few', 'many'].each { |c|
|
['zero', 'one', 'two', 'few', 'many'].each { |c|
|
||||||
if params['translationpluralization_' + c]
|
if params['translationpluralization_' + c]
|
||||||
if !value.is_a?(Hash)
|
if !value.is_a?(Hash)
|
||||||
@ -34,18 +40,46 @@ class PagesController < ApplicationController
|
|||||||
end
|
end
|
||||||
store_translations(params[:translationlang], {key => value}, :escape => false)
|
store_translations(params[:translationlang], {key => value}, :escape => false)
|
||||||
begin
|
begin
|
||||||
render json: {success: true, key: key, jkey: key.gsub('.', '--'), translation: I18n.translate!(key, {:raise => false})}
|
render json: {success: true, key: key, jkey: key.gsub('.', '--'), translation: I18n.translate(key, {:raise => false, :locale => params[:translationlang].to_sym})}
|
||||||
rescue
|
rescue
|
||||||
render json: {error: 'Failed to load translation'}
|
render json: {error: 'Failed to load translation'}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def location_territories
|
def location_territories
|
||||||
#render json: (Carmen:::RegionCollection.new(Carmen::Country.coded(params[:country])) || []).to_json
|
#render json: (Carmen:::RegionCollection.new(Carmen::Country.coded(params[:country])) || []).to_json
|
||||||
territories = {}
|
territories = {}
|
||||||
Carmen::Country.coded(params[:country]).subregions.each { |t| territories[t.code] = t.name }
|
Carmen::Country.coded(params[:country]).subregions.each { |t| territories[t.code] = t.name }
|
||||||
render json: territories.to_json
|
render json: territories.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def translations
|
||||||
|
@lang = params[:lang]
|
||||||
|
@translations = I18n.backend.get_translation_info
|
||||||
|
I18n.config.enforce_available_locales = false
|
||||||
|
end
|
||||||
|
|
||||||
|
def translation_list
|
||||||
|
total = 0
|
||||||
|
complete = 0
|
||||||
|
@completeness = Hash.new
|
||||||
|
translation_info = I18n.backend.get_translation_info()
|
||||||
|
translation_info.each { |k,v|
|
||||||
|
#total += 1
|
||||||
|
#complete += v['languages'].include?(lang.to_s) ? 1 : 0
|
||||||
|
v['languages'].each { |l|
|
||||||
|
@completeness[l] ||= 0
|
||||||
|
@completeness[l] += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#@test = total ? complete / total : 0
|
||||||
|
@total_translations = translation_info.size()
|
||||||
|
@language_codes = I18n.backend.get_language_codes().select { |s| s }.sort{ | a1, a2 |
|
||||||
|
c2 = @completeness.has_key?(a2.to_s) ? @completeness[a2.to_s] : 0
|
||||||
|
c1 = @completeness.has_key?(a1.to_s) ? @completeness[a1.to_s] : 0
|
||||||
|
c1 == c2 ? a1 <=> a2 : c2 <=> c1
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def store_translations(locale, data, options = {})
|
def store_translations(locale, data, options = {})
|
||||||
|
@ -60,98 +60,82 @@ module ApplicationHelper
|
|||||||
content_for?(section) ? content_for(section) : default
|
content_for?(section) ? content_for(section) : default
|
||||||
end
|
end
|
||||||
|
|
||||||
def _lorem_ipsum(method, size)
|
def _(key, behavior = nil, behavior_size = nil, locale: nil, vars: {}, html: nil, blockData: {}, &block)
|
||||||
options = {:random => true}
|
options = vars
|
||||||
case method.to_s
|
options[:fallback] = true
|
||||||
when 'c', 'char', 'character', 'characters'
|
if behavior
|
||||||
if size
|
options[:behavior] = behavior
|
||||||
return Forgery::LoremIpsum.characters size, options
|
options[:behavior_size] = behavior_size
|
||||||
end
|
|
||||||
return Forgery::LoremIpsum.character, options
|
|
||||||
when 'w', 'word', 'words'
|
|
||||||
if size
|
|
||||||
return Forgery::LoremIpsum.words size, options
|
|
||||||
end
|
|
||||||
#return'LOREM'
|
|
||||||
return Forgery::LoremIpsum.word options
|
|
||||||
when 's', 'sentence', 'sentences'
|
|
||||||
if size
|
|
||||||
return Forgery::LoremIpsum.sentences size, options
|
|
||||||
end
|
|
||||||
return Forgery::LoremIpsum.sentence options
|
|
||||||
when 'p', 'paragraph', 'paragraphs'
|
|
||||||
if size
|
|
||||||
return Forgery::LoremIpsum.paragraphs size, options.merge({:sentences => 10})
|
|
||||||
end
|
|
||||||
return Forgery::LoremIpsum.sentences 10, options
|
|
||||||
when 't', 'title'
|
|
||||||
return Forgery::LoremIpsum.sentences 1, options
|
|
||||||
end
|
end
|
||||||
return nil
|
if locale
|
||||||
end
|
options[:locale] = locale.to_sym
|
||||||
|
end
|
||||||
def _(key, behavior = nil, behavior_size = nil, vars: {}, html: nil, blockData: {}, &block)
|
#if vars
|
||||||
|
# puts "\nVARS:\t#{vars}\n"
|
||||||
|
#end
|
||||||
|
I18n.translate(key, options)
|
||||||
|
|
||||||
queued_keys = nil
|
#queued_keys = nil
|
||||||
result = nil
|
# #result = nil
|
||||||
|
#
|
||||||
if key.kind_of?(Hash)
|
# #if key.kind_of?(Hash)
|
||||||
blockData.merge!(key)
|
# # blockData.merge!(key)
|
||||||
key = key.keys
|
# # key = key.keys
|
||||||
end
|
# #end
|
||||||
|
#
|
||||||
if block_given?
|
# #if block_given?
|
||||||
@@keyQueue ||= Array.new
|
# # @@keyQueue ||= Array.new
|
||||||
|
#
|
||||||
if key.kind_of?(Array)
|
# # if key.kind_of?(Array)
|
||||||
@@keyQueue += key
|
# # @@keyQueue += key
|
||||||
else
|
# # else
|
||||||
@@keyQueue << key
|
# # @@keyQueue << key
|
||||||
end
|
# # end
|
||||||
end
|
# #end
|
||||||
|
#
|
||||||
if key.kind_of?(Array)
|
# #if key.kind_of?(Array)
|
||||||
new_key = key.shift
|
# # new_key = key.shift
|
||||||
if key.count > 0
|
# # if key.count > 0
|
||||||
queued_keys = key.dup
|
# # queued_keys = key.dup
|
||||||
end
|
# # end
|
||||||
key = new_key
|
# # key = new_key
|
||||||
end
|
# #end
|
||||||
|
#
|
||||||
if blockData[key]
|
# #if blockData[key]
|
||||||
behavior = blockData[key][:behavior] || nil
|
# # behavior = blockData[key][:behavior] || nil
|
||||||
behavior_size = blockData[key][:behavior_size] || nil
|
# # behavior_size = blockData[key][:behavior_size] || nil
|
||||||
vars = blockData[key][:vars] || {}
|
# # vars = blockData[key][:vars] || {}
|
||||||
end
|
# #end
|
||||||
|
#
|
||||||
@@lastTranslation = nil
|
# #@@lastTranslation = nil
|
||||||
generate_control = _can_translate?
|
# #generate_control = _can_translate?
|
||||||
|
#
|
||||||
translation = _do_translate(key, vars, behavior, behavior_size)
|
# #puts "\nLLOOCCAALLEE:\t#{locale.to_s}"
|
||||||
|
# #translation = _do_translate(key, vars, behavior, behavior_size, locale)
|
||||||
if block_given?
|
#
|
||||||
html = capture(&block)
|
# #if block_given?
|
||||||
end
|
# # html = capture(&block)
|
||||||
|
# #end
|
||||||
if html
|
#
|
||||||
translation['html'] = html.gsub('%' + key + '%', translation['untranslated'])
|
# #if html
|
||||||
end
|
# # translation['html'] = html.gsub('%' + key + '%', translation['untranslated'])
|
||||||
|
# #end
|
||||||
if generate_control
|
#
|
||||||
@@lastTranslation = translation
|
# #if generate_control
|
||||||
@@allTranslations ||= Hash.new
|
# # @@lastTranslation = translation
|
||||||
@@allTranslations[key] = key
|
# # @@allTranslations ||= Hash.new
|
||||||
|
# # @@allTranslations[key] = key
|
||||||
result = _translate_me(translation)
|
#
|
||||||
end
|
# # result = _translate_me(translation)
|
||||||
|
# #end
|
||||||
result ||= translation['html'] || translation['untranslated']
|
#
|
||||||
|
# #result ||= translation['html'] || (behavior.to_s == 'strict' ? nil : translation['untranslated'])
|
||||||
if queued_keys
|
#
|
||||||
return _ queued_keys, behavior, behavior_size, vars: vars, html: result, blockData: blockData
|
# #if queued_keys
|
||||||
end
|
# # return _ queued_keys, behavior, behavior_size, vars: vars, html: result, blockData: blockData
|
||||||
|
# #end
|
||||||
return result
|
#
|
||||||
|
#return result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _translate_me(translation)
|
def _translate_me(translation)
|
||||||
@ -161,27 +145,39 @@ module ApplicationHelper
|
|||||||
('<span class="translate-me ' + (translation['is_translated'] ? '' : 'un') + 'translated lang-' + (translation['lang']) + ' key--' + translation['key'].gsub('.', '--') + '" data-translate-key="' + translation['key'] + '" data-translate-untranslated="' + translation['untranslated'].gsub('"', '"') + (translation['translated'] ? '" data-translate-translated="' + translation['translated'] : '') + '" data-vars="' + (translation['vars'].length ? translation['vars'].to_json.gsub('"', '"') : '') + '" title="' + ('translate.alt_click') + '">' + (translation['html'] || translation['untranslated']) + '</span>').to_s.html_safe
|
('<span class="translate-me ' + (translation['is_translated'] ? '' : 'un') + 'translated lang-' + (translation['lang']) + ' key--' + translation['key'].gsub('.', '--') + '" data-translate-key="' + translation['key'] + '" data-translate-untranslated="' + translation['untranslated'].gsub('"', '"') + (translation['translated'] ? '" data-translate-translated="' + translation['translated'] : '') + '" data-vars="' + (translation['vars'].length ? translation['vars'].to_json.gsub('"', '"') : '') + '" title="' + ('translate.alt_click') + '">' + (translation['html'] || translation['untranslated']) + '</span>').to_s.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def _do_translate(key, vars, behavior, behavior_size)
|
def _do_translate(key, vars, behavior, behavior_size, locale)
|
||||||
translation = {'key' => key, 'lang' => '0', 'vars' => vars}
|
translation = {'key' => key, 'lang' => '0', 'vars' => vars}
|
||||||
v = vars.dup
|
v = vars.dup
|
||||||
|
#locale ||= I18n.locale
|
||||||
begin
|
begin
|
||||||
v[:raise] = true
|
v[:raise] = true
|
||||||
translation['untranslated'] = I18n.translate!(key, v)
|
#v[:locale] = locale.to_sym
|
||||||
translation['lang'] = I18n.locale.to_s
|
#v[:fallback] = false
|
||||||
|
#puts "\nSTART\n"
|
||||||
|
options = {:raise => true}
|
||||||
|
if locale
|
||||||
|
options[:locale] = locale.to_sym
|
||||||
|
end
|
||||||
|
#puts "\n#{options.to_json.to_s}\n"
|
||||||
|
translation['untranslated'] = I18n.translate(key, v, options)
|
||||||
|
#puts "\nEND\n"
|
||||||
|
translation['lang'] = locale.to_s
|
||||||
translation['is_translated'] = true
|
translation['is_translated'] = true
|
||||||
|
|
||||||
hash = Hash.new
|
hash = Hash.new
|
||||||
translations = Translation.where(["locale = ? AND key LIKE ?", I18n.locale, key + '%']).take(6).each { |o| hash[o.key] = o.value }
|
translations = Translation.where(["locale = ? AND key LIKE ?", locale.to_s, key + '%']).take(6).each { |o| hash[o.key] = o.value }
|
||||||
translation['translated'] = hash.to_json.gsub('"', '"')
|
translation['translated'] = hash.to_json.gsub('"', '"')
|
||||||
rescue I18n::MissingTranslationData
|
rescue I18n::MissingTranslationData
|
||||||
begin
|
#begin
|
||||||
translation['untranslated'] = I18n.translate!(config.i18n.default_locale, key, vars)
|
#translation['untranslated'] = I18n.translate!(config.i18n.default_locale, key, vars)
|
||||||
translation['lang'] = config.i18n.default_locale.to_s
|
#translation['lang'] = config.i18n.default_locale.to_s
|
||||||
rescue
|
#rescue
|
||||||
default_translation = I18n::MissingTranslationExceptionHandler.note(key, behavior, behavior_size)
|
#puts "BEHAVIOR:\t#{behavior.to_s}"
|
||||||
translation['untranslated'] = default_translation
|
default_translation = I18n::MissingTranslationExceptionHandler.note(key, behavior, behavior_size)
|
||||||
end
|
translation['untranslated'] = default_translation
|
||||||
|
#end
|
||||||
end
|
end
|
||||||
|
puts "TRANSLATION:\t#{translation.to_json.to_s}"
|
||||||
return translation
|
return translation
|
||||||
end
|
end
|
||||||
|
|
||||||
|
22
app/views/pages/translation_list.html.haml
Normal file
22
app/views/pages/translation_list.html.haml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
.row
|
||||||
|
%h1
|
||||||
|
= _ 'languages.list'
|
||||||
|
%h2
|
||||||
|
= _ 'languages.active'
|
||||||
|
%ul.languages.active.small-block-grid-1.medium-block-grid-3.large-block-grid-4.grid.links
|
||||||
|
- @language_codes.each do |code|
|
||||||
|
- if code && @completeness.has_key?(code.to_s)
|
||||||
|
%li.text-center
|
||||||
|
%a{:href => "/translations/#{code}/"}
|
||||||
|
%h3=_"languages.#{code}"
|
||||||
|
- completeness = @completeness[code.to_s]
|
||||||
|
- percent = @total_translations ? ((completeness / @total_translations.to_f) * 100).round() : 0
|
||||||
|
.completeness
|
||||||
|
= "#{completeness} / #{@total_translations} (#{percent}%)"
|
||||||
|
%h2= _ 'languages.inactive'
|
||||||
|
%ul.languages.inactive.small-block-grid-1.medium-block-grid-3.large-block-grid-4.grid.links
|
||||||
|
- @language_codes.each do |code|
|
||||||
|
- if code && !@completeness.has_key?(code.to_s)
|
||||||
|
%li.text-center
|
||||||
|
%a{:href => "/translations/#{code}/"}
|
||||||
|
%h3=_"languages.#{code}"
|
41
app/views/pages/translations.html.haml
Normal file
41
app/views/pages/translations.html.haml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
.row
|
||||||
|
%h1
|
||||||
|
= _ 'language_translations', vars: {:language => (_ ('languages.' + @lang))}
|
||||||
|
%table.columns#translations
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th.key=_'translations.Key'
|
||||||
|
%th.key=_'translations.Pages'
|
||||||
|
%th.key=_'translations.Value'
|
||||||
|
- @translations.sort{| a1, a2 | a1[0].downcase <=> a2[0].downcase}.each do |k,translation|
|
||||||
|
- current_translation = Translation.locale(@lang.to_sym).lookup(k)#[0].value #_ translation[0], :strict, locale: @lang.to_sym
|
||||||
|
- current_translation = current_translation.size() > 0 ? current_translation = current_translation[0].value : nil
|
||||||
|
- cached = (translation['languages'] && translation['languages'].include?(@lang))
|
||||||
|
- vars = translation.has_key?('vars') && translation['vars'].size() > 0 ? translation['vars'] : nil
|
||||||
|
- (vars && vars.include?(:count) ? I18n.backend.get_pluralization_rules(@lang) : [nil]).each do |pluralization|
|
||||||
|
- key = k + (pluralization ? ".#{pluralization.to_s}" : '')
|
||||||
|
%tr{:class => current_translation ? 'exists' : 'not-exists', :data => {:key => key}}
|
||||||
|
%td.key
|
||||||
|
= key
|
||||||
|
- if vars
|
||||||
|
.tags
|
||||||
|
%h5=_'translations.Vars'
|
||||||
|
%ul
|
||||||
|
- vars.each do |v|
|
||||||
|
%li=v
|
||||||
|
%td.pages
|
||||||
|
%ul
|
||||||
|
- translation['pages'].each do |page|
|
||||||
|
%li
|
||||||
|
%a{:href => page}=page
|
||||||
|
%td.value.primary
|
||||||
|
- if current_translation
|
||||||
|
= current_translation
|
||||||
|
- elsif I18n.locale.to_s == @lang.to_s
|
||||||
|
Nil
|
||||||
|
- else
|
||||||
|
- translation_hint = Translation.locale(I18n.locale).lookup(k)
|
||||||
|
- translation_hint = translation_hint && translation_hint.size() > 0 ? translation_hint = translation_hint[0].value : nil
|
||||||
|
= translation_hint ? (_ "languages.#{I18n.locale.to_s}") + " = \"#{translation_hint}\"" : 'Nil'
|
||||||
|
- unless current_translation
|
||||||
|
%a{:href => '#', :class => 'auto-translate button small'}='Auto'
|
@ -1,4 +1,4 @@
|
|||||||
= form_tag user_sessions_path, :method => :post do
|
= form_tag user_sessions_path, :method => :post do
|
||||||
= field :email, :email_field
|
= field :email, :email_field
|
||||||
= field :password, :password_field_tag
|
= field :password, :password_field_tag
|
||||||
= actions [:sign_in, :facebook_sign_in]
|
= actions [:Sign_In, :facebook_sign_in]
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
require File.expand_path('../boot', __FILE__)
|
require File.expand_path('../boot', __FILE__)
|
||||||
|
|
||||||
require 'rails/all'
|
require 'rails/all'
|
||||||
# require 'carmen'
|
#require 'dotenv'; Dotenv.load ".env.local", ".env.#{Rails.env}"
|
||||||
# require 'pry'
|
|
||||||
|
|
||||||
# Require the gems listed in Gemfile, including any gems
|
# Require the gems listed in Gemfile, including any gems
|
||||||
# you've limited to :test, :development, or :production.
|
# you've limited to :test, :development, or :production.
|
||||||
|
@ -41,6 +41,9 @@ module I18n
|
|||||||
def self.note(key, behavior = nil, behavior_size = nil)
|
def self.note(key, behavior = nil, behavior_size = nil)
|
||||||
I18n.backend.needs_translation(key)
|
I18n.backend.needs_translation(key)
|
||||||
if behavior
|
if behavior
|
||||||
|
if behavior.to_s == 'strict'
|
||||||
|
return nil
|
||||||
|
end
|
||||||
return self.lorem_ipsum(behavior, behavior_size)
|
return self.lorem_ipsum(behavior, behavior_size)
|
||||||
end
|
end
|
||||||
key.to_s.gsub(/^world\..*\.(.+)\.name$/, '\1').gsub(/^.*\.(.+)?$/, '\1').gsub('_', ' ')
|
key.to_s.gsub(/^world\..*\.(.+)\.name$/, '\1').gsub(/^.*\.(.+)?$/, '\1').gsub('_', ' ')
|
||||||
@ -61,6 +64,7 @@ module I18n
|
|||||||
|
|
||||||
@@translations_file = 'config/locales/.translations.yml'
|
@@translations_file = 'config/locales/.translations.yml'
|
||||||
@@translation_cache_file = 'config/locales/.translation-cache.yml'
|
@@translation_cache_file = 'config/locales/.translation-cache.yml'
|
||||||
|
@@pluralization_rules_file = 'config/locales/.pluralization-rules.yml'
|
||||||
@@translation_cache
|
@@translation_cache
|
||||||
|
|
||||||
def needs_translation(key)
|
def needs_translation(key)
|
||||||
@ -68,6 +72,13 @@ module I18n
|
|||||||
@@needs_translation << key
|
@@needs_translation << key
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def translate_control(translation)
|
||||||
|
@@translationsOnThisPage = true
|
||||||
|
datakeys = ''
|
||||||
|
translation['vars'].each { |key, value| datakeys += ' data-var-' + key.to_s + '="' + value.to_s.gsub('"', '"') + '"' }
|
||||||
|
('<span class="translate-me ' + (translation['is_translated'] ? '' : 'un') + 'translated lang-' + (translation['lang']) + ' key--' + translation['key'].gsub('.', '--') + '" data-translate-key="' + translation['key'] + '" data-translate-untranslated="' + translation['untranslated'].gsub('"', '"') + (translation['translated'] ? '" data-translate-translated="' + translation['translated'] : '') + '" data-vars="' + (translation['vars'].length ? translation['vars'].to_json.gsub('"', '"') : '') + '" title="' + ('translate.alt_click') + '">' + (translation['html'] || translation['untranslated']) + '</span>').to_s.html_safe
|
||||||
|
end
|
||||||
|
|
||||||
def initialized?
|
def initialized?
|
||||||
begin
|
begin
|
||||||
super
|
super
|
||||||
@ -85,47 +96,104 @@ module I18n
|
|||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_translation_info()
|
||||||
|
begin
|
||||||
|
YAML.load_file(@@translations_file) || {}
|
||||||
|
rescue Exception => e
|
||||||
|
# sometimes concurrency issues cause an exception during testing
|
||||||
|
puts e
|
||||||
|
sleep(1/2.0)
|
||||||
|
get_translation_info()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_pluralization_rules(locale)
|
||||||
|
rules = YAML.load_file(@@pluralization_rules_file)
|
||||||
|
rules[locale.to_sym]
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_language_codes()
|
||||||
|
YAML.load_file(@@pluralization_rules_file).keys
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_language_completion(lang)
|
||||||
|
total = 0
|
||||||
|
complete = 0
|
||||||
|
get_translation_info().each { |k,v|
|
||||||
|
total += 1
|
||||||
|
complete += v['languages'].include?(lang.to_s) ? 1 : 0
|
||||||
|
}
|
||||||
|
total ? complete / total : 0
|
||||||
|
end
|
||||||
|
|
||||||
|
def request_translation(key, vars, options)
|
||||||
|
locale = options[:locale].to_s
|
||||||
|
options[:locale] = :en
|
||||||
|
translation = I18n.translate(key, vars, options)
|
||||||
|
result = JSON.load(open("http://translate.google.com/translate_a/t?client=t&text=#{URI::escape(translation)}&hl=en&sl=en&tl=#{locale}&ie=UTF-8&oe=UTF-8&multires=1&otf=1&ssel=3&tsel=3&sc=1").read().gsub(/,+/, ',').gsub(/\[,+/, '[').gsub(/,+\]/, ']'))
|
||||||
|
while result.is_a?(Array)
|
||||||
|
result = result[0]
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
def lookup(locale, key, scope = [], options = {})
|
def lookup(locale, key, scope = [], options = {})
|
||||||
result = nil
|
result = nil
|
||||||
|
|
||||||
if @@translation_cache && @@translation_cache.has_key?(locale.to_s) && @@translation_cache[locale.to_s].has_key?(key.to_s)
|
if @@translation_cache && @@translation_cache.has_key?(locale.to_s) && @@translation_cache[locale.to_s].has_key?(key.to_s)
|
||||||
result = @@translation_cache[locale.to_s][key.to_s]
|
result = @@translation_cache[locale.to_s][key.to_s]
|
||||||
end
|
end
|
||||||
if !result
|
if !result
|
||||||
result = super(locale, key, scope, options)
|
result = super(locale, key, scope, options)
|
||||||
|
|
||||||
if Rails.env.test?
|
if Rails.env.test? && options[:behavior].to_s != 'scrict'
|
||||||
if result
|
if result
|
||||||
@@translation_cache[locale.to_s] ||= Hash.new
|
@@translation_cache[locale.to_s] ||= Hash.new
|
||||||
@@translation_cache[locale.to_s][key.to_s] = result
|
@@translation_cache[locale.to_s][key.to_s] = result
|
||||||
File.open(@@translation_cache_file, 'w') { |f| f.write @@translation_cache.to_yaml }
|
File.open(@@translation_cache_file, 'w') { |f| f.write @@translation_cache.to_yaml }
|
||||||
end
|
end
|
||||||
|
|
||||||
translations = YAML.load_file(@@translations_file)
|
translations = get_translation_info()
|
||||||
translations ||= Hash.new
|
translations ||= Hash.new
|
||||||
translations[key.to_s] ||= Hash.new
|
translations[key.to_s] ||= Hash.new
|
||||||
translations[key.to_s]['langauges'] ||= Hash.new
|
translations[key.to_s]['languages'] ||= Array.new
|
||||||
if result != nil
|
|
||||||
translations[key.to_s]['langauges'][locale.to_s] = result
|
|
||||||
end
|
|
||||||
translations[key.to_s]['pages'] ||= Array.new
|
translations[key.to_s]['pages'] ||= Array.new
|
||||||
|
if options['behavior']
|
||||||
|
translations[key.to_s]['behavior'] ||= options['behavior']
|
||||||
|
end
|
||||||
|
vars = []
|
||||||
|
options.each { |o,v|
|
||||||
|
if !I18n::RESERVED_KEYS.include?(o.to_sym) && o.to_s != 'behavior' && o.to_s != 'behavior_size'
|
||||||
|
vars << o.to_sym
|
||||||
|
end
|
||||||
|
}
|
||||||
|
if vars.size() > 0
|
||||||
|
translations[key.to_s]['vars'] = vars
|
||||||
|
end
|
||||||
unless translations[key.to_s].has_key?('data')
|
unless translations[key.to_s].has_key?('data')
|
||||||
translations[key.to_s]['data'] = Array.new
|
translations[key.to_s]['data'] = Array.new
|
||||||
DevTranslation.where("key = '#{key.to_s}' OR key LIKE '#{key.to_s}#{I18n::Backend::Flatten::FLATTEN_SEPARATOR}%'").each { |t|
|
DevTranslation.where("key = '#{key.to_s}' OR key LIKE '#{key.to_s}#{I18n::Backend::Flatten::FLATTEN_SEPARATOR}%'").each { |t|
|
||||||
translations[key.to_s]['data'] << t.becomes(Translation)
|
translations[key.to_s]['data'] << t.becomes(Translation)
|
||||||
|
unless translations[key.to_s]['languages'].include?(t.locale.to_s)
|
||||||
|
translations[key.to_s]['languages'] << t.locale.to_s
|
||||||
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
path = $page_info[:path]
|
path = $page_info[:path]
|
||||||
unless translations[key.to_s]['pages'].include?(path)
|
route = nil
|
||||||
translations[key.to_s]['pages'] << path
|
Rails.application.routes.routes.each { |r|
|
||||||
|
if !route && r.path.match(path)
|
||||||
|
route = r.path.spec.to_s.gsub(/\s*\(\.:\w+\)\s*$/, '')
|
||||||
|
end
|
||||||
|
}
|
||||||
|
unless translations[key.to_s]['pages'].include?(route)
|
||||||
|
translations[key.to_s]['pages'] << route
|
||||||
end
|
end
|
||||||
File.open(@@translations_file, 'w') { |f| f.write translations.to_yaml }
|
File.open(@@translations_file, 'w') { |f| f.write translations.to_yaml }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if Rails.env.test?
|
|
||||||
end
|
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -8,18 +8,8 @@ BikeBike::Application.routes.draw do
|
|||||||
|
|
||||||
resources :workshop_facilitators
|
resources :workshop_facilitators
|
||||||
|
|
||||||
#resources :conference_registration_responses
|
|
||||||
|
|
||||||
#resources :conference_registrations
|
|
||||||
|
|
||||||
#resources :conference_registraton_form_fields
|
|
||||||
|
|
||||||
resources :registration_form_fields
|
resources :registration_form_fields
|
||||||
|
|
||||||
#resources :conference_admins
|
|
||||||
|
|
||||||
#resources :conference_host_organizations
|
|
||||||
|
|
||||||
resources :conferences, :param => 'slug' do
|
resources :conferences, :param => 'slug' do
|
||||||
get :hosts
|
get :hosts
|
||||||
get :registration
|
get :registration
|
||||||
@ -37,8 +27,6 @@ BikeBike::Application.routes.draw do
|
|||||||
post 'registration/form/reorder' => 'conferences#reorder', as: 'registration_reorder'
|
post 'registration/form/reorder' => 'conferences#reorder', as: 'registration_reorder'
|
||||||
end
|
end
|
||||||
|
|
||||||
#resources :user_organization_relationships
|
|
||||||
|
|
||||||
resources :organizations, :param => 'slug' do
|
resources :organizations, :param => 'slug' do
|
||||||
get :members
|
get :members
|
||||||
get :identity
|
get :identity
|
||||||
@ -48,8 +36,6 @@ BikeBike::Application.routes.draw do
|
|||||||
resources :users
|
resources :users
|
||||||
resources :user_sessions
|
resources :user_sessions
|
||||||
|
|
||||||
#resources :organization_statuses
|
|
||||||
|
|
||||||
resources :conference_types
|
resources :conference_types
|
||||||
|
|
||||||
resources :workshop_streams
|
resources :workshop_streams
|
||||||
@ -60,14 +46,17 @@ BikeBike::Application.routes.draw do
|
|||||||
|
|
||||||
post '/translate/' => 'pages#translate'
|
post '/translate/' => 'pages#translate'
|
||||||
post '/location/territories/' => 'pages#location_territories'
|
post '/location/territories/' => 'pages#location_territories'
|
||||||
|
|
||||||
|
get '/translations/:lang', to: 'pages#translations'
|
||||||
|
get '/translations', to: 'pages#translation_list'
|
||||||
|
|
||||||
get 'login' => 'user_sessions#new', :as => :login
|
get 'login' => 'user_sessions#new', :as => :login
|
||||||
post 'logout' => 'user_sessions#destroy', :as => :logout
|
post 'logout' => 'user_sessions#destroy', :as => :logout
|
||||||
get 'register' => 'users#new', :as => 'register'
|
get 'register' => 'users#new', :as => 'register'
|
||||||
|
|
||||||
post "oauth/callback" => "oauths#callback"
|
post "oauth/callback" => "oauths#callback"
|
||||||
get "oauth/callback" => "oauths#callback"
|
get "oauth/callback" => "oauths#callback"
|
||||||
get "oauth/:provider" => "oauths#oauth", :as => :auth_at_provider
|
get "oauth/:provider" => "oauths#oauth", :as => :auth_at_provider
|
||||||
|
|
||||||
root 'pages#home'
|
root 'pages#home'
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ describe 'Login' do
|
|||||||
it "has a login form" do
|
it "has a login form" do
|
||||||
visit login_path
|
visit login_path
|
||||||
form = find 'form[action$="/user_sessions"]'
|
form = find 'form[action$="/user_sessions"]'
|
||||||
expect(form).to have_button 'sign in'
|
expect(form).to have_button 'Sign In'
|
||||||
expect(form).to have_field 'email_'
|
expect(form).to have_field 'email_'
|
||||||
expect(form).to have_field 'password'
|
expect(form).to have_field 'password'
|
||||||
expect(form).to have_link 'facebook'
|
expect(form).to have_link 'facebook'
|
||||||
@ -64,7 +64,7 @@ describe 'Login' do
|
|||||||
form = find 'form[action$="/user_sessions"]'
|
form = find 'form[action$="/user_sessions"]'
|
||||||
form.find("#email_").set(user.email)
|
form.find("#email_").set(user.email)
|
||||||
form.find("#password").set('secret')
|
form.find("#password").set('secret')
|
||||||
click_button "sign_in"
|
click_button "Sign_In"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@ describe 'Organization Registration' do
|
|||||||
form = find 'form[action$="/user_sessions"]'
|
form = find 'form[action$="/user_sessions"]'
|
||||||
form.find("#email_").set(user.email)
|
form.find("#email_").set(user.email)
|
||||||
form.find("#password").set('secret')
|
form.find("#password").set('secret')
|
||||||
click_button "sign_in"
|
click_button "Sign_In"
|
||||||
visit new_organization_path
|
visit new_organization_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
22
spec/features/pages/translations_spec.rb
Normal file
22
spec/features/pages/translations_spec.rb
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'Translations' do
|
||||||
|
|
||||||
|
describe 'Translate list' do
|
||||||
|
before(:each) do
|
||||||
|
visit '/translations'
|
||||||
|
end
|
||||||
|
|
||||||
|
it "does something" do
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'Translate english' do
|
||||||
|
before(:each) do
|
||||||
|
visit '/translations/en'
|
||||||
|
end
|
||||||
|
|
||||||
|
it "does something" do
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -3,6 +3,7 @@ ENV["RAILS_ENV"] ||= 'test'
|
|||||||
require File.expand_path("../../config/environment", __FILE__)
|
require File.expand_path("../../config/environment", __FILE__)
|
||||||
require 'rspec/rails'
|
require 'rspec/rails'
|
||||||
require 'rspec/autorun'
|
require 'rspec/autorun'
|
||||||
|
#+require 'dotenv'; Dotenv.overload ".env.test"
|
||||||
|
|
||||||
# Requires supporting ruby files with custom matchers and macros, etc,
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||||
# in spec/support/ and its subdirectories.
|
# in spec/support/ and its subdirectories.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user