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

[ET-2284] Fixing Translation Issues in ET: Part Two #3505

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/Tickets/Commerce/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
class Module extends \Tribe__Tickets__Tickets {

public function __construct() {
// This needs to happen before parent construct.
$this->plugin_name = __( 'Tickets Commerce', 'event-tickets' );

parent::__construct();

Expand Down Expand Up @@ -223,6 +221,15 @@ public static function get_instance() {
return tribe( static::class );
}

/**
* Set the plugin name.
*
* @since TBD
*/
public function set_plugin_name() {
$this->plugin_name = __( 'Tickets Commerce', 'event-tickets' );
}

/**
* Registers all actions/filters
*
Expand Down
1 change: 0 additions & 1 deletion src/Tribe/Commerce/PayPal/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ public function bind_implementations() {
* @since 4.7
*/
public function hooks() {
add_action( 'init', [ $this, 'set_plugin_name' ], 9 );
// if the hooks have already been bound, don't do it again
if ( $this->is_loaded ) {
return false;
Expand Down
1 change: 0 additions & 1 deletion src/Tribe/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,6 @@ public function bootstrap() {
$this->user_event_confirmation_list_shortcode();
$this->move_tickets();
$this->move_ticket_types();
$this->activation_page();

Tribe__Tickets__JSON_LD__Order::hook();
Tribe__Tickets__JSON_LD__Type::hook();
Expand Down
1 change: 0 additions & 1 deletion src/Tribe/RSVP.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ public function __construct() {
* Registers all actions/filters
*/
public function hooks() {
add_action( 'init', [ $this, 'set_plugin_name' ], 9 );
add_action( 'wp_enqueue_scripts', [ $this, 'register_resources' ], 5 );
add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_resources' ], 11 );
add_action( 'trashed_post', [ $this, 'maybe_redirect_to_attendees_report' ] );
Expand Down
24 changes: 22 additions & 2 deletions src/Tribe/Tickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,15 @@ public function get_event_reports_link( $post_id ) {}
*/
public function get_ticket_reports_link( $post_id_deprecated, $ticket_id ) {}

/**
* Sets plugin name after init runs to avoid tranlsation issues.
*
* @since TBD
*
* @return void
*/
public function set_plugin_name() {}

/**
* Returns a single ticket.
*
Expand Down Expand Up @@ -1244,8 +1253,8 @@ public function __construct() {
$this->parent_path = $this->parentPath = trailingslashit( dirname( dirname( dirname( __FILE__ ) ) ) );
$this->parent_url = $this->parentUrl = trailingslashit( plugins_url( '', $this->parent_path ) );

// Register all Tribe__Tickets__Tickets api consumers
self::$active_modules[ $this->class_name ] = $this->plugin_name;
add_action( 'init', [ $this, 'set_plugin_name' ] );
add_action( 'init', [ $this, 'register_active_module' ], 11 );

add_action( 'wp', [ $this, 'hook' ] );

Expand All @@ -1270,6 +1279,17 @@ public function __construct() {
add_action( 'init', [ $this, 'add_admin_tickets_hooks' ] );
}

/**
* Register module as active.
*
* @since TBD
*
* @return void
*/
public function register_active_module() {
self::$active_modules[ $this->class_name ] = $this->plugin_name;
}

/**
* Most Commerce Providers needs this to be setup later than when the actual class is actually loaded
*
Expand Down
Loading