__( 'Settings', 'swiftling' ), 'title' => __( 'Language switcher', 'swiftling' ), 'description' => __( 'How visitors change the language. It takes the fonts and colours of your theme.', 'swiftling' ), ) ); $swiftling_languages = swiftling_languages(); if ( ! $swiftling_languages['targets'] ) { Ui::emptyState( __( 'No language to switch to yet', 'swiftling' ), __( 'Add a language the site is translated into, and the switcher appears wherever you put it.', 'swiftling' ), array( __( 'Manage languages', 'swiftling' ), admin_url( 'admin.php?page=swiftling-languages' ) ) ); return; } $swiftling_settings = Settings::get(); $swiftling_all = array_merge( array( $swiftling_languages['source'] ), array_values( $swiftling_languages['targets'] ) ); $swiftling_menus = wp_get_nav_menus(); $swiftling_places = get_registered_nav_menus(); $swiftling_located = get_nav_menu_locations(); // Where the Language switcher block sits: in a block theme, its menus are the Navigation block's. $swiftling_blocks = Block::places(); $swiftling_hidden = wp_list_filter( $swiftling_languages['targets'], array( 'visible' => false ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only notice after the redirect. $swiftling_saved = isset( $_GET['swiftling_notice'] ) && 'saved' === sanitize_key( wp_unslash( $_GET['swiftling_notice'] ) ); $swiftling_show_labels = array( 'flag' => array( __( 'Flag', 'swiftling' ), __( 'Flags stand for countries, not languages. Choose them in step 3.', 'swiftling' ) ), 'name' => array( __( 'Name', 'swiftling' ), __( 'In its own language, in the language of the page, or both: see Language names on the Languages screen.', 'swiftling' ) ), 'code' => array( __( 'Code, such as DE', 'swiftling' ), __( 'Short codes such as DE.', 'swiftling' ) ), 'current' => array( __( 'The language shown, in a list', 'swiftling' ), __( 'A dropdown always shows it as its button.', 'swiftling' ) ), ); $swiftling_styles = array( 'dropdown' => __( 'Dropdown', 'swiftling' ), 'horizontal' => __( 'Horizontal list', 'swiftling' ), 'vertical' => __( 'Vertical list', 'swiftling' ), ); // Step 2 has a tab for each place with a style and a "show" of its own; the form posts each under // its own name. A block, widget or shortcode chooses its style itself. $swiftling_show_places = array( 'menu' => array( 'label' => __( 'In the menu', 'swiftling' ), 'field' => 'menu[show]', 'show' => $swiftling_settings['menu']['show'], 'styles' => array( 'dropdown' => array( __( 'Dropdown', 'swiftling' ), __( 'The others open under the language shown.', 'swiftling' ) ), 'list' => array( __( 'One item per language', 'swiftling' ), __( 'Side by side, like the other items.', 'swiftling' ) ), 'globe' => array( __( 'Globe', 'swiftling' ), __( 'A globe that leads nowhere: a click or a tap opens the languages.', 'swiftling' ) ), ), ), 'footer' => array( 'label' => __( 'At the end of the page', 'swiftling' ), 'field' => 'footer[show]', 'show' => $swiftling_settings['footer']['show'], 'styles' => array( 'horizontal' => array( __( 'Horizontal list', 'swiftling' ), __( 'One row, in the middle.', 'swiftling' ) ), 'vertical' => array( __( 'Vertical list', 'swiftling' ), __( 'One language under another.', 'swiftling' ) ), 'dropdown' => array( __( 'Dropdown', 'swiftling' ), __( 'The others open from the language shown.', 'swiftling' ) ), ), ), 'elsewhere' => array( 'label' => __( 'Block, widget, shortcode', 'swiftling' ), 'field' => 'show', 'show' => $swiftling_settings['show'], 'styles' => array(), ), ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only which tab opens, after the redirect. $swiftling_tab = isset( $_GET['swiftling_tab'] ) ? sanitize_key( wp_unslash( $_GET['swiftling_tab'] ) ) : ''; $swiftling_tab = isset( $swiftling_show_places[ $swiftling_tab ] ) ? $swiftling_tab : 'menu'; $swiftling_flag_sizes = array( 'small' => __( 'Small', 'swiftling' ), 'medium' => __( 'Medium', 'swiftling' ), 'large' => __( 'Large', 'swiftling' ), ); $swiftling_suggest_positions = array( 'bar' => array( __( 'Bar along the bottom', 'swiftling' ), __( 'Across the whole window.', 'swiftling' ) ), 'right' => array( __( 'Card, bottom right', 'swiftling' ), __( 'Above a floating switcher in the same corner.', 'swiftling' ) ), 'left' => array( __( 'Card, bottom left', 'swiftling' ), __( 'Above a floating switcher in the same corner.', 'swiftling' ) ), ); ?> __( 'Switcher saved.', 'swiftling' ) ) ); ?> sprintf( __( 'Hidden languages are in the switcher only for people who can edit content, faded: %s.', 'swiftling' ), implode( ', ', wp_list_pluck( $swiftling_hidden, 'name' ) ) ), ) ); ?>

$swiftling_menu_id ) { if ( (int) $swiftling_menu_id === (int) $swiftling_menu->term_id && isset( $swiftling_places[ $swiftling_location ] ) ) { $swiftling_where[] = $swiftling_places[ $swiftling_location ]; } } ?>
wp_sprintf( __( 'The Language switcher block is in: %l. Its look is set in its sidebar in the Site Editor.', 'swiftling' ), $swiftling_blocks ), 'compact' => true, ) ); ?> current_theme_supports( 'menus' ) ? sprintf( /* translators: %s: link to the Menus screen. */ esc_html__( 'The site has no menus yet. Make one on the %s screen and come back to add the languages to it.', 'swiftling' ), '' . esc_html__( 'Menus', 'swiftling' ) . '' ) : esc_html__( 'Your theme keeps its menus in the Navigation block. Open it in the Site Editor and add the Language switcher block to it.', 'swiftling' ), 'compact' => true, ) ); ?> $swiftling_blocks /* translators: %l: names of menus and template parts, e.g. Header and Footer. */ ? wp_sprintf( __( 'Your theme keeps its menus in the Navigation block, which does not use these menus. The Language switcher block is in: %l.', 'swiftling' ), $swiftling_blocks ) : __( 'Your theme keeps its menus in the Navigation block, which does not use these menus. Add the Language switcher block to the Navigation block in the Site Editor instead.', 'swiftling' ), 'compact' => true, ) ); ?>
[swiftling_switcher] [swiftling_switcher style="horizontal" flag="yes" code="yes"] [swiftling_switcher flag="yes" flag_size="large"]
<?php do_action( 'swiftling_language_switcher' ); ?> <?php do_action( 'swiftling_language_switcher', array( 'style' => 'vertical', 'flag' => true ) ); ?>

$swiftling_place_info ) : ?>
$swiftling_place_info ) : ?>
>

$swiftling_tile ) : ?>

$swiftling_label ) : ?>
$swiftling_label ) : ?>

array( __( 'Nothing', 'swiftling' ), __( 'Every page shows the language of its address.', 'swiftling' ) ), 'suggest' => array( __( 'Suggest it', 'swiftling' ), __( 'A short note in the visitor\'s language offers the page in it.', 'swiftling' ) ), 'open' => array( __( 'Open the home page in it', 'swiftling' ), __( 'The first time a visitor arrives. Other pages suggest it.', 'swiftling' ) ), ); ?> $swiftling_tile ) : ?>

$swiftling_label ) : ?>