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

Projects
None yet
2 participants
@toolstack
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 bug label May 9, 2017

@ocean90

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

Show outdated Hide outdated gp-templates/helper-functions.php
* @return string The prepared string for output.
*/
function prepare_translation_textarea( $text ) {
if( gp_startswith( $text, "\r\n" ) ) {

This comment has been minimized.

@ocean90

ocean90 May 30, 2017

Member

Missing whitespace

@ocean90

ocean90 May 30, 2017

Member

Missing whitespace

This comment has been minimized.

@toolstack

toolstack May 30, 2017

Contributor

Fixed.

@toolstack

toolstack May 30, 2017

Contributor

Fixed.

Show outdated Hide outdated gp-templates/helper-functions.php
if( gp_startswith( $text, "\r\n" ) ) {
$text = "\r\n" . $text;
} else {
if( gp_startswith( $text, "\n" ) ) {

This comment has been minimized.

@ocean90

ocean90 May 30, 2017

Member

Missing whitespace

@ocean90

ocean90 May 30, 2017

Member

Missing whitespace

This comment has been minimized.

@toolstack

toolstack May 30, 2017

Contributor

Fixed.

@toolstack

toolstack May 30, 2017

Contributor

Fixed.

Show outdated Hide outdated gp-templates/helper-functions.php
*
* @return string The prepared string for output.
*/
function prepare_translation_textarea( $text ) {

This comment has been minimized.

@ocean90

ocean90 May 30, 2017

Member

Missing gp_ prefix

@ocean90

ocean90 May 30, 2017

Member

Missing gp_ prefix

This comment has been minimized.

@toolstack

toolstack May 30, 2017

Contributor

Fixed.

@toolstack

toolstack May 30, 2017

Contributor

Fixed.

Show outdated Hide outdated gp-templates/helper-functions.php
@@ -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.

@ocean90

ocean90 May 30, 2017

Member

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

@ocean90

ocean90 May 30, 2017

Member

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

This comment has been minimized.

@toolstack

toolstack May 30, 2017

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

toolstack May 30, 2017

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

This comment has been minimized.

Show comment
Hide comment
@toolstack

toolstack May 30, 2017

Contributor

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

Contributor

toolstack commented May 30, 2017

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

@toolstack

This comment has been minimized.

Show comment
Hide comment
@toolstack

toolstack May 30, 2017

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@toolstack

toolstack May 31, 2017

Contributor

PR rebased.

Contributor

toolstack commented May 31, 2017

PR rebased.

@ocean90

ocean90 approved these changes Jun 6, 2017

@ocean90 ocean90 merged commit 83e672b into develop Jun 7, 2017

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