/*
 * See the files COPYING and README for copyright information and how to reach
 * the author.
 *
 *  $Id: i18n.h,v 1.6 2006/05/16 17:00:19 lordjaxom Exp $
 */

#ifndef VDR_BURN_I18N_H
#define VDR_BURN_I18N_H

#include "common.h"
#include <vdr/i18n.h>

namespace vdr_burn
{

	// --- i18n ---------------------------------------------------------------

	// Implemented as a Meyers-Singleton
	class i18n
	{
	private:
		static const tI18nPhrase m_phrases[];

		int m_osdLanguage;

		const char *m_diskTypes[disk_type::count];
		const char *mStoreModes[sm_Count];
		const char *mChaptersModes[cm_Count];
		const char *m_diskSizes[disk_size::count];
		const char *m_demuxTypes[demux_type::count];

	protected:
		void prepare(void);

		template<unsigned int N>
		void prepare_strings(const char*(&target)[N], const char*(&source)[N]);

		static i18n& instance(void);

	public:
		i18n(void);

		static const tI18nPhrase* get_phrases(void) { return m_phrases; }

		static const char* const* get_disk_types(void);
		static const char* const* StoreModes(void) { instance().prepare(); return instance().mStoreModes; }
		static const char* const* ChaptersModes(void) { instance().prepare(); return instance().mChaptersModes;}
		static const char* const* get_disk_sizes(void);
		static const char* const* get_demux_types(void);
	};

	inline
	const char* const* i18n::get_disk_types(void)
	{
		instance().prepare();
		return instance().m_diskTypes;
	}

	inline
	const char* const* i18n::get_disk_sizes(void)
	{
		instance().prepare();
		return instance().m_diskSizes;
	}

	inline
	const char* const* i18n::get_demux_types(void)
	{
		instance().prepare();
		return instance().m_demuxTypes;
	}
	
	template<unsigned int N>
	void i18n::prepare_strings(const char*(&target)[N], const char*(&source)[N])
	{
		for (unsigned int i = 0; i < N; ++i)
			target[i] = tr(source[i]);
	}

}

#endif // VDR_BURN_I18N_H
