__( '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; } ?>
kind(), $swiftling_current->id() ); ?>

name() ) ); ?> name() ) ) ); ?>

kind() ) : ?> id() ); ?> id() ); ?>
languageCode( $swiftling_language ) ) { $swiftling_unsupported[] = $swiftling_language['name']; } } if ( $swiftling_unsupported ) { Ui::notice( 'warning', array( 'text' => null === $swiftling_current->languageCode( $swiftling_languages['source'] ) /* translators: 1: translation service name, e.g. Google, 2: language name, e.g. Montenegrin. */ ? sprintf( __( '%1$s does not translate %2$s, the original language of your site, so the translation editor offers no machine translation.', 'swiftling' ), $swiftling_current->name(), $swiftling_languages['source']['name'] ) /* translators: 1: translation service name, e.g. Google, 2: list of language names, e.g. Montenegrin and Esperanto. */ : sprintf( _n( '%1$s does not translate %2$s, so the translation editor offers no machine translation into it.', '%1$s does not translate %2$s, so the translation editor offers no machine translation into them.', count( $swiftling_unsupported ), 'swiftling' ), $swiftling_current->name(), wp_sprintf( '%l', $swiftling_unsupported ) ), ) ); } ?>

$swiftling_about ) : ?>

  1. name() ) : __( 'Translate empty fields', 'swiftling' ); /* translators: %s: the label of the button in the translation editor, e.g. Translate empty fields with Google, in bold. */ echo wp_kses( sprintf( __( 'In the translation editor, click %s.', 'swiftling' ), '' . esc_html( $swiftling_button ) . '' ), array( 'strong' => array() ) ); ?>

name() ) ); ?>