/* kmtranslation.h
 *
 * Copyright (C) 2023 OpenKylin, Inc
 */

#ifndef __TRANSLATION_H__
#define __TRANSLATION_H__

#include <libintl.h>
#include <locale.h>
#include <string>

static inline void kmI18nInit(const char* domain, const char* path)
{
    bindtextdomain(domain, path);
    bind_textdomain_codeset (domain, "UTF-8");
    textdomain(domain);
}

static inline void kmI18nInit(const std::string& domain, const std::string& path)
{
    kmI18nInit(domain.c_str(), path.c_str());
}

#define _(str) gettext((str))

#endif // !__TRANSLATION_H__
