/**
 * EZ Horoscope — Zodiac Profile Block i18n
 *
 * All UI labels and form strings for the zodiac profile block.
 * Content translations come from the API; these are structural labels only.
 *
 * To add a new language:
 *   1. Copy the 'en' block
 *   2. Change the key to the language code
 *   3. Translate each value
 */

var ezhp_zodiacProfileStrings = {

    en: {
        // ── Form UI ──
        enterBirthdate:       'Enter your birthdate:',
        getZodiacSignProfile: 'Get Zodiac Sign Profile',
        loading:              'Loading\u2026',
        pleaseEnterBirthdate: 'Please enter a valid birthdate.',
        errorLoading:         'Error loading zodiac profile.',
        noProfileFound:       'No zodiac profile found.',

        // ── Section Headings ──
        personality:          'Personality',
        decans:               'Decans',
        compatibility:        'Compatibility',
        career:               'Career',
        correspondences:      'Correspondences',

        // ── Personality Labels ──
        coreMotivation:       'Core Motivation',
        strengths:            'Strengths',
        challenges:           'Challenges',
        communicationStyle:   'Communication Style',
        conflictStyle:        'Conflict Style',
        loveLanguage:         'Love Language',

        // ── Decan Labels ──
        decan:                'Decan',
        subRuler:             'Sub-ruler',

        // ── Compatibility Labels ──
        mostCompatible:       'Most Compatible',
        challengingMatches:   'Challenging Matches',
        oppositeSign:         'Opposite Sign',

        // ── Career Labels ──
        workStyle:            'Work Style',
        idealFields:          'Ideal Fields',

        // ── Correspondences Labels ──
        birthstone:           'Birthstone',
        additionalStones:     'Additional Stones',
        birthFlower:          'Birth Flower',
        color:                'Color',
        secondaryColors:      'Secondary Colors',
        luckyNumbers:         'Lucky Numbers',
        luckyDay:             'Lucky Day',
        metal:                'Metal',
        herbsAndPlants:       'Herbs & Plants',
        bodyPartRuled:        'Body Part Ruled',
        tarotCard:            'Tarot Card',

        // ── Famous People ── ({sign} replaced at runtime)
        famousPeople:         'Famous {sign} People',

        // ── Vitals Bar ──
        element:              'Element',
        modality:             'Modality',
        rulingPlanet:         'Ruling Planet',
        house:                'House',
        season:               'Season',
    },

    sw: {
        // ── Form UI ──
        enterBirthdate:       'Ingiza tarehe yako ya kuzaliwa:',
        getZodiacSignProfile: 'Pata Wasifu wa Nyota',
        loading:              'Inapakia\u2026',
        pleaseEnterBirthdate: 'Tafadhali ingiza tarehe halali ya kuzaliwa.',
        errorLoading:         'Hitilafu katika kupakia wasifu wa nyota.',
        noProfileFound:       'Hakuna wasifu wa nyota uliopatikana.',

        // ── Section Headings ──
        personality:          'Haiba',
        decans:               'Dekani',
        compatibility:        'Ulinganifu',
        career:               'Kazi',
        correspondences:      'Mawasiliano ya Nyota',

        // ── Personality Labels ──
        coreMotivation:       'Msukumo Mkuu',
        strengths:            'Nguvu',
        challenges:           'Changamoto',
        communicationStyle:   'Mtindo wa Mawasiliano',
        conflictStyle:        'Mtindo wa Migogoro',
        loveLanguage:         'Lugha ya Upendo',

        // ── Decan Labels ──
        decan:                'Dekani',
        subRuler:             'Mtawala Msaidizi',

        // ── Compatibility Labels ──
        mostCompatible:       'Wanaolingana Zaidi',
        challengingMatches:   'Mechi Zenye Changamoto',
        oppositeSign:         'Ishara ya Kinyume',

        // ── Career Labels ──
        workStyle:            'Mtindo wa Kazi',
        idealFields:          'Nyanja Bora',

        // ── Correspondences Labels ──
        birthstone:           'Jiwe la Kuzaliwa',
        additionalStones:     'Mawe ya Ziada',
        birthFlower:          'Ua la Kuzaliwa',
        color:                'Rangi',
        secondaryColors:      'Rangi za Ziada',
        luckyNumbers:         'Nambari za Bahati',
        luckyDay:             'Siku ya Bahati',
        metal:                'Chuma',
        herbsAndPlants:       'Mimea na Mitishamba',
        bodyPartRuled:        'Sehemu ya Mwili',
        tarotCard:            'Kadi ya Tarot',

        // ── Famous People ──
        famousPeople:         'Watu Mashuhuri wa {sign}',

        // ── Vitals Bar ──
        element:              'Kipengele',
        modality:             'Njia',
        rulingPlanet:         'Sayari Inayotawala',
        house:                'Nyumba',
        season:               'Msimu',
    },

};

/**
 * Get a translated string.
 *
 * @param {string} lang  Language code (e.g. 'en', 'sw')
 * @param {string} key   String key
 * @returns {string}     Translated string, or English fallback, or the key itself
 */
export function ezhp_t(lang, key) {
    var strings = ezhp_zodiacProfileStrings[lang] || ezhp_zodiacProfileStrings['en'];
    if (strings && strings[key]) return strings[key];
    // Fallback to English if lang exists but key is missing
    var en = ezhp_zodiacProfileStrings['en'];
    if (en && en[key]) return en[key];
    return key;
}

/**
 * Check if a language is RTL.
 *
 * @param {string} lang  Language code
 * @returns {boolean}
 */
export function ezhp_isRTL(lang) {
    if (!lang) return false;
    var rtlLangs = ['ar', 'he', 'fa', 'ur', 'ps', 'sd', 'yi', 'ku', 'dv', 'ug'];
    return rtlLangs.indexOf(lang.toLowerCase().split('-')[0]) !== -1;
}