#pragma once

#include <QString>
#include <QMap>
#include <QMutex>
#include <QObject>

class Translator : public QObject
{
    Q_OBJECT
public:
    static Translator& instance();
    ~Translator() = default;

    // Load translation file for given language code (e.g., "en_US")
    bool loadLanguage(const QString& langCode);

    // Translate a key, returns translated string or key if not found
    QString tr(const QString& key) const;

    // Get current language code
    QString currentLanguage() const { return m_currentLang; }

private:
    Translator() = default;
    Q_DISABLE_COPY(Translator)

    QMap<QString, QString> m_translations;
    QString m_currentLang;
    mutable QMutex m_mutex;
};