add i18n-js and localize javascript (not implemented yet)

This commit is contained in:
pixeldesu 2015-06-08 16:01:16 +02:00
parent 3a4ff794de
commit 488d582afa
10 changed files with 67 additions and 8 deletions

3
.gitignore vendored
View File

@ -23,6 +23,9 @@ coverage/
# damn vim backup files
*~
# dont push generated js translations to repository
/public/javascripts/i18n/
# every fucking time, dolphin
.directory
# lookin' at you, OS trash

View File

@ -3,6 +3,7 @@ source 'https://rails-assets.org'
gem 'rails', '4.2.1'
gem 'rails-i18n'
gem 'i18n-js'
gem 'pg', group: :postgres
gem 'mysql2', group: :mysql
@ -65,7 +66,8 @@ gem 'foreman'
gem 'redis'
group :development do
gem 'spring'
# require spring 1.3.5 since shit's on fire on my local instance with 1.3.4 (Gem::LoadError)
gem 'spring', '~> 1.3.5'
# ten thousand raises no more!
gem 'byebug'
gem 'web-console'

View File

@ -222,6 +222,8 @@ GEM
http_accept_language (2.0.5)
http_parser.rb (0.6.0)
i18n (0.7.0)
i18n-js (3.0.0.rc10)
i18n (~> 0.6)
inflecto (0.0.2)
ipaddress (0.8.0)
jbuilder (2.2.13)
@ -404,7 +406,7 @@ GEM
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
spring (1.3.4)
spring (1.3.5)
sprockets (2.12.3)
hike (~> 1.2)
multi_json (~> 1.0)
@ -497,6 +499,7 @@ DEPENDENCIES
foreman
haml
http_accept_language
i18n-js
jbuilder (~> 2.2.4)
jquery-rails
jquery-turbolinks
@ -527,7 +530,7 @@ DEPENDENCIES
simplecov-json
simplecov-rcov
sinatra
spring
spring (~> 1.3.5)
sweetalert-rails
thin
tumblr_client

View File

@ -9,6 +9,7 @@ $(document).on "click", "a[data-action=ab-comment-destroy]", (ev) ->
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Delete"
cancelButtonText: "Cancel"
closeOnConfirm: true
, ->
$.ajax

View File

@ -1,4 +1,5 @@
# the laziest coding known to man
# TODO: so lazy, I don't know how to localize it properly
$(document).on "click", "a[data-action=ab-submarine]", (ev) ->
ev.preventDefault()
btn = $(this)

View File

@ -10,6 +10,8 @@
#= require jquery.guillotine
#= require jquery.particleground
#= require sweet-alert
#= require i18n
#= require i18n/translations
# local requires to be seen by everyone:
#= require_tree ./answerbox
#= require_tree ./questionbox

View File

@ -71,6 +71,7 @@ $(document).on "keyup", "input#new-group-name", (evt) ->
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Delete"
cancelButtonText: "Cancel"
closeOnConfirm: true
, ->
$.ajax

View File

@ -29,6 +29,7 @@
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Delete"
cancelButtonText: "Cancel"
closeOnConfirm: true
, ->
btn.button "loading"
@ -102,6 +103,7 @@ $(document).on "click", "button[name=ib-destroy]", ->
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Delete"
cancelButtonText: "Cancel"
closeOnConfirm: true
, ->
btn.button "loading"

View File

@ -9,11 +9,11 @@
%li
%a{href: show_user_profile_path(current_user.screen_name)}
%i.fa.fa-fw.fa-user
View profile
= t 'views.user.profile.view'
%li
%a{href: edit_user_registration_path}
%i.fa.fa-fw.fa-cog
Settings
= t 'views.user.profile.settings'
%li.divider
- if current_user.admin?
%li
@ -33,4 +33,4 @@
%li
%a{href: destroy_user_session_path, data: {method: :delete} }
%i.fa.fa-fw.fa-sign-out
Logout
= t 'views.sessions.destroy'

View File

@ -20,6 +20,47 @@
# available at http://guides.rubyonrails.org/i18n.html.
en:
frontend:
load: "Load more"
actions:
delete: "Delete"
cancel: "Cancel"
report: "Report"
follow: "Follow"
unfollow: "Unfollow"
yes: "Yes"
no: "No"
success:
title: "Success!"
error:
title: "Uh-oh..."
message: "An error occurred, a developer should check the console for details"
group:
confirm:
title: "Really delete this group?"
text: "You will not be able to recover this group."
destroy_question:
confirm:
title: "Are you sure?"
text: "The question will be moved back to your inbox, but it won't delete any posts to social media."
destroy_comment:
confirm:
title: "Really delete?"
text: "You will not be able to recover this comment."
inbox:
empty: "Nothing to see here."
confirm_all:
title: "Really delete %{count} questions?"
text: "They will be gone forever."
confirm:
title: "Really delete?"
text: "This question will be gone forever."
report:
confirm:
title: "Really report this %{type}?"
text: "A moderator will review your report and decide what happens.\nIf you'd like, you can also specify a reason."
input: "Specify a reason..."
flash:
ban:
error: "I'm sorry, %{name}, I'm afraid I can't do that."
@ -409,4 +450,7 @@ en:
contributor: "Contributor"
blogger: "Blogger"
banned: "Banned"
profile:
view: "View profile"
settings: "Settings"
hello: "Hello world"