@@ -38,11 +55,14 @@
|
priority ?? '0';
+ $translation_priority_name = is_string( gp_array_get( GP::$original->get_static( 'priorities' ), $translation_priority_id ) ) ? gp_array_get( GP::$original->get_static( 'priorities' ), $translation_priority_id ) : 'normal';
+
?>
-
+ |
priority ][0];
+ echo esc_html( $priority_char[ $translation_priority_id ][0] );
?>
|
@@ -85,21 +105,21 @@
$missing_text = "$edit_text";
- if ( ! count( array_filter( $translation->translations, 'gp_is_not_null' ) ) ) {
+ if ( array_filter( $translation->translations, 'gp_is_not_null' ) === array() ) {
// Do if no translations found.
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $missing_text;
- } elseif ( ! $translation->plural || $locale->nplurals === 1 ) {
+ } elseif ( is_null( $translation->plural ) || $locale->nplurals === 1 ) {
// Do if no plurals or number of plurals is 1.
$singular_translation = esc_translation( $translation->translations[0] );
// Check if has root.
if ( $is_ptao90 && ( isset( $translation->root_id ) || $has_root ) ) {
- if ( GP_CONVERT_PT_AO90_SHOWDIFF === true ) {
+ if ( defined( 'GP_CONVERT_PT_AO90_SHOWDIFF' ) && GP_CONVERT_PT_AO90_SHOWDIFF === true ) {
$singular_translation = GP_Convert_PT_AO90\Portuguese_AO90::highlight_diff(
- esc_translation( $supports_variants ? $translation->root_translation_0 : ( ! is_null( $root_translation ) ? $root_translation->translations[0] : '' ) ),
+ esc_translation( $supports_variants ? property_exists( $translation, 'root_translation_0' ) && $translation->root_translation_0 : ( ! is_null( $root_translation ) ? $root_translation->translations[0] : '' ) ),
esc_translation( $translation->translations[0] )
);
}
@@ -122,9 +142,9 @@
$singular_translation = esc_translation( $translation->translations[0] );
// Check if has root.
if ( $is_ptao90 && ( isset( $translation->root_id ) || $has_root ) ) {
- if ( GP_CONVERT_PT_AO90_SHOWDIFF === true ) {
+ if ( defined( 'GP_CONVERT_PT_AO90_SHOWDIFF' ) && GP_CONVERT_PT_AO90_SHOWDIFF === true ) {
$singular_translation = GP_Convert_PT_AO90\Portuguese_AO90::highlight_diff(
- esc_translation( $supports_variants ? $translation->root_translation_0 : ( ! is_null( $root_translation ) ? $root_translation->translations[0] : '' ) ),
+ esc_translation( $supports_variants ? property_exists( $translation, 'root_translation_0' ) && $translation->root_translation_0 : ( ! is_null( $root_translation ) ? $root_translation->translations[0] : '' ) ),
esc_translation( $translation->translations[0] )
);
}
@@ -144,9 +164,9 @@
$plural_translation = esc_translation( $translation->translations[1] );
// Check if has root.
if ( $is_ptao90 && ( isset( $translation->root_id ) || $has_root ) ) {
- if ( GP_CONVERT_PT_AO90_SHOWDIFF === true ) {
+ if ( defined( 'GP_CONVERT_PT_AO90_SHOWDIFF' ) && GP_CONVERT_PT_AO90_SHOWDIFF === true ) {
$plural_translation = GP_Convert_PT_AO90\Portuguese_AO90::highlight_diff(
- esc_translation( $supports_variants ? $translation->root_translation_1 : ( ! is_null( $root_translation ) ? $root_translation->translations[1] : '' ) ),
+ esc_translation( $supports_variants ? property_exists( $translation, 'root_translation_1' ) && $translation->root_translation_1 : ( ! is_null( $root_translation ) ? $root_translation->translations[1] : '' ) ),
esc_translation( $translation->translations[1] )
);
}
@@ -186,7 +206,7 @@
$plural_translation = esc_translation( $translation->translations[ $plural_index ] );
// Check if has root.
if ( $is_ptao90 && ( isset( $translation->root_id ) || $has_root ) ) {
- if ( GP_CONVERT_PT_AO90_SHOWDIFF === true ) {
+ if ( defined( 'GP_CONVERT_PT_AO90_SHOWDIFF' ) && GP_CONVERT_PT_AO90_SHOWDIFF === true ) {
$plural_translation = GP_Convert_PT_AO90\Portuguese_AO90::highlight_diff(
esc_translation( $supports_variants ? $translation->{ 'root_translation_' . $plural_index } : ( ! is_null( $root_translation ) ? $root_translation->translations[ $plural_index ] : '' ) ),
esc_translation( $translation->translations[ $plural_index ] )
diff --git a/includes/class-portuguese-ao90.php b/includes/class-portuguese-ao90.php
index 6aefd71..6d84154 100644
--- a/includes/class-portuguese-ao90.php
+++ b/includes/class-portuguese-ao90.php
@@ -16,6 +16,8 @@
use GP_Translation;
use GP_Translation_Set;
use Convert_PT_AO90;
+use Translation_Entry;
+use Translations;
use WP_Error;
// Exit if accessed directly.
@@ -84,10 +86,8 @@ public static function init() {
*/
add_filter( 'gp_translation_sets_sort', array( self::class, 'sort_translation_sets' ) );
- /**
- * Force convert the whole project again.
- */
- add_action( 'wp_ajax_convert_project', array( self::class, 'convert_project' ) );
+ // Instantiate Rest API.
+ new Rest_API();
}
@@ -203,8 +203,8 @@ public static function notice_locale_not_found() {
*
* @since 1.3.0
*
- * @param string $template The template name.
- * @param array $args Arguments passed to the template.
+ * @param string $template The template name.
+ * @param array $args Arguments passed to the template.
*
* @return void
*/
@@ -217,7 +217,7 @@ public static function pre_template_load( $template, &$args ) {
$is_ptao90 = true;
// Check if the the Variant is read-only.
- if ( GP_CONVERT_PT_AO90_EDIT === false ) {
+ if ( defined( 'GP_CONVERT_PT_AO90_EDIT' ) && GP_CONVERT_PT_AO90_EDIT === false ) {
// Customize $args on 'translations' template, and also on 'translation-row' to override the $can_approve_translation before loading 'translation-row'.
if ( $template === 'translations' || $template === 'translation-row' ) {
@@ -275,11 +275,11 @@ public static function pre_template_load( $template, &$args ) {
}
}
- if ( ! $supports_variants && GP_CONVERT_PT_AO90_SHOWDIFF === true && $has_root === true ) {
+ if ( $supports_variants === false && defined( 'GP_CONVERT_PT_AO90_SHOWDIFF' ) && GP_CONVERT_PT_AO90_SHOWDIFF === true && $has_root === true ) {
- $translations = (array) $args['translations'];
+ $translations = $args['translations'];
- if ( count( $translations ) !== 0 ) {
+ if ( is_array( $translations ) && $translations !== array() ) {
$originals = array();
@@ -336,7 +336,7 @@ public static function pre_template_load( $template, &$args ) {
$root_translations = null;
- if ( ! $supports_variants && GP_CONVERT_PT_AO90_SHOWDIFF === true && $has_root === true ) {
+ if ( $supports_variants === false && defined( 'GP_CONVERT_PT_AO90_SHOWDIFF' ) && GP_CONVERT_PT_AO90_SHOWDIFF === true && $has_root === true ) {
$root_translations = GP::$translation->for_translation(
$project,
$root_translation_set,
@@ -344,7 +344,7 @@ public static function pre_template_load( $template, &$args ) {
// Get the current root translation for the row original.
array(
'status' => 'current',
- 'original_id' => $args['original_id'],
+ 'original_id' => $args['translation']->original_id,
)
);
}
@@ -378,7 +378,7 @@ public static function post_template_load( $template, &$args ) {
if ( isset( $args['locale_slug'] ) && $args['locale_slug'] === 'pt-ao90' ) {
// Check if the the Variant is read-only.
- if ( GP_CONVERT_PT_AO90_EDIT === false ) {
+ if ( defined( 'GP_CONVERT_PT_AO90_EDIT' ) && GP_CONVERT_PT_AO90_EDIT === false ) {
// CSS for variant PT AO90.
?>
|