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/sync_file.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, SyncData, SyncFile, Updater
Constant Summary collapse
- API_VERSION =
"1"
- LOG_PREFIX =
"** [Localeapp] "
- VERSION =
'0.9.0'
- 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.
64 65 66 |
# File 'lib/localeapp.rb', line 64 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
77 78 79 |
# File 'lib/localeapp.rb', line 77 def missing_translations @missing_translations end |
.poller ⇒ Object
The poller object is responsible for retrieving data for the Localeapp server
70 71 72 |
# File 'lib/localeapp.rb', line 70 def poller @poller end |
.sender ⇒ Object
The sender object is responsible for delivering formatted data to the Localeapp server.
67 68 69 |
# File 'lib/localeapp.rb', line 67 def sender @sender end |
.updater ⇒ Object
The updater object is responsible for merging translations into the i18n backend
73 74 75 |
# File 'lib/localeapp.rb', line 73 def updater @updater end |
Class Method Details
.configure {|configuration| ... } ⇒ Object
Localeapp.configure do |config|
config.api_key = '1234567890abcdef'
end
102 103 104 105 106 107 108 109 |
# File 'lib/localeapp.rb', line 102 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
89 90 91 |
# File 'lib/localeapp.rb', line 89 def debug() logger.debug(LOG_PREFIX + ) if logger end |
.default_config_file_paths ⇒ Object
115 116 117 118 119 120 |
# File 'lib/localeapp.rb', line 115 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
111 112 113 |
# File 'lib/localeapp.rb', line 111 def has_config_file? default_config_file_paths.any? { |path| File.exist?(path) } end |
.load_yaml(contents) ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/localeapp.rb', line 122 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
134 135 136 |
# File 'lib/localeapp.rb', line 134 def load_yaml_file(filename) load_yaml(File.read(filename)) end |
.log(message) ⇒ Object
Writes out the given message to the #logger
81 82 83 |
# File 'lib/localeapp.rb', line 81 def log() logger.info LOG_PREFIX + if logger end |
.log_with_time(message) ⇒ Object
85 86 87 |
# File 'lib/localeapp.rb', line 85 def log_with_time() log [Time.now.to_i, ].join(' - ') end |
.logger ⇒ Object
Look for the Rails logger currently defined
94 95 96 |
# File 'lib/localeapp.rb', line 94 def logger self.configuration && self.configuration.logger end |