Module: LokaliseRails
- Defined in:
- lib/lokalise_rails.rb,
lib/lokalise_rails/railtie.rb,
lib/lokalise_rails/version.rb,
lib/lokalise_rails/task_definition/base.rb,
lib/lokalise_rails/task_definition/exporter.rb,
lib/lokalise_rails/task_definition/importer.rb,
lib/generators/lokalise_rails/install_generator.rb
Defined Under Namespace
Modules: Generators, TaskDefinition Classes: Railtie
Constant Summary collapse
- VERSION =
'1.1.0'
Class Attribute Summary collapse
-
.api_token ⇒ Object
Returns the value of attribute api_token.
-
.branch ⇒ Object
Project branch to use.
-
.export_opts ⇒ Object
Options for export rake task.
-
.file_ext_regexp ⇒ Object
Regular expression used to select translation files with proper extensions.
-
.import_opts ⇒ Object
Options for import rake task.
-
.import_safe_mode ⇒ Object
Enables safe mode for import.
-
.locales_path ⇒ Object
Full path to directory with translation files.
-
.project_id ⇒ Object
Returns the value of attribute project_id.
-
.skip_file_export ⇒ Object
Additional file skip criteria to apply when performing export.
-
.timeouts ⇒ Object
Set request timeouts for the Lokalise API client.
Class Method Summary collapse
-
.config {|_self| ... } ⇒ Object
Main interface to provide configuration options for rake tasks.
Class Attribute Details
.api_token ⇒ Object
Returns the value of attribute api_token.
9 10 11 |
# File 'lib/lokalise_rails.rb', line 9 def api_token @api_token end |
.branch ⇒ Object
Project branch to use
24 25 26 |
# File 'lib/lokalise_rails.rb', line 24 def branch @branch || 'master' end |
.export_opts ⇒ Object
Options for export rake task
51 52 53 |
# File 'lib/lokalise_rails.rb', line 51 def export_opts @export_opts || {} end |
.file_ext_regexp ⇒ Object
Regular expression used to select translation files with proper extensions
34 35 36 |
# File 'lib/lokalise_rails.rb', line 34 def file_ext_regexp @file_ext_regexp || /\.ya?ml\z/i end |
.import_opts ⇒ Object
Options for import rake task
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/lokalise_rails.rb', line 39 def import_opts @import_opts || { format: 'yaml', placeholder_format: :icu, yaml_include_root: true, original_filenames: true, directory_prefix: '', indentation: '2sp' } end |
.import_safe_mode ⇒ Object
Enables safe mode for import. When enabled, will check whether the target folder is empty or not
56 57 58 |
# File 'lib/lokalise_rails.rb', line 56 def import_safe_mode @import_safe_mode.nil? ? false : @import_safe_mode end |
.locales_path ⇒ Object
Full path to directory with translation files
19 20 21 |
# File 'lib/lokalise_rails.rb', line 19 def locales_path @locales_path || "#{Rails.root}/config/locales" end |
.project_id ⇒ Object
Returns the value of attribute project_id.
9 10 11 |
# File 'lib/lokalise_rails.rb', line 9 def project_id @project_id end |
.skip_file_export ⇒ Object
Additional file skip criteria to apply when performing export
61 62 63 |
# File 'lib/lokalise_rails.rb', line 61 def skip_file_export @skip_file_export || ->(_) { false } end |
.timeouts ⇒ Object
Set request timeouts for the Lokalise API client
29 30 31 |
# File 'lib/lokalise_rails.rb', line 29 def timeouts @timeouts || {} end |
Class Method Details
.config {|_self| ... } ⇒ Object
Main interface to provide configuration options for rake tasks
14 15 16 |
# File 'lib/lokalise_rails.rb', line 14 def config yield self end |