__( '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' ) ) ), ) ); ?>