[go: up one dir, main page]

Improve sprintf.js implementation

In #362541 (closed) we tried improving sprintf to better handle duplicated % signs.

Based on the discussion in !95613 (comment 1083993090), we want to further improve our sprintf implementation:

sprintf should be to write all instances of %% to the buffer as % without treating it as a flag for the following char. In contrast our function is processing the output again when checking for named parameters so it incorrectly processes it as %{foo}.

Implementation plan:

  • Update the code in app/assets/javascripts/locale/sprintf.js
  • Update and ensure specs pass spec/frontend/locale/sprintf_spec.js
Edited by 🤖 GitLab Bot 🤖