Permalink
Browse files

adding i18n-js, added meta translations to engine strings

  • Loading branch information...
1 parent f720ef6 commit bebb64266d9e425459b7248ffe902f6f7bc3dffd @adamico adamico committed Jul 16, 2011
View
@@ -19,6 +19,7 @@ gem 'uglifier'
gem 'execjs'
gem 'jquery-rails'
gem 'sass-rails'
+gem "i18n-js", :git => "https://github.com/adamico/i18n-js.git"
if RUBY_VERSION < '1.9'
gem "ruby-debug", ">= 0.10.3"
View
@@ -1,3 +1,10 @@
+GIT
+ remote: https://github.com/adamico/i18n-js.git
+ revision: f586ffb385cba1e0a49f8dd80b557c34dee3a283
+ specs:
+ i18n-js (1.0.2)
+ i18n
+
GEM
remote: http://rubygems.org/
specs:
@@ -167,6 +174,7 @@ DEPENDENCIES
database_cleaner
execjs
factory_girl_rails (~> 1.1.beta1)
+ i18n-js!
jquery-rails
launchy
rails (= 3.1.0.rc4)
@@ -1,17 +1,23 @@
$(document).ready(function() {
+ //FIXME: find a way to set these dynamically
+ I18n.defaultLocale = "en";
+ I18n.locale = "en";
+
var $translation_missing_count = $('.translation_missing').length;
var $translation_present_count = $('.translation_present').length;
var $newdiv = $('<div id="lost-i18n-translation-div"/>');
+ var sep = " | "
+ $newdiv.append("Current locale : " + I18n.currentLocale() + sep);
var $tr_missing = $('<span id="lost-i18n-translation-tr-missing-count" />');
- $tr_missing.append( $translation_missing_count );
- $newdiv.append("Missing translations: " , $tr_missing );
-
+ $tr_missing.append( $translation_missing_count + sep);
+ $newdiv.append(I18n.t("lost_i18n_translation.missing_label") + ": " , $tr_missing);
+
var $tr_present = $('<span id="lost-i18n-translation-tr-present-count" />');
$tr_present.append( $translation_present_count );
- $newdiv.append("Present translations: ", $tr_present );
+ $newdiv.append(I18n.t("lost_i18n_translation.present_label") + ": ", $tr_present);
$('body').append($newdiv);
});
View
@@ -0,0 +1,4 @@
+# Find more details about this configuration file at http://github.com/fnando/i18n-js
+translations:
+ - file: "public/javascripts/translations.js"
+ only: "*"
@@ -0,0 +1,4 @@
+en:
+ lost_i18n_translation:
+ missing_label: "Missing translations"
+ present_label: "Present translations"
@@ -8,3 +8,5 @@
//= require jquery_ujs
//= require_tree .
//= require lost-i18n-translation
+//= require i18n
+//= require translations
@@ -1,3 +1,9 @@
class ApplicationController < ActionController::Base
protect_from_forgery
+ before_filter :export_i18n_messages
+
+ private
+ def export_i18n_messages
+ SimplesIdeias::I18n.export! if Rails.env.development?
+ end
end

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit bebb642

Please sign in to comment.