Problem
The default script heuristic ignores strings where the first character is a non-letter character:
If the first character is a lowercase English letter ([a-z]) or is any non-letter character, it is ignored.
This means template literals that start with a variable like:
const message = `${organization.name} was successfully deleted!`;
const message = `${user.email}'s role was updated to ${user.role}.`;
...are not extracted, because the resolved first character is $ (from ${}), which is a non-letter. However, these are clearly translatable natural language strings — they just happen to start with a placeholder.
Proposed heuristic change
If a string in script context starts with a template expression (${...}) followed by either:
- a space (e.g.
`${name} was successfully deleted!`)
's (e.g. `${name}'s role was updated`)
...it should be extracted by default, since these patterns strongly indicate natural language content meant for users.
Other characters that commonly follow a leading ${...} — such as /, ?, :, -, ., or another $ — are structural/technical (paths, query strings, class names, filenames) and should continue to be ignored.
Current workaround
The only workaround is adding // @wc-include above every such string:
// @wc-include
const message = `${organization.name} was successfully deleted!`;
This is repetitive and easy to miss, especially when the pattern is common across many files.
Problem
The default script heuristic ignores strings where the first character is a non-letter character:
This means template literals that start with a variable like:
...are not extracted, because the resolved first character is
$(from${}), which is a non-letter. However, these are clearly translatable natural language strings — they just happen to start with a placeholder.Proposed heuristic change
If a string in script context starts with a template expression (
${...}) followed by either:`${name} was successfully deleted!`)'s(e.g.`${name}'s role was updated`)...it should be extracted by default, since these patterns strongly indicate natural language content meant for users.
Other characters that commonly follow a leading
${...}— such as/,?,:,-,., or another$— are structural/technical (paths, query strings, class names, filenames) and should continue to be ignored.Current workaround
The only workaround is adding
// @wc-includeabove every such string:This is repetitive and easy to miss, especially when the pattern is common across many files.