Skip to content
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

701: Fix entry/display of translations that start with a blank line. #715

Merged
merged 8 commits into from Jun 7, 2017

Conversation

@toolstack
Copy link
Contributor

toolstack commented May 9, 2017

Resolves #701.

@toolstack toolstack requested a review from ocean90 May 9, 2017
@toolstack toolstack added this to the 2.4 milestone May 9, 2017
@toolstack toolstack added the [Type] Bug label May 9, 2017
Copy link
Member

ocean90 left a comment

Needs an update of the minified file and a version bump.

* @return string The prepared string for output.
*/
function prepare_translation_textarea( $text ) {
if( gp_startswith( $text, "\r\n" ) ) {

This comment has been minimized.

Copy link
@ocean90

ocean90 May 30, 2017

Member

Missing whitespace

This comment has been minimized.

Copy link
@toolstack

toolstack May 30, 2017

Author Contributor

Fixed.

if( gp_startswith( $text, "\r\n" ) ) {
$text = "\r\n" . $text;
} else {
if( gp_startswith( $text, "\n" ) ) {

This comment has been minimized.

Copy link
@ocean90

ocean90 May 30, 2017

Member

Missing whitespace

This comment has been minimized.

Copy link
@toolstack

toolstack May 30, 2017

Author Contributor

Fixed.

*
* @return string The prepared string for output.
*/
function prepare_translation_textarea( $text ) {

This comment has been minimized.

Copy link
@ocean90

ocean90 May 30, 2017

Member

Missing gp_ prefix

This comment has been minimized.

Copy link
@toolstack

toolstack May 30, 2017

Author Contributor

Fixed.

@@ -130,7 +150,7 @@ function textareas( $entry, $permissions, $index = 0 ) {
</div>
<?php endif; ?>
<blockquote class="translation"><em><small><?php echo prepare_original( esc_translation( gp_array_get( $entry->translations, $index ) ) ); // WPCS: XSS ok. ?></small></em></blockquote>
<textarea class="foreign-text" name="translation[<?php echo esc_attr( $entry->original_id ); ?>][]" id="translation_<?php echo esc_attr( $entry->original_id ); ?>_<?php echo esc_attr( $index ); ?>" <?php echo $disabled; // WPCS: XSS ok. ?>><?php echo esc_translation( gp_array_get( $entry->translations, $index ) ); // WPCS: XSS ok. ?></textarea>
<textarea class="foreign-text" name="translation[<?php echo esc_attr( $entry->original_id ); ?>][]" id="translation_<?php echo esc_attr( $entry->original_id ); ?>_<?php echo esc_attr( $index ); ?>" <?php echo $disabled; // WPCS: XSS ok. ?>><?php echo prepare_translation_textarea( esc_translation( gp_array_get( $entry->translations, $index ) ) ); // WPCS: XSS ok. ?></textarea>

This comment has been minimized.

Copy link
@ocean90

ocean90 May 30, 2017

Member

Shouldn't this be the other way around? esc_translation( prepare_translation_textarea( … ) )

This comment has been minimized.

Copy link
@toolstack

toolstack May 30, 2017

Author Contributor

Doesn't really matter, I chose this way to make sure the extra lf was added as late as possible just in case.

@toolstack
Copy link
Contributor Author

toolstack commented May 30, 2017

Bumped asset loader version and the minified file is already included in the PR.

@toolstack
Copy link
Contributor Author

toolstack commented May 30, 2017

The blocking conflict is because we've merged another update to the minification file in to develop and of course git can't resolve the issue. I'll have to rebase the PR.

@toolstack toolstack force-pushed the 701-translations-starting-with-line-break branch from f7565f2 to 09c0740 May 31, 2017
@toolstack
Copy link
Contributor Author

toolstack commented May 31, 2017

PR rebased.

@toolstack toolstack force-pushed the 701-translations-starting-with-line-break branch from 09c0740 to 531d83a Jun 6, 2017
@ocean90
ocean90 approved these changes Jun 6, 2017
@ocean90 ocean90 merged commit 83e672b into develop Jun 7, 2017
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@ocean90 ocean90 deleted the 701-translations-starting-with-line-break branch Jun 7, 2017
@toolstack toolstack modified the milestones: 3.0, 2.4 Aug 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.