Class: LokaliseManager::GlobalConfig
- Inherits:
-
Object
- Object
- LokaliseManager::GlobalConfig
- Defined in:
- lib/lokalise_manager/global_config.rb
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.
-
.lang_iso_inferer ⇒ Object
Infers lang ISO for the given translation file.
-
.locales_path ⇒ Object
Full path to directory with translation files.
-
.max_retries_export ⇒ Object
Maximum number of retries for file exporting.
-
.max_retries_import ⇒ Object
Maximum number of retries for file importing.
-
.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.
-
.translations_converter ⇒ Object
Converts translations data to the proper format.
- .translations_loader ⇒ Object
-
.use_oauth2_token ⇒ Object
When enabled, will use OAuth 2 Lokalise client and will require to provide a token obtained via OAuth 2 flow rather than via Lokalise profile.
Class Method Summary collapse
-
.config {|_self| ... } ⇒ Object
Main interface to provide configuration options.
Class Attribute Details
.api_token ⇒ Object
Returns the value of attribute api_token.
6 7 8 |
# File 'lib/lokalise_manager/global_config.rb', line 6 def api_token @api_token end |
.branch ⇒ Object
Project branch to use
29 30 31 |
# File 'lib/lokalise_manager/global_config.rb', line 29 def branch @branch || '' end |
.export_opts ⇒ Object
Options for export rake task
66 67 68 |
# File 'lib/lokalise_manager/global_config.rb', line 66 def export_opts @export_opts || {} end |
.file_ext_regexp ⇒ Object
Regular expression used to select translation files with proper extensions
49 50 51 |
# File 'lib/lokalise_manager/global_config.rb', line 49 def file_ext_regexp @file_ext_regexp || /\.ya?ml\z/i end |
.import_opts ⇒ Object
Options for import rake task
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/lokalise_manager/global_config.rb', line 54 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
71 72 73 |
# File 'lib/lokalise_manager/global_config.rb', line 71 def import_safe_mode @import_safe_mode.nil? ? false : @import_safe_mode end |
.lang_iso_inferer ⇒ Object
Infers lang ISO for the given translation file
90 91 92 |
# File 'lib/lokalise_manager/global_config.rb', line 90 def lang_iso_inferer @lang_iso_inferer || ->(data) { YAML.safe_load(data)&.keys&.first } end |
.locales_path ⇒ Object
Full path to directory with translation files
24 25 26 |
# File 'lib/lokalise_manager/global_config.rb', line 24 def locales_path @locales_path || "#{Dir.getwd}/locales" end |
.max_retries_export ⇒ Object
Maximum number of retries for file exporting
39 40 41 |
# File 'lib/lokalise_manager/global_config.rb', line 39 def max_retries_export @max_retries_export || 5 end |
.max_retries_import ⇒ Object
Maximum number of retries for file importing
44 45 46 |
# File 'lib/lokalise_manager/global_config.rb', line 44 def max_retries_import @max_retries_import || 5 end |
.project_id ⇒ Object
Returns the value of attribute project_id.
6 7 8 |
# File 'lib/lokalise_manager/global_config.rb', line 6 def project_id @project_id end |
.skip_file_export ⇒ Object
Additional file skip criteria to apply when performing export
76 77 78 |
# File 'lib/lokalise_manager/global_config.rb', line 76 def skip_file_export @skip_file_export || ->(_) { false } end |
.timeouts ⇒ Object
Set request timeouts for the Lokalise API client
34 35 36 |
# File 'lib/lokalise_manager/global_config.rb', line 34 def timeouts @timeouts || {} end |
.translations_converter ⇒ Object
Converts translations data to the proper format
85 86 87 |
# File 'lib/lokalise_manager/global_config.rb', line 85 def translations_converter @translations_converter || ->(raw_data) { raw_data.to_yaml } end |
.translations_loader ⇒ Object
80 81 82 |
# File 'lib/lokalise_manager/global_config.rb', line 80 def translations_loader @translations_loader || ->(raw_data) { YAML.safe_load raw_data } end |
.use_oauth2_token ⇒ Object
When enabled, will use OAuth 2 Lokalise client and will require to provide a token obtained via OAuth 2 flow rather than via Lokalise profile
19 20 21 |
# File 'lib/lokalise_manager/global_config.rb', line 19 def use_oauth2_token @use_oauth2_token || false end |
Class Method Details
.config {|_self| ... } ⇒ Object
Main interface to provide configuration options
13 14 15 |
# File 'lib/lokalise_manager/global_config.rb', line 13 def config yield self end |