-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i18n: Make texts easier to translate with fewer components #3364
Conversation
@@ -90,7 +88,7 @@ const RemovePurchase = React.createClass( { | |||
<CompactCard className="remove-purchase__card" onClick={ this.openDialog }> | |||
<a href="#"> | |||
<Gridicon icon="trash" /> | |||
{ this.translate( 'Remove %(productName)s', { args: { productName } } ) } | |||
{ this.translate( 'Remove %(productName)s', { args: { productName: productName } } ) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if your version already represents this through ES6 or similar.
5083e04
to
8571bce
Compare
} ) | ||
} | ||
{ ' ' } | ||
{ this.translate( 'You will not be able to reuse it again without purchasing a new subscription.', { | ||
context: "Removal confirmation on Manage Purchase page", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was the removal of this context
intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's not very useful information for a translator. A context is meant to create the ability to translate two strings differently depending on the location of the original text. This text will not appear anywhere else, so any additional information to a translator is suited well in a comment (which already exists).
ce46b5a
to
8cec93b
Compare
8cec93b
to
3a3662d
Compare
👍 Tested. 🚢 |
Thanks @gwwar! |
In these texts we have quite a few components of the form:
{{tag}}%(variable){{/tag}
To a translator this is potentially very confusing text. Therefore, if a tag includes only a variable, we can make the whole thing a component:
{{variable/}}
and use{ components: { variable: <tag>{ variable }</tag> } }
@drewblaisdell this affects your strings at "Remove Purchase" but I have a hard time testing the strings if my approach really works. Could you please try? Thanks!