pseudoLocalize function
Deterministically transforms value into a "pseudo-localized" string:
every vowel becomes its accented look-alike (see _accentMap's doc),
the string is padded to roughly 40% longer (the commonly-cited
average real-world translation expansion factor — stress-tests
overflow before a real translator ever touches the key), and the
whole thing is wrapped in [[...]] so a truncated render (a missing
closing ]]) is visually obvious too.
Deterministic and pure — the same value always produces the exact
same output, no randomness, so a golden/widget test asserting on the
result never flakes.
Implementation
String pseudoLocalize(String value) {
final accented = value.split('').map((c) => _accentMap[c] ?? c).join();
final paddingLength = (value.length * 0.4).ceil().clamp(1, 1 << 30);
final padding = 'x' * paddingLength;
return '[[$accented $padding]]';
}