/* テスト */
/*
 * File: lang-support.c
 * Purpose: Functions required for support of internationalization.
 *
 * Copyright (c) 2009 Paul Blay
 *
 * This work is free software; you can redistribute it and/or modify it
 * under the terms of either:
 *
 * a) the GNU General Public License as published by the Free Software
 *    Foundation, version 2, or
 *
 * b) the "Angband licence":
 *    This software may be copied and distributed for educational, research,
 *    and not for profit purposes provided that this copyright and statement
 *    are included in all such copies.  Other copyrights may also apply.
 */

/*****************************************************************************
 *   INTERNATIONALIZATION SUPPORT FUNCTIONS                                  *
 *****************************************************************************/
extern "C" 
{
#include "angband.h"
}

/*
 * Add no-break-spaces after Japanese characters to make them display with 
 * correct spacing.
 *
 * XXX XXX This is a horrible hack.
 */
_TCHAR *spaceme(_TCHAR *s2, const _TCHAR *s1)
{
	/* Fancy handling not needed for English */
	if(arg_language == LNG_ENGLISH)
	{
		_tcscpy_s(s2, _countof(s2), s1);
	}
	else /* LNG_JAPANESE */
	{
		int i, j = 0, len;
		len = _tcsclen(s1);
		for (i = 0; i < len; i++)
		{
			if (s1[i] > 12353) /* TODO Horrible, horrible hack */
			{
				s2[j++] = s1[i];
				s2[j++] = __T('\xa0');
			}
			else
				s2[j++] = s1[i];
		}
		s2[j++] = 0;
	}
	return s2;
}
