//Sets version info property value
//property_name - property name
//value - property value
//If translation does not exist, it will be added
//If property does not exist, it will be added
void version_info_editor::set_property(const std::wstring& property_name, const std::wstring& value, const std::wstring& translation)
{
	lang_string_values_map::iterator it = strings_edit_.begin();

	if(translation.empty())
	{
		//If no translation was specified
		it = strings_edit_.find(default_language_translation); //Find default translation table
		if(it == strings_edit_.end()) //If there's no default translation table, take the first one
		{
			it = strings_edit_.begin();
			if(it == strings_edit_.end()) //If there's no any translation table, add default one
			{
				it = strings_edit_.insert(std::make_pair(default_language_translation, string_values_map())).first;
				//Also add it to translations list
				add_translation(default_language_translation);
			}
		}
	}
	else
	{
		it = strings_edit_.find(translation); //Find specified translation table
		if(it == strings_edit_.end()) //If there's no translation, add it
		{
			it = strings_edit_.insert(std::make_pair(translation, string_values_map())).first;
			//Also add it to translations list
			add_translation(translation);
		}
	}

	//Change value of the required property
	((*it).second)[property_name] = value;
}
Beispiel #2
0
static Retcode
modify_translations(Environ *e, Cell virt, Cell size, Int mode)
{
	Translation *t;
	int changed = 1;

	/* this is a really sucky algorithm but it works, we modify one */
	/* block per pass until no more blocks need to be modified */
	while (changed)
	{
		changed = 0;
	
		for (t = g_translations; t; t = t->next)
		{
			if (virt <= t->virt && t->virt < virt + size)
			{
				Cell s = (virt + size) - t->virt;
				Cell p;
				Cell v;

				if (s >= t->size)
				{
					t->mode = mode;
					continue;
				}

				v = t->virt;
				p = t->phys;
				remove_translation(e, v, s);
				add_translation(e, v, p, s, mode);
				changed = 1;
				break;
			}
			else if (t->virt < virt && virt < t->virt + t->size)
			{
				Cell s = (t->virt + t->size) - virt;
				Cell p;

				if (s > size)
					s = size;

				p = t->phys + (virt - t->virt);
				remove_translation(e, virt, s);
				add_translation(e, virt, p, s, mode);
				changed = 1;
				break;
			}
		}
	}

	return NO_ERROR;
}
void frame::extract_right_eyebrow_feat(point neutral_ctrd)
{
	float angle = atan( (r_eyebrow_landmks[5].y - r_eyebrow_landmks[8].y)/(r_eyebrow_landmks[5].x - r_eyebrow_landmks[8].x) );
	matrix_mult(angle, r_eyebrow_landmks);
	
	point translate;
	translate.x = neutral_ctrd.x - r_centroid.x;
	translate.y = neutral_ctrd.y - r_centroid.y;
	add_translation(translate, r_eyebrow_landmks);
	right_feats = get_feats(r_eyebrow_landmks);
}
Beispiel #4
0
void load_translations(void)
{
	FILE* translations_file1;
	FILE* translations_file2;
	translations_file1 = fopen(TRANSLATIONS_FILE1, "r");
	translations_file2 = fopen(TRANSLATIONS_FILE2, "r");
	g_bOutUntrans = false;
	g_bSubSection = false;
	if (translations_file1 && translations_file2) {
		char line1[LINE_BUFFER_SIZE];
		char line2[LINE_BUFFER_SIZE];
		int section = 0;
		while (fgets(line1, sizeof(line1), translations_file1)) {
			fgets(line2, sizeof(line2), translations_file2);
			//char* p;
			if (line1[0] == COMMENT_CHAR) {
				continue;
			} else if (line1[0] == SECTION_CHAR) {
				section = to_section(line1[1]);
				continue;
			} else if (line1[0] == PARAM_CHAR) {
				if(strncmp(line1, "$OutUntrans", 11)==0)
				{
					g_bOutUntrans = true;
				}
				if(strncmp(line1, "$OutSubsection", 14)==0)
				{
					g_bSubSection = true;
				}
//				if(strncmp(line, "$OutChat", 8)==0)
//				{
//					bOutChat = true;
//				}
				continue;
			}
//			p = strchr(line, DELIMITER);
//			if (!p) {
//				continue;
//			}
//			*p++ = 0;
			line1[strcspn(line1,"\r\n")] = 0;
			line2[strcspn(line2,"\r\n")] = 0;
			if (!add_translation(line1, line2, section)) {
				break;
			}
		}
		fclose(translations_file1);
		fclose(translations_file2);
	}
}
Beispiel #5
0
bool TranslationServer::_load_translations(const String& p_from) {

	if (Globals::get_singleton()->has(p_from)) {
		DVector<String> translations=Globals::get_singleton()->get(p_from);

		int tcount=translations.size();

		if (tcount) {
			DVector<String>::Read r = translations.read();

			for(int i=0;i<tcount;i++) {

				//print_line( "Loading translation from " + r[i] );
				Ref<Translation> tr = ResourceLoader::load(r[i]);
				if (tr.is_valid())
					add_translation(tr);
			}
		}
		return true;
	}

	return false;
}
//Adds translation to translation list
void version_info_editor::add_translation(const std::wstring& translation)
{
	std::pair<uint16_t, uint16_t> translation_ids(translation_from_string(translation));
	add_translation(translation_ids.first, translation_ids.second);
}
Beispiel #7
0
void init_keyword(const struct locale *lang, keyword_t kwd, const char *str) {
    void **tokens = get_translations(lang, UT_KEYWORDS);
    struct critbit_tree **cb = (critbit_tree **)tokens;
    add_translation(cb, str, (int)kwd);
}
Beispiel #8
0
void init_skill(const struct locale *lang, skill_t kwd, const char *str) {
    void **tokens = get_translations(lang, UT_SKILLS);
    struct critbit_tree **cb = (critbit_tree **)tokens;
    add_translation(cb, str, (int)kwd);
}
Beispiel #9
0
WordinfoC::WordinfoC(Wordinfo w):singlecount(w.singlecount){
	for(std::map<uint,uint>::iterator it = w.pairs.begin(); it!=w.pairs.end(); it++){
		add_translation(it->first,w.relFreq(it->first));
	}
}