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 # damn vim backup files
*~ *~
# dont push generated js translations to repository
/public/javascripts/i18n/
# every fucking time, dolphin # every fucking time, dolphin
.directory .directory
# lookin' at you, OS trash # lookin' at you, OS trash

View File

@ -3,6 +3,7 @@ source 'https://rails-assets.org'
gem 'rails', '4.2.1' gem 'rails', '4.2.1'
gem 'rails-i18n' gem 'rails-i18n'
gem 'i18n-js'
gem 'pg', group: :postgres gem 'pg', group: :postgres
gem 'mysql2', group: :mysql gem 'mysql2', group: :mysql
@ -65,7 +66,8 @@ gem 'foreman'
gem 'redis' gem 'redis'
group :development do 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! # ten thousand raises no more!
gem 'byebug' gem 'byebug'
gem 'web-console' gem 'web-console'

View File

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

View File

@ -9,6 +9,7 @@ $(document).on "click", "a[data-action=ab-comment-destroy]", (ev) ->
showCancelButton: true showCancelButton: true
confirmButtonColor: "#DD6B55" confirmButtonColor: "#DD6B55"
confirmButtonText: "Delete" confirmButtonText: "Delete"
cancelButtonText: "Cancel"
closeOnConfirm: true closeOnConfirm: true
, -> , ->
$.ajax $.ajax
@ -23,4 +24,4 @@ $(document).on "click", "a[data-action=ab-comment-destroy]", (ev) ->
error: (jqxhr, status, error) -> error: (jqxhr, status, error) ->
console.log jqxhr, status, error console.log jqxhr, status, error
showNotification "An error occurred, a developer should check the console for details", false showNotification "An error occurred, a developer should check the console for details", false
complete: (jqxhr, status) -> complete: (jqxhr, status) ->

View File

@ -1,4 +1,5 @@
# the laziest coding known to man # 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) -> $(document).on "click", "a[data-action=ab-submarine]", (ev) ->
ev.preventDefault() ev.preventDefault()
btn = $(this) btn = $(this)

View File

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

View File

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

View File

@ -29,6 +29,7 @@
showCancelButton: true showCancelButton: true
confirmButtonColor: "#DD6B55" confirmButtonColor: "#DD6B55"
confirmButtonText: "Delete" confirmButtonText: "Delete"
cancelButtonText: "Cancel"
closeOnConfirm: true closeOnConfirm: true
, -> , ->
btn.button "loading" btn.button "loading"
@ -102,6 +103,7 @@ $(document).on "click", "button[name=ib-destroy]", ->
showCancelButton: true showCancelButton: true
confirmButtonColor: "#DD6B55" confirmButtonColor: "#DD6B55"
confirmButtonText: "Delete" confirmButtonText: "Delete"
cancelButtonText: "Cancel"
closeOnConfirm: true closeOnConfirm: true
, -> , ->
btn.button "loading" btn.button "loading"
@ -137,4 +139,4 @@ $(document).on "click", "button[name=ib-options]", ->
btn[0].dataset.state = 'shown' btn[0].dataset.state = 'shown'
when 'shown' when 'shown'
optionBox.slideUp() optionBox.slideUp()
btn[0].dataset.state = 'hidden' btn[0].dataset.state = 'hidden'

View File

@ -9,11 +9,11 @@
%li %li
%a{href: show_user_profile_path(current_user.screen_name)} %a{href: show_user_profile_path(current_user.screen_name)}
%i.fa.fa-fw.fa-user %i.fa.fa-fw.fa-user
View profile = t 'views.user.profile.view'
%li %li
%a{href: edit_user_registration_path} %a{href: edit_user_registration_path}
%i.fa.fa-fw.fa-cog %i.fa.fa-fw.fa-cog
Settings = t 'views.user.profile.settings'
%li.divider %li.divider
- if current_user.admin? - if current_user.admin?
%li %li
@ -33,4 +33,4 @@
%li %li
%a{href: destroy_user_session_path, data: {method: :delete} } %a{href: destroy_user_session_path, data: {method: :delete} }
%i.fa.fa-fw.fa-sign-out %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. # available at http://guides.rubyonrails.org/i18n.html.
en: 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: flash:
ban: ban:
error: "I'm sorry, %{name}, I'm afraid I can't do that." error: "I'm sorry, %{name}, I'm afraid I can't do that."
@ -409,4 +450,7 @@ en:
contributor: "Contributor" contributor: "Contributor"
blogger: "Blogger" blogger: "Blogger"
banned: "Banned" banned: "Banned"
profile:
view: "View profile"
settings: "Settings"
hello: "Hello world" hello: "Hello world"