Translated string memoization

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

https://gitlab.slack.com/archives/C4GFEUG90/p1508874605000057

Are our translation functions memoized or is it expensive to keep translating a static string in a computed?

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14836/diffs#note_44469694

For example,

...
computed: {
  isCakeDisplayText() {
     this.isCake ? __('is a cake') : __('is definitely not a cake');
  },
},
...

In this case, unless our translation functions automatically memoize, every time isCake is changed, we will re-translate a static string.

We should work this out and write some docs and a method for static strings if its a problem.

Edited Sep 28, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading