document localization template interpolation, like ${0}
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 142
- Forks
- 230
- PR merge metrics
- No merged PRs in 30d
Description
please update or expand the localization docs to help those (manually) creating templates for runtime localization that show how to use interpolation and what does and doesn't work, for example a template such as `atemplate: (args)=>html'some text ${ args.named }` does not appear to work and it's unclear if the indexed approach shown below is the only option available
thanks very much.
```js
// templates has key with the template:
check_email: html`checking ${ 0 }`,
...
check_email_does_not_work: (args)=>html`checking ${ args.address }`
// unclear how to make the above templates work, except for the index approach 0, 1...
// and whether this is the only option available for logic in templates
const address = `user@host`;
msg(str`checking...${address}`, {id:'check_email'})
// like
greeting: html`Hola Mundo`,
parameterized: html`Hola ${0}`,
htmlOrderChange: html`2:${1} 1:${0}`,
```
docs at:
https://lit.dev/docs/localization/overview/
current source of information in tests:
https://github.com/search?q=repo%3Alit%2Flit%20localize%20%7B0%7D&type=code
https://github.com/lit/lit/blob/a66737fc9b861999b00ccad01edb925172b7f711/packages/localize-tools/testdata/build-runtime-xliff/goldens/tsout/zh_CN.ts#L5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the localization overview at https://lit.dev/docs/localization/overview/ and compare its interpolation guidance with the referenced localize-tools test output in packages/localize-tools/testdata/build-runtime-xliff/goldens/tsout/zh_CN.ts. Document how indexed and named interpolation work, including the limitations shown by the examples, and verify that the resulting guidance answers whether other template logic is supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation, localization
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100