Exemplo n.º 1
0
/**
 * Try and try to decipher the current locale from environmental
 * variables. MacOSX is hardcoded, other OS's are dynamic. If no suitable
 * locale can be found, don't do any conversion ""
 */
static const char *GetLocalCode()
{
#if defined(__APPLE__)
	return "UTF-8-MAC";
#else
	/* Strip locale (eg en_US.UTF-8) to only have UTF-8 */
	const char *locale = GetCurrentLocale("LC_CTYPE");
	if (locale != NULL) locale = strchr(locale, '.');

	return (locale == NULL) ? "" : locale + 1;
#endif
}
bool LocalizationSystem::GetStringsForCurrentLocale(Map<WideString, WideString>& strings)
{
	for (List<StringFile*>::iterator iter = stringsList.begin(); iter != stringsList.end();
		 iter ++)
	{
		if ((*iter)->langId == GetCurrentLocale())
		{
			strings = (*iter)->strings;
			return true;
		}
	}
	
	// No strings found.
	return false;
}