diff --git a/.gitignore b/.gitignore index e21f5f45..e701ee4e 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/Gemfile b/Gemfile index d285b9a9..e265cbbc 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index 994cc484..041fa292 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 diff --git a/app/assets/javascripts/answerbox/comment/destroy.coffee b/app/assets/javascripts/answerbox/comment/destroy.coffee index 36505fa8..7cbe1dc2 100644 --- a/app/assets/javascripts/answerbox/comment/destroy.coffee +++ b/app/assets/javascripts/answerbox/comment/destroy.coffee @@ -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 @@ -23,4 +24,4 @@ $(document).on "click", "a[data-action=ab-comment-destroy]", (ev) -> error: (jqxhr, status, error) -> console.log jqxhr, status, error showNotification "An error occurred, a developer should check the console for details", false - complete: (jqxhr, status) -> \ No newline at end of file + complete: (jqxhr, status) -> diff --git a/app/assets/javascripts/answerbox/subscribe.coffee b/app/assets/javascripts/answerbox/subscribe.coffee index 4c937dd4..7aceb3e0 100644 --- a/app/assets/javascripts/answerbox/subscribe.coffee +++ b/app/assets/javascripts/answerbox/subscribe.coffee @@ -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) diff --git a/app/assets/javascripts/application.js.erb.coffee b/app/assets/javascripts/application.js.erb.coffee index e322e7fb..c017e44e 100644 --- a/app/assets/javascripts/application.js.erb.coffee +++ b/app/assets/javascripts/application.js.erb.coffee @@ -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 diff --git a/app/assets/javascripts/groups.coffee b/app/assets/javascripts/groups.coffee index 6b88bb41..a98b46f6 100644 --- a/app/assets/javascripts/groups.coffee +++ b/app/assets/javascripts/groups.coffee @@ -71,6 +71,7 @@ $(document).on "keyup", "input#new-group-name", (evt) -> showCancelButton: true confirmButtonColor: "#DD6B55" confirmButtonText: "Delete" + cancelButtonText: "Cancel" closeOnConfirm: true , -> $.ajax diff --git a/app/assets/javascripts/inbox.coffee b/app/assets/javascripts/inbox.coffee index 0741ce09..65bdc6aa 100644 --- a/app/assets/javascripts/inbox.coffee +++ b/app/assets/javascripts/inbox.coffee @@ -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" @@ -137,4 +139,4 @@ $(document).on "click", "button[name=ib-options]", -> btn[0].dataset.state = 'shown' when 'shown' optionBox.slideUp() - btn[0].dataset.state = 'hidden' \ No newline at end of file + btn[0].dataset.state = 'hidden' diff --git a/app/views/layouts/_profile.html.haml b/app/views/layouts/_profile.html.haml index b7ab872a..1c4f4eb4 100644 --- a/app/views/layouts/_profile.html.haml +++ b/app/views/layouts/_profile.html.haml @@ -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 \ No newline at end of file + = t 'views.sessions.destroy' diff --git a/config/locales/en.yml b/config/locales/en.yml index 2efd8e68..efb45e8d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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"