Godwin
11 years ago
19 changed files with 486 additions and 161 deletions
Binary file not shown.
@ -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); |
||||
|
} |
||||
|
} |
@ -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}" |
@ -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] |
||||
|
@ -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 |
Loading…
Reference in new issue