get_node( 'site-name' ) : null;
if ( $node ) {
$bar->add_node( array( 'id' => 'site-name', 'title' => esc_html( wp_html_excerpt( $name, 40, '…' ) ) ) );
}
}
function qtrad_admin_title( $title ) {
$name = qtrad_admin_site_name();
return $name !== '' ? str_replace( (string) get_option( 'blogname' ), $name, $title ) : $title;
}
function qtrad_plugin_links( $links ) {
$url = admin_url( 'options-general.php?page=qtrad' );
array_unshift( $links, '' . esc_html__( 'Settings', 'qtrad' ) . ' ' );
return $links;
}
function qtrad_capture_admin_lang() {
$id = isset( $_POST['qtrad_field_post_id'] ) ? absint( $_POST['qtrad_field_post_id'] ) : 0;
$lang = isset( $_POST['qtrad_edit_lang'] ) && is_string( $_POST['qtrad_edit_lang'] ) ? strtolower( sanitize_key( wp_unslash( $_POST['qtrad_edit_lang'] ) ) ) : '';
if ( $id && qtrad_is_enabled( $lang ) && current_user_can( 'edit_post', $id ) && isset( $_POST['qtrad_field_nonce'] ) && is_string( $_POST['qtrad_field_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['qtrad_field_nonce'] ) ), 'qtrad_field_' . $id ) ) {
update_user_meta( get_current_user_id(), 'qtrad_edit_language', $lang );
}
if ( ! isset( $_GET['qtrad_lang'] ) ) {
return;
}
if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'manage_options' ) ) {
return;
}
check_admin_referer( 'qtrad_language' );
$lang = is_string( $_GET['qtrad_lang'] ) ? strtolower( sanitize_key( wp_unslash( $_GET['qtrad_lang'] ) ) ) : '';
if ( ! qtrad_is_enabled( $lang ) ) {
return;
}
if ( is_user_logged_in() ) {
update_user_meta( get_current_user_id(), 'qtrad_edit_language', $lang );
}
$path = defined( 'COOKIEPATH' ) && COOKIEPATH ? COOKIEPATH : '/';
setcookie( 'qtrans_admin_language', $lang, array( 'expires' => time() + YEAR_IN_SECONDS, 'path' => $path, 'domain' => COOKIE_DOMAIN, 'secure' => is_ssl(), 'httponly' => true, 'samesite' => 'Lax' ) );
$_COOKIE['qtrans_admin_language'] = $lang;
qtrad_set_language( $lang );
wp_safe_redirect( remove_query_arg( array( 'qtrad_lang', '_wpnonce' ) ) );
exit;
}
function qtrad_admin_menu() {
add_options_page(
__( 'Languages', 'qtrad' ),
__( 'Languages', 'qtrad' ),
'manage_options',
'qtrad',
'qtrad_settings_page'
);
}
function qtrad_enqueue_editor( $hook ) {
if ( ! in_array( $hook, array( 'post.php', 'post-new.php', 'settings_page_qtrad' ), true ) ) {
return;
}
if ( $hook !== 'settings_page_qtrad' ) {
$screen = get_current_screen();
$type = $screen ? get_post_type_object( $screen->post_type ) : null;
if ( ! $type || ! $type->public ) { return; }
}
wp_enqueue_script( 'qtrad-settings', plugins_url( 'assets/js/settings.js', QTRAD_FILE ), array( 'common' ), QTRAD_VERSION, true );
wp_enqueue_style( 'qtrad-admin', plugins_url( 'assets/css/admin.css', QTRAD_FILE ), array(), QTRAD_VERSION );
if ( ! in_array( $hook, array( 'post.php', 'post-new.php' ), true ) ) {
return;
}
wp_enqueue_script( 'qtrad-codec', plugins_url( 'assets/js/codec.js', QTRAD_FILE ), array(), QTRAD_VERSION, true );
$deps = array( 'jquery', 'qtrad-codec' );
foreach ( array( 'wp-data', 'wp-blocks', 'wp-api-fetch' ) as $handle ) {
if ( wp_script_is( $handle, 'registered' ) ) {
$deps[] = $handle;
}
}
wp_enqueue_script( 'qtrad-editor', plugins_url( 'assets/js/editor.js', QTRAD_FILE ), $deps, QTRAD_VERSION, true );
$enabled = qtrad_enabled_languages();
$names = array();
$directions = array();
foreach ( $enabled as $lang ) {
$names[ $lang ] = qtrad_language_name( $lang );
$directions[ $lang ] = qtrad_language_direction( $lang );
}
$screen = get_current_screen();
$post = null;
if ( $screen && $screen->base === 'post' && isset( $_GET['post'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reads the post being edited; core checks edit_post.
$post = get_post( absint( wp_unslash( $_GET['post'] ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- As above.
}
$type = $screen ? get_post_type_object( $screen->post_type ) : null;
wp_localize_script(
'qtrad-editor',
'qtradEditorConfig',
array(
'enabled' => $enabled,
'names' => $names,
'locales' => qtrad_config( 'locale' ),
'directions' => $directions,
'fieldNonce' => $post ? wp_create_nonce( 'qtrad_field_' . $post->ID ) : '',
'forceMarkers' => (bool) qtrad_setting( 'force_markers', false ),
'restBase' => $type && $type->rest_base ? $type->rest_base : ( $type ? $type->name : 'posts' ),
'restRoot' => esc_url_raw( rest_url() ),
'restNamespace' => $type && ! empty( $type->rest_namespace ) ? $type->rest_namespace : 'wp/v2',
/* translators: %s: native language name */
'languageMessage' => __( 'Editing %s. Other translations are preserved when you save.', 'qtrad' ),
'editLang' => qtrad_admin_language(),
'editorMode' => qtrad_setting( 'editor_mode', 'lsb' ),
'writeFormat'=> qtrad_setting( 'write_format', 'keep' ),
'title' => $post ? $post->post_title : '',
'content' => $post ? $post->post_content : '',
'excerpt' => $post ? $post->post_excerpt : '',
)
);
}
function qtrad_add_meta_boxes() {
$types = get_post_types( array( 'public' => true ), 'names' );
foreach ( $types as $type ) {
add_meta_box(
'qtrad-languages',
esc_html__( 'Languages', 'qtrad' ),
'qtrad_languages_box',
$type,
'side',
'high'
);
}
}
function qtrad_languages_box( $post ) {
$enabled = qtrad_enabled_languages();
$active = qtrad_admin_language();
$mode = qtrad_setting( 'editor_mode', 'lsb' );
if ( $mode === 'raw' ) {
echo '
' . esc_html__( 'Raw mode: edit the language markers directly in the title, content and excerpt.', 'qtrad' ) . '
';
return;
}
wp_nonce_field( 'qtrad_field_' . $post->ID, 'qtrad_field_nonce' );
echo ' ';
echo ' ';
echo ' ';
echo '';
foreach ( $enabled as $lang ) {
echo '' . esc_html( qtrad_language_name( $lang ) ) . ' ';
}
echo '
' . esc_html__( 'Choose the language to edit. Tab moves between buttons; Enter or Space selects a language. Other translations are preserved when you save.', 'qtrad' ) . '
';
echo '
';
echo '' . esc_html__( 'JavaScript is unavailable. Edit the full language markers directly; the language buttons require JavaScript.', 'qtrad' ) . '
';
echo '';
$fields = array(
'title' => $post->post_title,
'content' => $post->post_content,
'excerpt' => $post->post_excerpt,
);
foreach ( $fields as $key => $raw ) {
$parts = qtrad_split( (string) $raw, $enabled, false );
foreach ( $enabled as $lang ) {
$value = isset( $parts[ $lang ] ) ? $parts[ $lang ] : '';
echo '';
}
}
echo '
';
$format = qtrad_detect_format( (string) $post->post_content );
if ( ! $format ) {
$format = qtrad_detect_format( (string) $post->post_title );
}
if ( $format ) {
$labels = array(
'comment' => __( 'qTranslate comments', 'qtrad' ),
'bracket' => __( 'qTranslate-X brackets', 'qtrad' ),
'swirly' => __( 'swirly brackets', 'qtrad' ),
);
echo '' . esc_html( isset( $labels[ $format ] ) ? $labels[ $format ] : $format ) . '
';
}
}
function qtrad_language_column( $columns ) {
$columns['qtrad_langs'] = esc_html__( 'Languages', 'qtrad' );
return $columns;
}
function qtrad_language_column_cell( $column, $post_id ) {
if ( $column !== 'qtrad_langs' ) {
return;
}
$post = get_post( $post_id );
if ( ! $post ) {
return;
}
$blob = $post->post_title . $post->post_content . $post->post_excerpt;
if ( ! qtrad_has_lang_tags( $blob ) ) {
echo '' . esc_html( strtoupper( qtrad_default_language() ) ) . ' ';
return;
}
$found = qtranxf_getAvailableLanguages( $post->post_title . "\n" . $post->post_content );
if ( ! $found ) {
$found = qtrad_enabled_languages();
}
echo '';
foreach ( $found as $lang ) {
echo '' . esc_html( strtoupper( $lang ) ) . ' ';
}
echo ' ';
}
function qtrad_term_rows( $term = null ) {
$enabled = qtrad_enabled_languages();
$stored = array();
if ( $term && isset( $term->name ) ) {
$term = qtrad_get_raw_term( $term->term_id, $term->taxonomy );
$stored = get_term_meta( $term->term_id, '_qtrad_translations', true );
$stored = is_array( $stored ) ? $stored : array();
$library = qtrad_config( 'term_name' );
if ( ! $stored && is_array( $library ) && isset( $library[ $term->name ] ) && is_array( $library[ $term->name ] ) ) {
$stored = $library[ $term->name ];
}
}
foreach ( $enabled as $lang ) {
$value = isset( $stored[ $lang ] ) ? $stored[ $lang ] : '';
if ( $value === '' && $term && $lang === qtrad_default_language() ) {
$value = $term->name;
}
echo '';
echo '' . esc_html( qtrad_language_name( $lang ) ) . ' ';
echo ' ';
echo '
';
}
}
function qtrad_term_add_fields( $taxonomy ) {
echo ' ';
wp_nonce_field( 'qtrad_term', 'qtrad_term_nonce' );
echo ' ';
echo '';
}
function qtrad_term_fields( $term ) {
echo '' . esc_html__( 'Translations', 'qtrad' ) . ' ';
wp_nonce_field( 'qtrad_term', 'qtrad_term_nonce' );
echo ' ';
qtrad_term_rows( $term );
echo '' . esc_html__( 'Translate this term in each enabled language. The default translation is its WordPress name.', 'qtrad' ) . '
';
echo ' ';
}
/** English language names, translatable so admins see them in their own language. */
function qtrad_language_admin_names() {
return array(
'en' => __( 'English', 'qtrad' ),
'de' => __( 'German', 'qtrad' ),
'fr' => __( 'French', 'qtrad' ),
'es' => __( 'Spanish', 'qtrad' ),
'it' => __( 'Italian', 'qtrad' ),
'pt' => __( 'Portuguese', 'qtrad' ),
'pb' => __( 'Portuguese (Brazil)', 'qtrad' ),
'nl' => __( 'Dutch', 'qtrad' ),
'sv' => __( 'Swedish', 'qtrad' ),
'pl' => __( 'Polish', 'qtrad' ),
'ru' => __( 'Russian', 'qtrad' ),
'zh' => __( 'Chinese (Simplified)', 'qtrad' ),
'ja' => __( 'Japanese', 'qtrad' ),
'el' => __( 'Greek', 'qtrad' ),
'tr' => __( 'Turkish', 'qtrad' ),
'ro' => __( 'Romanian', 'qtrad' ),
'hu' => __( 'Hungarian', 'qtrad' ),
'fi' => __( 'Finnish', 'qtrad' ),
'hr' => __( 'Croatian', 'qtrad' ),
'sk' => __( 'Slovak', 'qtrad' ),
'sr' => __( 'Serbian', 'qtrad' ),
'vi' => __( 'Vietnamese', 'qtrad' ),
'ar' => __( 'Arabic', 'qtrad' ),
'et' => __( 'Estonian', 'qtrad' ),
'cs' => __( 'Czech', 'qtrad' ),
'da' => __( 'Danish', 'qtrad' ),
'ca' => __( 'Catalan', 'qtrad' ),
'gl' => __( 'Galician', 'qtrad' ),
'eu' => __( 'Basque', 'qtrad' ),
'cy' => __( 'Welsh', 'qtrad' ),
'he' => __( 'Hebrew', 'qtrad' ),
'ko' => __( 'Korean', 'qtrad' ),
'tw' => __( 'Chinese (Traditional)', 'qtrad' ),
'md' => __( 'Moldovan', 'qtrad' ),
'lt' => __( 'Lithuanian', 'qtrad' ),
'kk' => __( 'Kazakh', 'qtrad' ),
);
}
/** Name in the admin's language, or the native name for custom languages. */
function qtrad_language_admin_name( $code ) {
$names = qtrad_language_admin_names();
return isset( $names[ $code ] ) ? $names[ $code ] : qtrad_language_name( $code );
}
/** "German – Deutsch (de)", with the native name isolated for right-to-left scripts. Returns escaped HTML. */
function qtrad_language_choice_label( $code, $meta ) {
$admin = qtrad_language_admin_name( $code );
$native = isset( $meta['name'] ) && $meta['name'] !== '' ? $meta['name'] : $admin;
$locale = isset( $meta['locale'] ) ? str_replace( '_', '-', $meta['locale'] ) : $code;
$html = esc_html( $admin );
if ( $native !== $admin ) {
$html .= ' – ' . esc_html( $native ) . ' ';
}
return '' . $html . ' (' . esc_html( $code ) . ') ';
}
/**
* The settings form fields, each read and sanitized on its own. qtrad_save_settings()
* then validates the values (codes, locales, domains) against what it accepts.
*/
function qtrad_settings_posted_input() {
if ( ! isset( $_POST['_wpnonce'] ) || ! is_string( $_POST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'qtrad_settings' ) ) {
return array();
}
$input = array( 'qtrad_settings' => '1' );
foreach ( array( 'default', 'url_mode', 'write_format', 'editor_mode', 'translate_options', 'filter_options', 'text_field_filters' ) as $key ) {
if ( isset( $_POST[ $key ] ) && is_string( $_POST[ $key ] ) ) {
$input[ $key ] = sanitize_text_field( wp_unslash( $_POST[ $key ] ) );
}
}
foreach ( array( 'extra_fields', 'domains' ) as $key ) {
if ( isset( $_POST[ $key ] ) && is_string( $_POST[ $key ] ) ) {
$input[ $key ] = sanitize_textarea_field( wp_unslash( $_POST[ $key ] ) );
}
}
foreach ( array( 'hide_default', 'detect_browser', 'hide_untranslated', 'show_prefix', 'show_alt_content', 'show_alt_message', 'force_markers', 'translate_meta' ) as $key ) {
if ( ! empty( $_POST[ $key ] ) ) {
$input[ $key ] = '1';
}
}
if ( isset( $_POST['enabled'] ) && is_array( $_POST['enabled'] ) ) {
$input['enabled'] = map_deep( wp_unslash( $_POST['enabled'] ), 'sanitize_key' );
}
foreach ( array( 'languages', 'new_language', 'slug_bases' ) as $key ) {
if ( isset( $_POST[ $key ] ) && is_array( $_POST[ $key ] ) ) {
$input[ $key ] = map_deep( wp_unslash( $_POST[ $key ] ), 'sanitize_text_field' );
}
}
return $input;
}
function qtrad_settings_page() {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
$posted = isset( $_POST['qtrad_settings'] ) && check_admin_referer( 'qtrad_settings' ) ? qtrad_settings_posted_input() : array();
if ( $posted ) {
$result = qtrad_save_settings( $posted );
if ( is_wp_error( $result ) ) {
echo '' . esc_html( $result->get_error_message() ) . '
';
} else {
$enabled = qtrad_enabled_languages();
foreach ( array( 'blogname', 'blogdescription' ) as $option ) {
$parts = qtrad_split( (string) get_option( $option ), $enabled, false );
foreach ( $enabled as $lang ) {
if ( isset( $_POST[ $option ][ $lang ] ) && is_string( $_POST[ $option ][ $lang ] ) ) {
$parts[ $lang ] = sanitize_text_field( wp_unslash( $_POST[ $option ][ $lang ] ) );
}
}
update_option( $option, qtrad_join( $parts, 'bracket', $enabled ) );
}
echo '' . esc_html__( 'Languages saved.', 'qtrad' ) . '
';
}
}
$catalog = qtrad_available_catalog();
$enabled = qtrad_enabled_languages();
$default = qtrad_default_language();
$url_mode = (int) qtrad_config( 'url_mode' );
$write = qtrad_setting( 'write_format', 'keep' );
$editor = qtrad_setting( 'editor_mode', 'lsb' );
$domains = qtrad_config( 'domains' );
$domain_lines = '';
$invalid = isset( $result ) && is_wp_error( $result );
if ( is_array( $domains ) ) {
foreach ( $domains as $code => $host ) {
$domain_lines .= $code . ' = ' . $host . "\n";
}
}
if ( $invalid && isset( $_POST['domains'] ) && is_string( $_POST['domains'] ) ) { $domain_lines = sanitize_textarea_field( wp_unslash( $_POST['domains'] ) ); }
$names = qtrad_split( (string) get_option( 'blogname' ), $enabled );
$descs = qtrad_split( (string) get_option( 'blogdescription' ), $enabled );
echo '';
echo '
' . esc_html__( 'Languages', 'qtrad' ) . ' ';
echo '
' . esc_html__( 'Reads qTranslate comments, qTranslate-X brackets and swirly brackets. Shared language settings are retained. For compatibility with the original qTranslate, use comment markers for posts.', 'qtrad' ) . '
';
$tabs = array(
'languages' => __( 'Languages', 'qtrad' ),
'urls' => __( 'URLs', 'qtrad' ),
'content' => __( 'Content', 'qtrad' ),
'advanced' => __( 'Advanced', 'qtrad' ),
);
$active = $posted && isset( $_POST['qtrad_tab'] ) && is_string( $_POST['qtrad_tab'] ) ? sanitize_key( wp_unslash( $_POST['qtrad_tab'] ) ) : 'languages';
if ( $invalid ) {
// A validation error opens the tab that holds the field.
$active = in_array( $result->get_error_code(), array( 'qtrad_domain', 'qtrad_domain_duplicate' ), true ) ? 'urls' : 'languages';
}
if ( ! isset( $tabs[ $active ] ) ) {
$active = 'languages';
}
echo '
';
foreach ( $tabs as $id => $label ) {
echo '' . esc_html( $label ) . ' ';
}
echo ' ';
// One form for every tab: the tabs only show one section at a time, Save keeps the whole form.
$panel = function ( $id ) use ( $tabs, $active ) {
echo '
';
echo '' . esc_html( $tabs[ $id ] ) . ' ';
echo '';
echo '' . esc_html__( 'Language names and locales', 'qtrad' ) . ' ';
foreach ( $catalog as $code => $meta ) {
if ( ! in_array( $code, $enabled, true ) ) { continue; }
echo '' . esc_html( $meta['name'] . ' (' . $code . ')' ) . ' ';
$formats = array( 'date_format' => get_option( 'qtranslate_date_formats', array() ), 'time_format' => get_option( 'qtranslate_time_formats', array() ) );
$meta['date_format'] = is_array( $formats['date_format'] ) && isset( $formats['date_format'][ $code ] ) && is_string( $formats['date_format'][ $code ] ) ? $formats['date_format'][ $code ] : '';
$meta['time_format'] = is_array( $formats['time_format'] ) && isset( $formats['time_format'][ $code ] ) && is_string( $formats['time_format'][ $code ] ) ? $formats['time_format'][ $code ] : '';
foreach ( array( 'name' => __( 'Native name', 'qtrad' ), 'locale' => __( 'WordPress locale', 'qtrad' ), 'date_format' => __( 'Date format', 'qtrad' ), 'time_format' => __( 'Time format', 'qtrad' ) ) as $key => $label ) {
echo '' . esc_html( $label ) . '
';
}
echo ' ';
}
echo '' . esc_html__( 'Date and time formats use the PHP date syntax of Settings → General, for example j. F Y. Leave them empty to use the site formats. Formats saved by qTranslate-X in strftime style keep working.', 'qtrad' ) . '
';
echo '' . esc_html__( 'Add a language', 'qtrad' ) . ' ' . esc_html__( 'Provide a two- or three-letter code, native name and WordPress locale, for example: is, Íslenska, is_IS. The language will be enabled when you save.', 'qtrad' ) . '
';
foreach ( array( 'code' => __( 'Language code', 'qtrad' ), 'name' => __( 'Native name', 'qtrad' ), 'locale' => __( 'WordPress locale', 'qtrad' ) ) as $key => $label ) {
echo '' . esc_html( $label ) . '
';
}
echo ' ';
echo ' ';
$panel( 'urls' );
echo '
' . esc_html__( 'URL mode', 'qtrad' ) . ' ' . esc_html__( 'URL mode', 'qtrad' ) . ' ';
$modes = array(
1 => __( 'Query (?lang=en) — qTranslate mode 1', 'qtrad' ),
2 => __( 'Path (/en/page/) — qTranslate mode 2, the usual choice', 'qtrad' ),
3 => __( 'Subdomain (en.example.com) — mode 3', 'qtrad' ),
4 => __( 'One domain per language — qTranslate-X mode 4', 'qtrad' ),
);
foreach ( $modes as $value => $label ) {
echo ' ' . esc_html( $label ) . ' ';
}
if ( ! qtrad_path_urls_served() ) {
echo '' . esc_html__( 'This site uses plain or /index.php/ permalinks, which work without server rewriting, so Path mode links use query URLs (?lang=de) here.', 'qtrad' ) . '
';
}
echo '';
echo '
' . esc_html__( 'URL options', 'qtrad' ) . ' ';
echo ' ' . esc_html__( 'Hide the default language in the URL', 'qtrad' ) . ' ';
echo ' ' . esc_html__( 'On the first visit to the home page, use the browser language', 'qtrad' ) . ' ';
echo ' ' . esc_html__( 'Hide posts that have no translation in the current language', 'qtrad' ) . ' ';
echo ' ';
echo '
' . esc_html__( 'Domains', 'qtrad' ) . ' ';
echo '';
echo '' . esc_html__( 'Used by URL mode 4. One per line: de = de.example.com', 'qtrad' ) . '
';
echo ' ';
qtrad_slugs_settings_row();
echo '';
$panel( 'content' );
echo '
' . esc_html__( 'When a translation is missing', 'qtrad' ) . ' ';
echo ' ' . esc_html__( 'Prefix the fallback with the language name', 'qtrad' ) . ' ';
echo ' ' . esc_html__( 'On content and excerpts, show “only available in …”', 'qtrad' ) . ' ';
echo ' ' . esc_html__( 'Also show the available translation below the message', 'qtrad' ) . ' ';
echo ' ';
echo '
' . esc_html__( 'Write format', 'qtrad' ) . ' ';
$formats = array(
'keep' => __( 'Keep the format already in the field', 'qtrad' ),
'bracket' => __( 'qTranslate-X brackets [:en]', 'qtrad' ),
'comment' => __( 'qTranslate comments ', 'qtrad' ),
'swirly' => __( 'Swirly brackets {:en}', 'qtrad' ),
);
foreach ( $formats as $value => $label ) {
echo '' . esc_html( $label ) . ' ';
}
echo ' ' . esc_html__( 'Keep preserves each existing field’s format and uses qTranslate comments for new translations. Brackets and swirly brackets require qTranslate-X or qTrad.', 'qtrad' ) . '
';
echo '
' . esc_html__( 'Editor', 'qtrad' ) . ' ' . esc_html__( 'Editor mode', 'qtrad' ) . ' ';
echo ' ' . esc_html__( 'Language switching buttons', 'qtrad' ) . ' ';
echo ' ' . esc_html__( 'Raw tags in the editor', 'qtrad' ) . ' ';
echo '';
echo '
' . esc_html__( 'Language markers', 'qtrad' ) . ' ' . esc_html__( 'Keep markers even when translations are identical', 'qtrad' ) . '';
echo '
' . esc_html__( 'Site title', 'qtrad' ) . ' ';
foreach ( $enabled as $code ) {
echo '' . esc_html( qtrad_language_name( $code ) ) . '
';
}
echo '' . esc_html__( 'Saved with bracket tags so WordPress does not strip them. The same string is what qTranslate-X would have stored in blogname.', 'qtrad' ) . '
';
echo ' ';
echo '
' . esc_html__( 'Tagline', 'qtrad' ) . ' ';
foreach ( $enabled as $code ) {
echo '' . esc_html( qtrad_language_name( $code ) ) . '
';
}
echo ' ';
echo '';
$panel( 'advanced' );
echo '
' . esc_html__( 'Custom fields', 'qtrad' ) . ' ';
echo '';
echo '' . esc_html__( 'Meta keys, one per line. On the public site their values are shown in the current language. A plain update merges into the language you are editing in the admin bar.', 'qtrad' ) . '
';
echo ' ' . esc_html__( 'On the public site, also show every other custom field and user profile field that contains language markers in the current language', 'qtrad' ) . ' ';
echo ' ';
$options_mode = qtrad_setting( 'translate_options', 'none' );
echo '
' . esc_html__( 'Options', 'qtrad' ) . ' ' . esc_html__( 'Options', 'qtrad' ) . ' ';
$option_modes = array(
'none' => __( 'Translate only the site title and tagline', 'qtrad' ),
'all' => __( 'Translate every option that contains language markers, such as theme and widget settings', 'qtrad' ),
'list' => __( 'Translate only the options listed below', 'qtrad' ),
);
foreach ( $option_modes as $value => $label ) {
echo ' ' . esc_html( $label ) . ' ';
}
echo '' . esc_html__( 'Option names', 'qtrad' ) . '
';
echo '' . esc_html__( 'Separated by spaces, with % for any characters, for example widget_%. Options are translated on the public site only; wp-admin keeps showing what is stored.', 'qtrad' ) . '
';
echo '';
echo '
' . esc_html__( 'Text filters', 'qtrad' ) . ' ';
echo ' ';
echo '' . esc_html__( 'Filter hooks of your theme or other plugins whose text should be shown in the current language, separated by spaces.', 'qtrad' ) . '
';
echo ' ';
echo '';
submit_button( __( 'Save languages', 'qtrad' ) );
echo '
';
}
function qtrad_register_taxonomy_fields() {
foreach ( get_taxonomies( array( 'show_ui' => true ) ) as $taxonomy ) {
add_action( $taxonomy . '_edit_form_fields', 'qtrad_term_fields' );
add_action( $taxonomy . '_add_form_fields', 'qtrad_term_add_fields' );
}
foreach ( get_post_types( array( 'public' => true ) ) as $type ) {
add_filter( "manage_{$type}_posts_columns", 'qtrad_language_column' );
add_action( "manage_{$type}_posts_custom_column", 'qtrad_language_column_cell', 10, 2 );
}
}