コード例 #1
0
/**
 * @brief Sort options by alphabet
 */
void UI_OptionNodeSortOptions (uiNode_t *node)
{
	uiNode_t *option;
	assert(UI_Node_IsOptionContainer(node));
	UI_SortOptions(&node->firstChild);

	/** update lastChild */
	/** @todo the sort option should do it itself */
	option = node->firstChild;
	while (option->next)
		option = option->next;
	node->lastChild = option;
}
コード例 #2
0
ファイル: cl_language.c プロジェクト: chrisglass/ufoai
/**
 * @brief Fills the options language menu node with the parsed language mappings
 * @sa CL_InitAfter
 * @sa CL_LocaleSet
 */
void CL_LanguageInit (void)
{
	int i;
	language_t* language;
	uiNode_t *languageOption = NULL;
	char systemLanguage[MAX_VAR];

	fs_i18ndir = Cvar_Get("fs_i18ndir", "", 0, "System path to language files");

	if (s_language->string[0] != '\0') {
		Com_Printf("CL_LanguageInit: language settings are stored in configuration: %s\n", s_language->string);
		Q_strncpyz(systemLanguage, s_language->string, sizeof(systemLanguage));
	} else {
		const char *currentLocale = Sys_GetLocale();

		if (currentLocale) {
			const char *localeID = CL_GetLocaleID(currentLocale);
			if (localeID)
				Q_strncpyz(systemLanguage, localeID, sizeof(systemLanguage));
			else
				systemLanguage[0] = '\0';
		} else
			systemLanguage[0] = '\0';
	}

	Com_DPrintf(DEBUG_CLIENT, "CL_LanguageInit: system language is: '%s'\n", systemLanguage);

	for (i = 0, language = languageList; i < languageCount; language = language->next, i++) {
#ifndef DEBUG
		/* No language option available only for DEBUG. */
		if (!CL_LanguageTest(language->localeID))
			continue;
#endif

		/* Test the locale first, add to list if setting given locale possible. */
		if (CL_LanguageTest(language->localeID) || Q_streq(language->localeID, "none")) {
			UI_AddOption(&languageOption, "", va("_%s", language->localeString), language->localeID);
		}
	}

	/* sort the list, and register it to the menu */
	UI_SortOptions(&languageOption);
	UI_RegisterOption(OPTION_LANGUAGES, languageOption);

	/* Set to the locale remembered previously. */
	CL_LanguageTryToSet(systemLanguage);
}
コード例 #3
0
ファイル: cl_language.cpp プロジェクト: Astrocoderguy/ufoai
/**
 * @brief Fills the options language menu node with the parsed language mappings
 * @sa CL_InitAfter
 * @sa CL_LocaleSet
 */
void CL_LanguageInit (void)
{
	int i;
	language_t* language;
	uiNode_t* languageOption = nullptr;
	char systemLanguage[MAX_VAR];

	fs_i18ndir = Cvar_Get("fs_i18ndir", "", 0, "System path to language files");

	if (s_language->string[0] != '\0') {
		Com_Printf("CL_LanguageInit: language settings are stored in configuration: %s\n", s_language->string);
		Q_strncpyz(systemLanguage, s_language->string, sizeof(systemLanguage));
	} else {
		const char* currentLocale = Sys_GetLocale();

		if (currentLocale) {
			const char* localeID = CL_GetLocaleID(currentLocale);
			if (localeID)
				Q_strncpyz(systemLanguage, localeID, sizeof(systemLanguage));
			else
				systemLanguage[0] = '\0';
		} else
			systemLanguage[0] = '\0';
	}

	Com_DPrintf(DEBUG_CLIENT, "CL_LanguageInit: system language is: '%s'\n", systemLanguage);

	for (i = 0, language = languageList; i < languageCount; language = language->next, i++) {
		bool available;
		available = Q_streq(language->localeID, "none") || CL_LanguageTest(language->localeID);
		uiNode_t* option;
#if 0
		option = UI_AddOption(&languageOption, "", language->localeString, language->localeID);
#else
		option = UI_AddOption(&languageOption, "", language->nativeString, language->localeID);
#endif
		option->disabled = !available;
	}

	/* sort the list, and register it to the menu */
	UI_SortOptions(&languageOption);
	UI_RegisterOption(OPTION_LANGUAGES, languageOption);

	/* Set to the locale remembered previously. */
	CL_LanguageTryToSet(systemLanguage);
}
コード例 #4
0
ファイル: cl_language.cpp プロジェクト: stavrossk/ufoai
void CL_LanguageInitMenu (void)
{
	uiNode_t* languageOption = nullptr;
	language_t* language = languageList;
	while (language) {
		const bool available = Q_streq(language->localeID, "none") || CL_LanguageTest(language->localeID);
		uiNode_t* option = UI_AddOption(&languageOption, "", language->nativeString, language->localeID);
		option->disabled = !available;
		language = language->next;
	}

	/* sort the list, and register it to the menu */
	UI_SortOptions(&languageOption);
	UI_RegisterOption(OPTION_LANGUAGES, languageOption);

	/* Set to the locale remembered previously. */
	CL_LanguageTryToSet(s_language->string);
}