From f368b8132e56f0e4f334b4e17ff400366a290a6c Mon Sep 17 00:00:00 2001 From: Alexandre Podlewski Date: Wed, 18 Oct 2023 16:38:27 +0200 Subject: [PATCH] Add parameter to cli to disable striping of translated strings --- CHANGELOG.md | 4 ++++ lib/ad_localize/mappers/options_to_export_request.rb | 1 + lib/ad_localize/option_handler.rb | 2 ++ 3 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f068ad5..177dfbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + +- new option `--skip-value-stripping` that disable the leading and trailing whitespaces removal on wording values. The value stripping was introduced with version 6.0.0. + ## 6.1.0 ### Added diff --git a/lib/ad_localize/mappers/options_to_export_request.rb b/lib/ad_localize/mappers/options_to_export_request.rb index 3cc13a6..53644ef 100644 --- a/lib/ad_localize/mappers/options_to_export_request.rb +++ b/lib/ad_localize/mappers/options_to_export_request.rb @@ -7,6 +7,7 @@ def map(options:) request.locales = options[:locales] request.bypass_empty_values = options[:'non-empty-values'] request.auto_escape_percent = options[:'auto-escape-percent'] + request.skip_value_stripping = options[:'skip-value-stripping'] request.csv_paths = options[:csv_paths] request.merge_policy = options[:'merge-policy'] request.output_path = options[:'target-dir'] diff --git a/lib/ad_localize/option_handler.rb b/lib/ad_localize/option_handler.rb index 37c9c6e..24a69da 100644 --- a/lib/ad_localize/option_handler.rb +++ b/lib/ad_localize/option_handler.rb @@ -5,6 +5,7 @@ class OptionHandler locales: Requests::ExportRequest::DEFAULTS[:locales], :'non-empty-values' => Requests::ExportRequest::DEFAULTS[:bypass_empty_values], :'auto-escape-percent' => Requests::ExportRequest::DEFAULTS[:auto_escape_percent], + :'skip-value-stripping' => Requests::ExportRequest::DEFAULTS[:skip_value_stripping], csv_paths: Requests::ExportRequest::DEFAULTS[:csv_paths], :'merge-policy' => Requests::ExportRequest::DEFAULTS[:merge_policy], :'target-dir' => Requests::ExportRequest::DEFAULTS[:output_path], @@ -39,6 +40,7 @@ def self.parse!(options) end parser.on("-x", "--non-empty-values", TrueClass, 'Do not export keys with empty values (iOS only)') parser.on("--auto-escape-percent", TrueClass, 'Add escaping for % symbol to support wording use with String formatting (iOS only)') + parser.on("--skip-value-stripping", TrueClass, 'Disable the removal of leading and trailing whitespaces on wording values') end.parse!(options, into: args) args[:csv_paths] = options