diff --git a/CHANGELOG.md b/CHANGELOG.md index ee1965786..a16bc2f12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ _None_ ### New Features -_None_ +- Add an opt-in `allow_omitted_placeholders` option to `ios_lint_localizations` so translations that omit the trailing base language placeholders, keeping the others at the same positions and types, are not reported. [#779] ### Bug Fixes diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb index c93481502..0bc5e149c 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb @@ -38,7 +38,8 @@ def self.run_linter(params) input_dir: resolve_path(params[:input_dir]), base_lang: params[:base_lang], only_langs: params[:only_langs], - fail_on_strings_not_in_base_language: params[:fail_on_strings_not_in_base_language] + fail_on_strings_not_in_base_language: params[:fail_on_strings_not_in_base_language], + allow_omitted_placeholders: params[:allow_omitted_placeholders] ) end @@ -197,6 +198,15 @@ def self.available_options default_value: true, type: Boolean ), + FastlaneCore::ConfigItem.new( + key: :allow_omitted_placeholders, + env_name: 'FL_IOS_LINT_TRANSLATIONS_ALLOW_OMITTED_PLACEHOLDERS', + description: 'Accept translations that omit the trailing base language placeholders, as long as the ones they keep have the same positions and types (e.g. "One word" for "%1$d word"). ' \ + 'Omitting a leading or middle placeholder, malformed placeholders, extra placeholders and type mismatches are still reported', + optional: true, + default_value: false, + type: Boolean + ), ] end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb index b37cfa131..979011d3b 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb @@ -11,6 +11,15 @@ class L10nLinterHelper DEFAULT_BASE_LANG = 'en' CONFIG_FILE_NAME = 'swiftgen-stringtypes.yml' + # A printf-style placeholder at the start of a string, capturing its optional `N$` position, its length modifier and its conversion character. + # `*` widths and precisions are deliberately not matched, as they consume an extra argument. + PLACEHOLDER_SPEC = /(?:(\d+)\$)?[-+ #0']*\d*(?:\.\d*)?(hh|h|ll|l|q|L|z|t|j)?([@dDiuUxXoOfFeEgGaAcCsSp])/ + PLACEHOLDER_REGEX = /\A%#{PLACEHOLDER_SPEC}/ + # A placeholder typed with a lookalike of `%` (fullwidth, Arabic or small percent sign), which Foundation prints verbatim + LOOKALIKE_PLACEHOLDER_REGEX = /[\uFF05\u066A\uFE6A]#{PLACEHOLDER_SPEC}/ + # Length modifiers that all read a 64-bit integer on Apple platforms + LONG_INTEGER_LENGTHS = %w[l ll q z t j].freeze + attr_reader :install_path, :version # @param [String] install_path The path to install SwiftGen to. Usually something like "$PROJECT_DIR/vendor/swiftgen/#{SWIFTGEN_VERSION}". @@ -61,11 +70,101 @@ def install_swiftgen! # @param [String] input_dir The path (ideally absolute) to the directory containing the `.lproj` folders to parse # @param [String] base_lang The code name (i.e the basename of one of the `.lproj` folders) of the locale to use as the baseline # @param [String] fail_on_strings_not_in_base_language Whether to fail on strings not in base language + # @param [Boolean] allow_omitted_placeholders Whether to accept translations that omit the trailing base language placeholders. # @return [Hash>] A hash of violations, keyed by language code, whose values are the list of violation messages for that language # - def run(input_dir:, base_lang: DEFAULT_BASE_LANG, only_langs: nil, fail_on_strings_not_in_base_language: true) + def run(input_dir:, base_lang: DEFAULT_BASE_LANG, only_langs: nil, fail_on_strings_not_in_base_language: true, allow_omitted_placeholders: false) check_swiftgen_installed || install_swiftgen! - find_diffs(input_dir: input_dir, base_lang: base_lang, only_langs: only_langs, fail_on_strings_not_in_base_language: fail_on_strings_not_in_base_language) + find_diffs( + input_dir: input_dir, + base_lang: base_lang, + only_langs: only_langs, + fail_on_strings_not_in_base_language: fail_on_strings_not_in_base_language, + allow_omitted_placeholders: allow_omitted_placeholders + ) + end + + # Whether a translation is safe to format with the base string's arguments while using only some of them. + # + # That's the case when the translation keeps the base string's first placeholders, at the same positions and with the same types, and drops the rest. + # Unused trailing arguments are ignored at runtime, so this is legitimate when a language doesn't need a value. + # Omitting a leading or middle placeholder isn't, because Foundation compacts gaps in positional arguments and would format the wrong value. + # + # For example, the English plural "one" form "%1$ld word" can be translated to Romanian as "Un cuvânt", discarding `%1$ld`, + # because Romanian uses "one" only for exactly 1, and "un" already says it. + # + # This only checks the omission is safe at runtime, not that it's right for the language. + # Russian also has a "one" form, but it covers 1, 21, 31, 101…, so "Одно слово" would wrongly read as one word for 21 words, and this would still accept it. + # + # @param [String] base The string in the base language + # @param [String] translation The translated string + # @return [Boolean] `false` if the translation is blank, or either string has a placeholder this can't parse, like the incomplete `%1$l` + # + def self.only_omits_placeholders?(base:, translation:) + return false if translation.strip.empty? + + base_placeholders = placeholders(base) + translation_placeholders = placeholders(translation) + return false if base_placeholders.nil? || translation_placeholders.nil? + return false unless translation_placeholders.size < base_placeholders.size + return false unless translation_placeholders.keys.sort == (1..translation_placeholders.size).to_a + + translation_placeholders.all? { |position, type| base_placeholders[position] == type } + end + + # Parses the printf-style placeholders of a string. + # + # @param [String] string The string to parse + # @return [Hash, nil] The placeholder types keyed by argument position, + # or `nil` if a placeholder is malformed or uses a lookalike of `%`, the string mixes positional and sequential placeholders, or a position is reused with a different type + # + def self.placeholders(string) + return nil if LOOKALIKE_PLACEHOLDER_REGEX.match?(string) + + placeholders = {} + styles = [] + index = 0 + while (index = string.index('%', index)) + if string[index + 1] == '%' + index += 2 + next + end + + match = PLACEHOLDER_REGEX.match(string[index..]) + return nil if match.nil? + + styles << (match[1].nil? ? :sequential : :positional) + position = match[1]&.to_i || styles.count + type = placeholder_type(length: match[2], conversion: match[3]) + return nil if placeholders.key?(position) && placeholders[position] != type + + placeholders[position] = type + index += match[0].length + end + styles.uniq.size > 1 ? nil : placeholders + end + + # The argument a placeholder reads, as its conversion with only the length modifiers that change it. + # Conversions and lengths are kept distinct, rather than grouped like SwiftGen does, because reading an argument with the wrong size truncates it: `%hhd` shows 300 as 44. + # + # @param [String, nil] length The length modifier, like `l` in `%ld` + # @param [String] conversion The conversion character, like `d` in `%ld` + # @return [String] A normalized placeholder, like `ld` for both `%ld` and `%qd` + # + def self.placeholder_type(length:, conversion:) + case conversion + when 'i' then conversion = 'd' + when 'D', 'U', 'O' + length = 'l' + conversion = conversion.downcase + end + + case conversion + when 'd', 'o', 'u', 'x', 'X' then "#{LONG_INTEGER_LENGTHS.include?(length) ? 'l' : length}#{conversion}" + when 'f', 'F', 'e', 'E', 'g', 'G', 'a', 'A' then "#{'L' if length == 'L'}#{conversion}" + when 'c', 's' then length == 'l' ? conversion.upcase : conversion + else conversion + end end ################## @@ -141,6 +240,12 @@ def generate_swiftgen_config!(input_dir, output_dir, only_langs: nil) [config_file, langs] end + # @return [Hash] The raw `Localizable.strings` translations for a locale, keyed by string key as SwiftGen prints it, with newlines escaped + def strings_for(input_dir, lang) + Fastlane::Helper::Ios::L10nHelper.read_strings_file_as_hash(path: File.join(input_dir, "#{lang}.lproj", 'Localizable.strings')) + .transform_keys { |key| key.gsub("\n", '\n').gsub("\r", '\r') } + end + # Returns a Hash mapping the list of expected parameter types for each of the keys based in the %… placeholders found in their `.strings` files # # @param [String] dir The temporary directory in which the file to sort lines for is located @@ -162,11 +267,12 @@ def placeholder_types_for_keys(dir, lang) # @param [String] base_lang The base language used as source of truth that all other languages will be compared against # @param [Array] only_langs The list of languages to limit the generation for. Useful to focus only on a couple of issues or just one language # @param [Boolean] fail_on_strings_not_in_base_language Whether to fail on strings not in base language + # @param [Boolean] allow_omitted_placeholders Whether to accept translations that omit the trailing base language placeholders # @return [Hash>] A hash of violations, keyed by language code, whose values are the list of violation messages for that language # # @note The returned Hash contains keys only for locales with violations. Locales parsed but without any violations found will not appear in the resulting hash. # - def find_diffs(input_dir:, base_lang:, only_langs: nil, fail_on_strings_not_in_base_language: true) + def find_diffs(input_dir:, base_lang:, only_langs: nil, fail_on_strings_not_in_base_language: true, allow_omitted_placeholders: false) Dir.mktmpdir('a8c-lint-translations-') do |tmpdir| # Run SwiftGen langs = only_langs.nil? ? nil : (only_langs + [base_lang]).uniq @@ -176,15 +282,26 @@ def find_diffs(input_dir:, base_lang:, only_langs: nil, fail_on_strings_not_in_b # Run diffs params_for_base_lang = placeholder_types_for_keys(tmpdir, base_lang) langs.delete(base_lang) + base_strings = nil return langs.map do |lang| params_for_lang = placeholder_types_for_keys(tmpdir, lang) + lang_strings = nil # If the lang ends up not having any translation at all (e.g. a `.lproj` without any `.strings` file in it but maybe just a storyboard or assets catalog), ignore it next nil if params_for_lang.nil? || params_for_lang.empty? violations = params_for_lang.map do |key, param_types| next "`#{key}` was unexpected, as it is not present in the base locale." if params_for_base_lang[key].nil? && fail_on_strings_not_in_base_language - next "`#{key}` expected placeholders for #{params_for_base_lang[key]} but found #{param_types} instead." if !params_for_base_lang[key].nil? && params_for_base_lang[key] != param_types + next if params_for_base_lang[key].nil? || params_for_base_lang[key] == param_types + + # SwiftGen's type lists drop argument positions, so omissions are checked against the raw strings instead. + if allow_omitted_placeholders + base_strings ||= strings_for(input_dir, base_lang) + lang_strings ||= strings_for(input_dir, lang) + next if self.class.only_omits_placeholders?(base: base_strings[key].to_s, translation: lang_strings[key].to_s) + end + + "`#{key}` expected placeholders for #{params_for_base_lang[key]} but found #{param_types} instead." end.compact [lang, violations] unless violations.empty? diff --git a/spec/ios_l10n_linter_helper_spec.rb b/spec/ios_l10n_linter_helper_spec.rb new file mode 100644 index 000000000..569d645e5 --- /dev/null +++ b/spec/ios_l10n_linter_helper_spec.rb @@ -0,0 +1,111 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Fastlane::Helper::Ios::L10nLinterHelper do + describe '.only_omits_placeholders?' do + def only_omits?(base, translation) + described_class.only_omits_placeholders?(base: base, translation: translation) + end + + it 'accepts dropping the only placeholder' do + expect(only_omits?('%1$ld word', 'Un cuvânt')).to be true + end + + it 'accepts dropping a trailing positional placeholder' do + expect(only_omits?('Post %1$@ has %2$@ like.', 'Postarea %1$@ are o apreciere.')).to be true + end + + it 'accepts dropping several trailing positional placeholders' do + expect(only_omits?('%1$@, %2$d, %3$@', '%1$@ doar')).to be true + end + + it 'rejects dropping a leading positional placeholder, as Foundation would format the first argument in its place' do + expect(only_omits?('Post %1$@ has %2$@ likes.', 'O postare are %2$@ aprecieri.')).to be false + end + + it 'rejects dropping a middle positional placeholder, as Foundation would shift the arguments after it' do + expect(only_omits?('%1$@, %2$d, %3$@', '%1$@, %3$@')).to be false + end + + it 'accepts dropping a trailing sequential placeholder' do + expect(only_omits?('%@ and %d', 'doar %@')).to be true + end + + it 'rejects dropping a leading sequential placeholder, as it shifts the remaining arguments' do + expect(only_omits?('%@ and %d', 'doar %d')).to be false + end + + it 'treats length modifiers that read the same size of integer as the same type' do + expect(only_omits?('%1$ld of %2$ld', '%1$lld')).to be true + expect(only_omits?('%1$ld of %2$ld', '%1$zd')).to be true + expect(only_omits?('%1$ld of %2$ld', '%1$D')).to be true + expect(only_omits?('%1$d of %2$d', '%1$i')).to be true + end + + it 'rejects a length modifier that reads a different size of integer, as it would truncate the value' do + expect(only_omits?('%1$ld of %2$ld', '%1$d')).to be false + expect(only_omits?('%1$ld of %2$ld', '%1$hhd')).to be false + expect(only_omits?('%1$d of %2$d', '%1$hd')).to be false + end + + it 'rejects a different conversion of the same kind of argument' do + expect(only_omits?('%1$ld of %2$ld', '%1$lu')).to be false + expect(only_omits?('%1$f of %2$f', '%1$Lf')).to be false + expect(only_omits?('%1$C and %2$C', '%1$c')).to be false + end + + it 'ignores length modifiers that do not change the argument read' do + expect(only_omits?('%1$f of %2$f', '%1$lf')).to be true + expect(only_omits?('%1$C and %2$C', '%1$lc')).to be true + end + + it 'ignores escaped percent signs' do + expect(only_omits?('%1$d%% of %2$d', '%1$d%%')).to be true + end + + it 'rejects a placeholder whose type differs from the base' do + expect(only_omits?('%1$d of %2$@', '%1$@')).to be false + end + + it 'rejects a placeholder at a position missing from the base' do + expect(only_omits?('%1$d of %2$@', '%3$@')).to be false + end + + it 'rejects a translation with as many placeholders as the base' do + expect(only_omits?('%1$d items', '%1$d elemente')).to be false + end + + it 'rejects a blank translation' do + expect(only_omits?('%1$@ of %2$@ used', '')).to be false + expect(only_omits?('%1$@ of %2$@ used', ' ')).to be false + end + + it 'rejects a placeholder typed with a lookalike of the percent sign' do + expect(only_omits?('String %@ here, %d times.', "String \u{FF05}@ here.")).to be false + expect(only_omits?('String %1$@ here, %2$d times.', "String \u{066A}1$@ here.")).to be false + expect(only_omits?('String %1$@ here, %2$d times.', "String \u{FE6A}1$@ here.")).to be false + end + + it 'accepts a lookalike of the percent sign that is not a placeholder' do + expect(only_omits?('%1$d%% of %2$@', "%1$d\u{066A} مكتمل")).to be true + expect(only_omits?('%1$d%% of %2$@', "%1$d\u{FF05}完了")).to be true + end + + it 'rejects an incomplete placeholder' do + expect(only_omits?('%1$ld words', '%1$l 个字')).to be false + end + + it 'rejects a `*` width, as it consumes an extra argument' do + expect(only_omits?('%1$d and %2$d', '%*d')).to be false + end + + it 'rejects mixing positional and sequential placeholders' do + expect(only_omits?('%1$@ %2$d %3$@', '%1$@ %d')).to be false + end + + it 'rejects reusing a position with a different type' do + expect(only_omits?('%1$d %2$@ %3$@', '%1$d %1$@')).to be false + end + end +end diff --git a/spec/ios_lint_localizations_spec.rb b/spec/ios_lint_localizations_spec.rb index 9afbab6ca..fb9a52e62 100644 --- a/spec/ios_lint_localizations_spec.rb +++ b/spec/ios_lint_localizations_spec.rb @@ -65,8 +65,10 @@ # @param [Boolean, nil] fail_on_strings_not_in_base_language If `nil`, the test will run the action with the default `fail_on_strings_not_in_base_language` parameter value. # If a `Boolean` value is given, it will pass that. # Controls whether to report violations when finding strings in translations that are not present in the base language. + # @param [Boolean, nil] allow_omitted_placeholders If `nil`, the test will run the action with the default `allow_omitted_placeholders` parameter value. + # If a `Boolean` value is given, it will pass that. # - def run_l10n_linter_test(data_file:, check_duplicate_keys: nil, fail_on_strings_not_in_base_language: nil) + def run_l10n_linter_test(data_file:, check_duplicate_keys: nil, fail_on_strings_not_in_base_language: nil, allow_omitted_placeholders: nil) # Arrange: Prepare test files test_file = File.join(File.dirname(__FILE__), 'test-data', 'translations', 'ios_lint_localizations', "#{data_file}.yaml") yml = YAML.load_file(test_file) @@ -90,6 +92,7 @@ def run_l10n_linter_test(data_file:, check_duplicate_keys: nil, fail_on_strings_ } parameters[:check_duplicate_keys] = check_duplicate_keys unless check_duplicate_keys.nil? parameters[:fail_on_strings_not_in_base_language] = fail_on_strings_not_in_base_language unless fail_on_strings_not_in_base_language.nil? + parameters[:allow_omitted_placeholders] = allow_omitted_placeholders unless allow_omitted_placeholders.nil? result = run_described_fastlane_action(parameters) # Assert @@ -227,6 +230,22 @@ def run_l10n_linter_test(data_file:, check_duplicate_keys: nil, fail_on_strings_ fail_on_strings_not_in_base_language: true ) end + + it 'still reports placeholders typed with a lookalike of the percent sign when allow_omitted_placeholders is true' do + run_l10n_linter_test(data_file: 'tricky-chars', allow_omitted_placeholders: true) + end + + it 'reports translations that omit placeholders by default' do + run_l10n_linter_test(data_file: 'omitted-placeholders-not-allowed') + end + + it 'reports translations that omit placeholders when allow_omitted_placeholders is false' do + run_l10n_linter_test(data_file: 'omitted-placeholders-not-allowed', allow_omitted_placeholders: false) + end + + it 'accepts translations that only omit placeholders when allow_omitted_placeholders is true, but still reports malformed, extra, and mismatched ones' do + run_l10n_linter_test(data_file: 'omitted-placeholders-allowed', allow_omitted_placeholders: true) + end end # Regression coverage for the unquoted-key/value parsing in `StringsFileValidationHelper`, which used diff --git a/spec/test-data/translations/ios_lint_localizations/omitted-placeholders-allowed.yaml b/spec/test-data/translations/ios_lint_localizations/omitted-placeholders-allowed.yaml new file mode 100644 index 000000000..67e78b4c6 --- /dev/null +++ b/spec/test-data/translations/ios_lint_localizations/omitted-placeholders-allowed.yaml @@ -0,0 +1,40 @@ +test_data: + en: | + "word_count_one" = "%1$ld word"; + "word_count_zero" = "%1$ld words"; + "multiline\nkey" = "%1$ld\nwords"; + "latest_post_likes" = "The latest post %1$@ has received %2$@ like."; + "leading_omitted" = "Post %1$@ has %2$@ likes."; + "middle_omitted" = "A %1$@, B %2$d, C %3$@"; + "sequential_trailing_omitted" = "%@ and %d"; + "sequential_leading_omitted" = "%@ and %d"; + "type_mismatch" = "%1$d items"; + "extra_placeholder" = "%1$d items"; + "length_mismatch" = "%1$ld of %2$ld"; + "incomplete_placeholder" = "%1$ld words"; + "empty_translation" = "%1$@ of %2$@ used"; + ro: | + "word_count_one" = "Un cuvânt"; + "word_count_zero" = "Niciun cuvânt"; + "multiline\nkey" = "Un\ncuvânt"; + "latest_post_likes" = "Ultimul articol %1$@ a avut o apreciere."; + "leading_omitted" = "Un articol are %2$@ aprecieri."; + "middle_omitted" = "A %1$@, C %3$@"; + "sequential_trailing_omitted" = "doar %@"; + "sequential_leading_omitted" = "doar %d"; + "type_mismatch" = "%1$@ elemente"; + "extra_placeholder" = "%1$d elemente %2$@"; + "length_mismatch" = "%1$hhd"; + "incomplete_placeholder" = "%1$l cuvinte"; + "empty_translation" = ""; + +result: + ro: + - "`empty_translation` expected placeholders for [String,String] but found [] instead." + - "`extra_placeholder` expected placeholders for [Int] but found [Int,String] instead." + - "`incomplete_placeholder` expected placeholders for [Int] but found [] instead." + - "`leading_omitted` expected placeholders for [String,String] but found [String] instead." + - "`length_mismatch` expected placeholders for [Int,Int] but found [Int] instead." + - "`middle_omitted` expected placeholders for [String,Int,String] but found [String,String] instead." + - "`sequential_leading_omitted` expected placeholders for [String,Int] but found [Int] instead." + - "`type_mismatch` expected placeholders for [Int] but found [String] instead." diff --git a/spec/test-data/translations/ios_lint_localizations/omitted-placeholders-not-allowed.yaml b/spec/test-data/translations/ios_lint_localizations/omitted-placeholders-not-allowed.yaml new file mode 100644 index 000000000..ebda7fc08 --- /dev/null +++ b/spec/test-data/translations/ios_lint_localizations/omitted-placeholders-not-allowed.yaml @@ -0,0 +1,45 @@ +test_data: + en: | + "word_count_one" = "%1$ld word"; + "word_count_zero" = "%1$ld words"; + "multiline\nkey" = "%1$ld\nwords"; + "latest_post_likes" = "The latest post %1$@ has received %2$@ like."; + "leading_omitted" = "Post %1$@ has %2$@ likes."; + "middle_omitted" = "A %1$@, B %2$d, C %3$@"; + "sequential_trailing_omitted" = "%@ and %d"; + "sequential_leading_omitted" = "%@ and %d"; + "type_mismatch" = "%1$d items"; + "extra_placeholder" = "%1$d items"; + "length_mismatch" = "%1$ld of %2$ld"; + "incomplete_placeholder" = "%1$ld words"; + "empty_translation" = "%1$@ of %2$@ used"; + ro: | + "word_count_one" = "Un cuvânt"; + "word_count_zero" = "Niciun cuvânt"; + "multiline\nkey" = "Un\ncuvânt"; + "latest_post_likes" = "Ultimul articol %1$@ a avut o apreciere."; + "leading_omitted" = "Un articol are %2$@ aprecieri."; + "middle_omitted" = "A %1$@, C %3$@"; + "sequential_trailing_omitted" = "doar %@"; + "sequential_leading_omitted" = "doar %d"; + "type_mismatch" = "%1$@ elemente"; + "extra_placeholder" = "%1$d elemente %2$@"; + "length_mismatch" = "%1$hhd"; + "incomplete_placeholder" = "%1$l cuvinte"; + "empty_translation" = ""; + +result: + ro: + - "`empty_translation` expected placeholders for [String,String] but found [] instead." + - "`extra_placeholder` expected placeholders for [Int] but found [Int,String] instead." + - "`incomplete_placeholder` expected placeholders for [Int] but found [] instead." + - "`latest_post_likes` expected placeholders for [String,String] but found [String] instead." + - "`leading_omitted` expected placeholders for [String,String] but found [String] instead." + - "`length_mismatch` expected placeholders for [Int,Int] but found [Int] instead." + - "`middle_omitted` expected placeholders for [String,Int,String] but found [String,String] instead." + - "`multiline\\nkey` expected placeholders for [Int] but found [] instead." + - "`sequential_leading_omitted` expected placeholders for [String,Int] but found [Int] instead." + - "`sequential_trailing_omitted` expected placeholders for [String,Int] but found [String] instead." + - "`type_mismatch` expected placeholders for [Int] but found [String] instead." + - "`word_count_one` expected placeholders for [Int] but found [] instead." + - "`word_count_zero` expected placeholders for [Int] but found [] instead."