Module: Localeapp
- Defined in:
- lib/localeapp/rails/mimic_rails_missing_translation_display.rb,
lib/localeapp.rb,
lib/localeapp/rails.rb,
lib/localeapp/poller.rb,
lib/localeapp/routes.rb,
lib/localeapp/sender.rb,
lib/localeapp/cli/add.rb,
lib/localeapp/updater.rb,
lib/localeapp/version.rb,
lib/localeapp/api_call.rb,
lib/localeapp/cli/pull.rb,
lib/localeapp/cli/push.rb,
lib/localeapp/i18n_shim.rb,
lib/localeapp/api_caller.rb,
lib/localeapp/cli/daemon.rb,
lib/localeapp/cli/remove.rb,
lib/localeapp/cli/rename.rb,
lib/localeapp/cli/update.rb,
lib/localeapp/cli/command.rb,
lib/localeapp/cli/install.rb,
lib/localeapp/key_checker.rb,
lib/localeapp/configuration.rb,
lib/localeapp/rails/controller.rb,
lib/localeapp/exception_handler.rb,
lib/localeapp/missing_translations.rb,
lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
Overview
Rails 3.2.16 and 4.0.2 introduced a new way of displaying missing translation : they now wrap them in a <span> element with useful class and title
github.com/rails/rails/commit/78790e4bceedc632cb40f9597792d7e27234138a
Defined Under Namespace
Modules: ApiCall, CLI, ForceExceptionHandlerInTranslationHelper, MimicRailsMissingTranslationDisplay, Rails, Routes, TranslationHelperMonkeyPatch Classes: ApiCaller, Configuration, ExceptionHandler, KeyChecker, LocaleappError, MissingApiKey, MissingTranslationRecord, MissingTranslations, Poller, PotentiallyInsecureYaml, Sender, Updater
Constant Summary collapse
- API_VERSION =
"1"
- LOG_PREFIX =
"** [Localeapp] "
- VERSION =
'0.7.2'
- I18nMissingTranslationException =
I18n::MissingTranslationData
Class Attribute Summary collapse
-
.configuration ⇒ Object
An Localeapp configuration object.
-
.missing_translations ⇒ Object
readonly
The missing_translations object is responsible for keeping track of missing translations that will be sent to the backend.
-
.poller ⇒ Object
The poller object is responsible for retrieving data for the Localeapp server.
-
.sender ⇒ Object
The sender object is responsible for delivering formatted data to the Localeapp server.
-
.updater ⇒ Object
The updater object is responsible for merging translations into the i18n backend.
Class Method Summary collapse
-
.configure {|configuration| ... } ⇒ Object
Localeapp.configure do |config| config.api_key = ‘1234567890abcdef’ end.
- .debug(message) ⇒ Object
- .default_config_file_paths ⇒ Object
- .has_config_file? ⇒ Boolean
- .load_yaml(contents) ⇒ Object
- .load_yaml_file(filename) ⇒ Object
-
.log(message) ⇒ Object
Writes out the given message to the #logger.
- .log_with_time(message) ⇒ Object
-
.logger ⇒ Object
Look for the Rails logger currently defined.
Class Attribute Details
.configuration ⇒ Object
An Localeapp configuration object.
63 64 65 |
# File 'lib/localeapp.rb', line 63 def configuration @configuration end |
.missing_translations ⇒ Object (readonly)
The missing_translations object is responsible for keeping track of missing translations that will be sent to the backend
76 77 78 |
# File 'lib/localeapp.rb', line 76 def missing_translations @missing_translations end |
.poller ⇒ Object
The poller object is responsible for retrieving data for the Localeapp server
69 70 71 |
# File 'lib/localeapp.rb', line 69 def poller @poller end |
.sender ⇒ Object
The sender object is responsible for delivering formatted data to the Localeapp server.
66 67 68 |
# File 'lib/localeapp.rb', line 66 def sender @sender end |
.updater ⇒ Object
The updater object is responsible for merging translations into the i18n backend
72 73 74 |
# File 'lib/localeapp.rb', line 72 def updater @updater end |
Class Method Details
.configure {|configuration| ... } ⇒ Object
Localeapp.configure do |config|
config.api_key = '1234567890abcdef'
end
101 102 103 104 105 106 107 108 |
# File 'lib/localeapp.rb', line 101 def configure self.configuration ||= Configuration.new yield(configuration) if block_given? self.sender = Sender.new self.poller = Poller.new self.updater = Updater.new @missing_translations = MissingTranslations.new end |
.debug(message) ⇒ Object
88 89 90 |
# File 'lib/localeapp.rb', line 88 def debug() logger.debug(LOG_PREFIX + ) if logger end |
.default_config_file_paths ⇒ Object
114 115 116 117 118 119 |
# File 'lib/localeapp.rb', line 114 def default_config_file_paths [ File.join(Dir.pwd, '.localeapp', 'config.rb'), File.join(Dir.pwd, 'config', 'initializers', 'localeapp.rb') ] end |
.has_config_file? ⇒ Boolean
110 111 112 |
# File 'lib/localeapp.rb', line 110 def has_config_file? default_config_file_paths.any? { |path| File.exists?(path) } end |
.load_yaml(contents) ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/localeapp.rb', line 121 def load_yaml(contents) if Localeapp.configuration.raise_on_insecure_yaml raise Localeapp::PotentiallyInsecureYaml if contents =~ /!ruby\// end if defined?(Psych) && defined?(Psych::VERSION) Psych.load(contents) else normalize_results(YAML.load(contents)) end end |
.load_yaml_file(filename) ⇒ Object
133 134 135 |
# File 'lib/localeapp.rb', line 133 def load_yaml_file(filename) load_yaml(File.read(filename)) end |
.log(message) ⇒ Object
Writes out the given message to the #logger
80 81 82 |
# File 'lib/localeapp.rb', line 80 def log() logger.info LOG_PREFIX + if logger end |
.log_with_time(message) ⇒ Object
84 85 86 |
# File 'lib/localeapp.rb', line 84 def log_with_time() log [Time.now.to_i, ].join(' - ') end |
.logger ⇒ Object
Look for the Rails logger currently defined
93 94 95 |
# File 'lib/localeapp.rb', line 93 def logger self.configuration && self.configuration.logger end |