-
Notifications
You must be signed in to change notification settings - Fork 19
Enable POT generation from the Calypso source #13
Conversation
7606c02
to
8307d29
Compare
@deBhal could you help review this and get it ready to merge? Test from Calypso via |
Maybe long term the file generation code should be moved to |
8307d29
to
860b8f5
Compare
It looks like we're not picking up backticks. |
1ac4912
to
1b51f7f
Compare
@deBhal thanks for catching this. I'ts now fixed, could you take another look? Thanks! |
b2263c6
to
2eb65de
Compare
@@ -121,7 +111,7 @@ function makeDoubleQuoted( literal ) { | |||
|
|||
// ES6 string | |||
if ( literal.charAt( 0 ) === '`' ) { | |||
return '"' + literal.substring( 1, literal.length - 1 ).replace( /`/g, '\`' ).replace( /(\\|")/g, '\\$1' ) + '"'; | |||
return '"' + literal.substring( 1, literal.length - 1 ).replace( /`/g, '\`' ).replace( /(\\|")/g, '\\$1' ).replace( /\n/g, ' ' ) + '"'; |
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.
I'm a bit uncomfortable with the way the replace( /\n/g, ' ' )
introduces a break between what the developer sees and what translators see.
I don't see any translations right now that would go wrong right now ( https://translate.wordpress.com/projects/wpcom/fr/default/?filters%5Bterm%5D=%5Cn&filters%5Buser_login%5D=&filters%5Bstatus%5D=current_or_waiting_or_fuzzy_or_untranslated&filters%5Bview%5D=&filter=Filter&sort%5Bby%5D=priority&sort%5Bhow%5D=desc ), but it would be really hard to spot if something did come up.
If you were really keen to do this, we should add a complementary change to our runtime translate()
logic, but I think we should just use the linting rule.
Backticks are working nicely now, nice! Apart from the newline replace, this looks good. I'd suggest pull that out and and pop it into a new PR with the matching We'll also need to bump the version to pick up this and #10 after they both land. |
2eb65de
to
6a3aaa6
Compare
This enables parsing of babylon parser output which comes through Automattic/xgettext-js#11.
The main changes that need accomodation:
Literal
is split into subliterals of which we are only interested inStringLiteral
raw
property was moved intoextra.raw
StringLiteral
in aninnerProp
This is in order to make Automattic/wp-calypso#7152 possible.