__( 'Settings', 'swiftling' ), 'title' => __( 'Translation service', 'swiftling' ), 'description' => __( 'Machine translation with your own key. Texts go straight from your site to the service, which bills you directly.', 'swiftling' ), ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only notice after the redirect. $swiftling_notice = isset( $_GET['swiftling_notice'] ) ? sanitize_key( wp_unslash( $_GET['swiftling_notice'] ) ) : ''; $swiftling_notices = array( 'working' => array( 'success', __( 'The key works. The translation editor now offers machine translation.', 'swiftling' ) ), 'unpaid' => array( 'warning', __( 'The key works, but the account cannot pay yet. See what the service said below.', 'swiftling' ) ), 'removed' => array( 'info', __( 'The key is removed.', 'swiftling' ) ), 'empty' => array( 'info', __( 'Paste a key first.', 'swiftling' ) ), 'constant' => array( 'info', __( 'The key is set in wp-config.php, so it cannot be changed here.', 'swiftling' ) ), 'chosen' => array( 'success', __( 'The translation editor now translates with this service.', 'swiftling' ) ), 'not_connected' => array( 'info', __( 'Connect that service with its key first.', 'swiftling' ) ), 'model' => array( 'success', __( 'The service now translates with this model.', 'swiftling' ) ), 'model_unknown' => array( 'info', __( 'This key cannot use that model. Check the key again to see the models it can use.', 'swiftling' ) ), ); // After an action on a service the screen opens at its row, which shows the notice instead. // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Which row the notice belongs to. $swiftling_focus = isset( $_GET['service'] ) ? sanitize_key( wp_unslash( $_GET['service'] ) ) : ''; $swiftling_focus = Services::get( $swiftling_focus ) ? $swiftling_focus : ''; if ( '' === $swiftling_focus && isset( $swiftling_notices[ $swiftling_notice ] ) ) { Ui::notice( $swiftling_notices[ $swiftling_notice ][0], array( 'text' => $swiftling_notices[ $swiftling_notice ][1] ) ); } $swiftling_current = Services::current(); $swiftling_kinds = array( 'machine' => array( __( 'Machine translation', 'swiftling' ), __( 'Fast and even, billed per character.', 'swiftling' ) ), 'ai' => array( __( 'AI translation', 'swiftling' ), __( 'Follows tone and context, billed per token.', 'swiftling' ) ), ); $swiftling_groups = array(); foreach ( Services::all() as $swiftling_service ) { $swiftling_kind = isset( $swiftling_kinds[ $swiftling_service->kind() ] ) ? $swiftling_service->kind() : 'machine'; $swiftling_groups[ $swiftling_kind ][] = $swiftling_service; } ?>
name() ) ); ?> name() ) ) ); ?>
kind() ) : ?> id() ); ?> id() ); ?>
name() ) ); ?>