Skip to content
This repository has been archived by the owner on Jan 9, 2019. It is now read-only.

i18n: Catch string concats #20

Open
akirk opened this issue Aug 17, 2016 · 1 comment
Open

i18n: Catch string concats #20

akirk opened this issue Aug 17, 2016 · 1 comment

Comments

@akirk
Copy link
Member

akirk commented Aug 17, 2016

Something like this shouldn't be possible: <Gridicon icon="create" /><span>{ translate( 'Post about ' ) + title } </span>.

I am not sure if and how we could catch it. This is probably just one of many ways that concat can happen.

@aduth
Copy link
Contributor

aduth commented Aug 17, 2016

Can the concatenation ever be valid? Thinking something like { '(' + translate( 'Edited' ) + ')' } to avoid creating a separate translation entry for (Edited). Correct me if that would be desirable though.

Given how many variations there are to this, it'd be hard to catch them all. Off the top of my head, here are a few variants:

<span>{ translate( 'Post about ' ) + title }</span>
<span>{ translate( 'Post about ' ) }{ title }</span>
<span>{ [ translate( 'Post about ' ), title ].join( '' ) }</span>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants