Skip to content

Commit f48c3c6

Browse files
committed
Adds some doc comments to a couple of functions and actions as I was trying to make sense of them
1 parent 6cde866 commit f48c3c6

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_localize_libs_action.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ def self.available_options
3636
FastlaneCore::ConfigItem.new(key: :app_strings_path,
3737
description: 'The path of the main strings file',
3838
optional: false,
39-
is_string: true),
39+
type: String),
40+
# The name of this parameter is a bit misleading due to legacy. In practice it's expected to be an Array of Hashes, each describing a library to merge.
41+
# See `Fastlane::Helper::Android::LocalizeHelper.merge_lib`'s YARD doc for more details on the keys expected for each Hash.
4042
FastlaneCore::ConfigItem.new(key: :libs_strings_path,
4143
env_name: 'LOCALIZE_LIBS_STRINGS_PATH',
42-
description: 'The list of libs to merge',
44+
description: 'The list of libs to merge. Each item in the provided array must be a Hash with the keys `:library` (The library display name), `:strings_path` (The path to the `strings.xml` file of the library) and `:exclusions` (Array of string keys to exclude from merging)',
4345
optional: false,
44-
is_string: false),
46+
type: Array),
4547
]
4648
end
4749

lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_downloadmetadata_action.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def self.available_options
5858
is_string: false),
5959
FastlaneCore::ConfigItem.new(key: :locales,
6060
env_name: 'FL_DOWNLOAD_METADATA_LOCALES',
61-
description: 'The hash with the GLotPress locale and the project locale association',
61+
description: 'The hash with the GlotPress locale and the project locale association',
6262
is_string: false),
6363
FastlaneCore::ConfigItem.new(key: :source_locale,
6464
env_name: 'FL_DOWNLOAD_METADATA_SOURCE_LOCALE',

lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ def self.verify_string(main_strings, library, string_line)
9292
UI.user_error!("String #{string_name} [#{string_content}] was found in library #{library[:library]} but not in the main file.")
9393
end
9494

95+
# Merge strings from a library into the strings.xml of the main app
96+
#
97+
# @param [String] main Path to the main strings.xml file (something like `…/res/values/strings.xml`)
98+
# @param [Hash] library Hash describing the library to merge. The Hash should contain the following keys:
99+
# - `:library`: The human readable name of the library, used to display in console messages
100+
# - `:strings_path`: The path to the strings.xml file of the library to merge into the main one
101+
# - `:exclusions`: An array of strings keys to exclude during merge. Any of those keys from the library's `strings.xml` will be skipped and won't be merged into the main one.
102+
# @return [Boolean] True if at least one string from the library has been added to (or has updated) the main strings file.
95103
def self.merge_lib(main, library)
96104
UI.message("Merging #{library[:library]} strings into #{main}")
97105
main_strings = File.open(main) { |f| Nokogiri::XML(f, nil, Encoding::UTF_8.to_s) }

0 commit comments

Comments
 (0)