Navigation Menu

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

Merge similar translation strings and avoid using HTML tags in translation strings #295

Merged
merged 1 commit into from Feb 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions gp-includes/routes/glossary.php
Expand Up @@ -8,7 +8,7 @@ public function new_get() {
$translation_set = $glossary->translation_set_id ? GP::$translation_set->get( $glossary->translation_set_id ) : null;

if ( ! $translation_set ) {
$this->redirect_with_error( __( 'Cannot find translation set with this ID.', 'glotpress' ) );
$this->redirect_with_error( __( 'Couldn’t find translation set with this ID.', 'glotpress' ) );
return;
}

Expand All @@ -34,7 +34,7 @@ public function new_post() {
$translation_set = $new_glossary->translation_set_id ? GP::$translation_set->get( $new_glossary->translation_set_id ) : null;

if ( ! $translation_set ) {
$this->redirect_with_error( __( 'Cannot find translation set with this ID.', 'glotpress' ), gp_url( '/glossaries/-new', array( 'translation_set_id' => $new_glossary->translation_set_id ) ) );
$this->redirect_with_error( __( 'Couldn’t find translation set with this ID.', 'glotpress' ), gp_url( '/glossaries/-new', array( 'translation_set_id' => $new_glossary->translation_set_id ) ) );
return;
}

Expand Down
8 changes: 7 additions & 1 deletion gp-includes/template.php
Expand Up @@ -522,7 +522,13 @@ function gp_project_options_form( $project ) {
<dt><label for="source-url-template">' . __( 'Source file URL', 'glotpress' ) . '</label></dt>
<dd>
<input type="text" value="' . esc_html( $project->source_url_template() ) . '" name="source-url-template" id="source-url-template" />
<small>' . __( 'URL to a source file in the project. You can use <code>%file%</code> and <code>%line%</code>. Ex. <code>https://trac.example.org/browser/%file%#L%line%</code>', 'glotpress' ) .'</small>
<small>' . sprintf(
/* translators: 1: %file%, 2: %line%, 3: https://trac.example.org/browser/%file%#L%line% */
__( 'URL to a source file in the project. You can use %1$s and %2$s. Ex. %3$s', 'glotpress' ),
'<code>%file%</code>',
'<code>%line%</code>',
'<code>https://trac.example.org/browser/%file%#L%line%</code>'
) . '</small>
</dd>
</dl>
<p>
Expand Down
13 changes: 8 additions & 5 deletions gp-includes/validation.php
Expand Up @@ -3,7 +3,7 @@
class GP_Validation_Rules {

var $rules = array();

public $errors = array();
public $field_names;

Expand Down Expand Up @@ -91,10 +91,13 @@ public function construct_error_message( $rule ) {
$name_field = 'Translation ' . ( intval( substr( $name_field, 12 ) ) + 1 );
}

if ( 'positive' == $rule['kind'] )
return sprintf( __( 'The %s <strong>%s</strong> is invalid and should be %s!', 'glotpress' ), $type_field, $name_field, $name_rule );
else //if ( 'negative' == $rule['kind'] )
return sprintf( __( 'The %s <strong>%s</strong> is invalid and should not be %s!', 'glotpress' ), $type_field, $name_field, $name_rule );
if ( 'positive' == $rule['kind'] ) {
/* translators: 1: type of a validation field, 2: name of a validation field, 3: validation rule */
return sprintf( __( 'The %1$s %2$s is invalid and should be %3$s!', 'glotpress' ), $type_field, '<strong>' . $name_field . '</strong>', $name_rule );
} else { //if ( 'negative' == $rule['kind'] )
/* translators: 1: type of a validation field, 2: name of a validation field, 3: validation rule */
return sprintf( __( 'The %1$s %2$s is invalid and should not be %3$s!', 'glotpress' ), $type_field, '<strong>' . $name_field . '</strong>', $name_rule );
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion gp-templates/helper-functions.php
Expand Up @@ -87,7 +87,7 @@ function textareas( $entry, $permissions, $index = 0 ) {
$warning = each( $referenceable );
?>
<div class="warning secondary">
<?php printf( __( '<strong>Warning:</strong> %s', 'glotpress' ), esc_html( $warning['value'] ) ); ?>
<strong><?php _e( 'Warning:', 'glotpress' ); ?></strong> <?php echo esc_html( $warning['value'] ); ?>

<?php if( $can_approve ): ?>
<a href="#" class="discard-warning" key="<?php echo $warning['key'] ?>" index="<?php echo $index; ?>"><?php _e( 'Discard', 'glotpress' ); ?></a>
Expand Down
6 changes: 4 additions & 2 deletions gp-templates/profile-public.php
Expand Up @@ -16,9 +16,11 @@
$locale_keys = array_keys( $locales );

if ( 1 < count( $locales ) ) {
vprintf( __( '%s is a polyglot who knows %s but also knows %s.', 'glotpress' ), array_merge( array( $user->display_name ), $locale_keys ) );
/* translators: 1: display name of a user, 2: language, 3: language */
vprintf( __( '%1$s is a polyglot who knows %2$s but also knows %3$s.', 'glotpress' ), array_merge( array( $user->display_name ), $locale_keys ) );
} else if( ! empty ( $locale_keys ) ) {
printf( __( '%s is a polyglot who contributes to %s', 'glotpress' ), $user->display_name, $locale_keys[0] );
/* translators: 1: display name of a user, 2: language */
printf( __( '%1$s is a polyglot who contributes to %2$s', 'glotpress' ), $user->display_name, $locale_keys[0] );
}
?></dd>
<dt><?php _e( 'Member Since', 'glotpress' ); ?></dt>
Expand Down
8 changes: 7 additions & 1 deletion gp-templates/project-branch.php
Expand Up @@ -20,7 +20,13 @@
<dt><label for="project[source_url_template]"><?php _e( 'Source file URL', 'glotpress' ); ?></label></dt>
<dd>
<input type="text" value="<?php echo esc_html( $project->source_url_template ); ?>" name="project[source_url_template]" id="project[source_url_template]" style="width: 30em;" />
<span class="ternary"><?php _e( 'Public URL to a source file in the project. You can use <code>%file%</code> and <code>%line%</code>. Ex. <code>https://trac.example.org/browser/%file%#L%line%</code>', 'glotpress' ); ?></span>
<span class="ternary"><?php printf(
/* translators: 1: %file%, 2: %line%, 3: https://trac.example.org/browser/%file%#L%line% */
__( 'Public URL to a source file in the project. You can use %1$s and %2$s. Ex. %3$s', 'glotpress' ),
'<code>%file%</code>',
'<code>%line%</code>',
'<code>https://trac.example.org/browser/%file%#L%line%</code>'
); ?></span>
</dd>
<div id="preview"></div>
<input type="hidden" value="<?php echo esc_html( $project->parent_project_id ); ?>" name="project[parent_project_id]" id="project[parent_project_id]" />
Expand Down
8 changes: 7 additions & 1 deletion gp-templates/project-form.php
Expand Up @@ -15,7 +15,13 @@
<dt><label for="project[source_url_template]"><?php _e( 'Source file URL', 'glotpress' ); ?></label></dt>
<dd>
<input type="text" value="<?php echo esc_html( $project->source_url_template ); ?>" name="project[source_url_template]" id="project[source_url_template]" style="width: 30em;" />
<span class="ternary"><?php _e( 'Public URL to a source file in the project. You can use <code>%file%</code> and <code>%line%</code>. Ex. <code>https://trac.example.org/browser/%file%#L%line%</code>', 'glotpress' ); ?></span>
<span class="ternary"><?php printf(
/* translators: 1: %file%, 2: %line%, 3: https://trac.example.org/browser/%file%#L%line% */
__( 'Public URL to a source file in the project. You can use %1$s and %2$s. Ex. %3$s', 'glotpress' ),
'<code>%file%</code>',
'<code>%line%</code>',
'<code>https://trac.example.org/browser/%file%#L%line%</code>'
); ?></span>
</dd>

<dt><label for="project[parent_project_id]"><?php _e( 'Parent Project', 'glotpress' ); ?></label></dt>
Expand Down