<?php
/**
 * Bilingual strings for the setup wizard (Swedish / English).
 *
 * @package Maca_Menu_List_Pro
 */

if (!defined('ABSPATH')) {
    exit;
}

/**
 * Whether the admin UI should use Swedish wizard copy.
 *
 * @return bool
 */
function maca_menulist_onboarding_is_swedish() {
    $locale = function_exists('get_user_locale') ? get_user_locale() : get_locale();
    $locale = strtolower(str_replace('-', '_', (string) $locale));

    return strpos($locale, 'sv') === 0;
}

/**
 * Pick Swedish or English wizard string.
 *
 * @param string $sv Swedish text.
 * @param string $en English text.
 * @return string
 */
function maca_menulist_ob($sv, $en) {
    return maca_menulist_onboarding_is_swedish() ? $sv : $en;
}

/**
 * Echo escaped wizard string.
 *
 * @param string $sv Swedish text.
 * @param string $en English text.
 * @return void
 */
function maca_menulist_ob_e($sv, $en) {
    echo esc_html(maca_menulist_ob($sv, $en));
}

/**
 * Echo escaped wizard string for HTML attributes.
 *
 * @param string $sv Swedish text.
 * @param string $en English text.
 * @return void
 */
function maca_menulist_ob_attr_e($sv, $en) {
    echo esc_attr(maca_menulist_ob($sv, $en));
}
