Closed StarProxima closed 3 months ago
@Tienisto Hi, thanks for the great package! I'm having trouble overriding some translations with multiple variables
Describe the bug Translation overrides do not work with multiple parameters
To Reproduce
shared: pillows(param=pillows): zero: $pillows pillow one: $pillows pillows few: $pillows pillows other: $pillows pillows winnersAwards(param=winners): zero: '' one: $winners winner will receive @:shared.pillows few: $winners winner will receive $pillowsList and @:shared.pillows respectively other: $winners winners will receive $pillowsList and @:shared.pillows respectively
LocaleSettings.overrideTranslationsFromMap( locale: LocaleSettings.currentLocale, isFlatMap: false, map: { 'shared': { 'pillows(param=pillows)': { 'zero': r'$pillows pillow', 'one': r'$pillows pillows', 'few': r'$pillows pillows', 'other': r'$pillows pillows', }, }, 'winnersAwards(param=winners)': { 'zero': '', 'one': r'$winners winner will receive @:shared.pillows', 'few': r'$winners winner will receive $pillowsList and @:shared.pillows respectively', 'other': r'$winners winners will receive $pillowsList and @:shared.pillows respectively', }, }, );
Error
NoSuchMethodError (NoSuchMethodError: Closure call with mismatched arguments: function '_extension#1._flatMapFunction.<anonymous closure>' Receiver: Closure: ({required num pillows}) => String Tried calling: _extension#1._flatMapFunction.<anonymous closure>(pillows: 100, pillowsList: "300, 200", winners: 3) Found: _extension#1._flatMapFunction.<anonymous closure>({required num pillows}) => String)
StackTrace
_objectNoSuchMethod (c:\Users\maksp\fvm\versions\3.22.1\bin\cache\pkg\sky_engine\lib\_internal\vm\lib\object_patch.dart:85) Function._apply (c:\Users\maksp\fvm\versions\3.22.1\bin\cache\pkg\sky_engine\lib\_internal\vm\lib\function_patch.dart:11) Function.apply (c:\Users\maksp\fvm\versions\3.22.1\bin\cache\pkg\sky_engine\lib\_internal\vm\lib\function_patch.dart:35) TranslationOverridesStringExt.applyLinks.<anonymous closure> (c:\Users\maksp\AppData\Local\Pub\Cache\hosted\pub.dev\slang-3.31.0\lib\api\translation_overrides.dart:155) _replaceBetween (c:\Users\maksp\AppData\Local\Pub\Cache\hosted\pub.dev\slang-3.31.0\lib\src\builder\utils\string_interpolation_extensions.dart:153) StringInterpolationExtensions.replaceDartNormalizedInterpolation (c:\Users\maksp\AppData\Local\Pub\Cache\hosted\pub.dev\slang-3.31.0\lib\src\builder\utils\string_interpolation_extensions.dart:78) TranslationOverridesStringExt.applyLinks (c:\Users\maksp\AppData\Local\Pub\Cache\hosted\pub.dev\slang-3.31.0\lib\api\translation_overrides.dart:134) TranslationOverridesStringExt.applyParamsAndLinks (c:\Users\maksp\AppData\Local\Pub\Cache\hosted\pub.dev\slang-3.31.0\lib\api\translation_overrides.dart:171) TranslationOverrides.plural (c:\Users\maksp\AppData\Local\Pub\Cache\hosted\pub.dev\slang-3.31.0\lib\api\translation_overrides.dart:50) TranslationsTournamentsRu.winnersAwards (c:\Git\sleeptery\packages\core\lib\src\locales\translations.g.dart:636) _ResultsBlock.build.<anonymous closure>.<anonymous closure>.<anonymous closure> (c:\Git\sleeptery\lib\features\tournaments\presentation\tournaments_screen\view\widgets\results_block.dart:76
Expected behavior Everything works without errors
Thank you. This should be fixed in 3.31.1
@Tienisto Hi, thanks for the great package! I'm having trouble overriding some translations with multiple variables
Describe the bug Translation overrides do not work with multiple parameters
To Reproduce
Error
StackTrace
Expected behavior Everything works without errors