/// <summary>
		/// Merges a <see cref="LocalizedStringList"/> with string list information for a language.
		/// </summary>
		/// <param name="stringList">The string list.</param>
		/// <param name="languageIndex">Index of the language.</param>
		/// <param name="startIndex">The index where strings in the list will start at.</param>
		/// <returns>The number of strings in the string list.</returns>
		private int MergeStringList(LocalizedStringList stringList, int languageIndex, int startIndex)
		{
			// TODO: Assert that the tag exists
			FourthGenMultilingualStringList group;
			_groupsByTag.TryGetValue(stringList.SourceTag, out group);
			if (group == null)
			{
				// Create a new string list
				// Assume there's going to be at least one group already and use that to get the number of languages...
				// TODO: Read this from build info or something
				var ranges = _groupsByTag.Values.First().Ranges.Select(r => new StringRange(0, 0)).ToArray();
				group = new FourthGenMultilingualStringList(stringList.SourceTag, ranges, _buildInfo);
				_groupsByTag[stringList.SourceTag] = group;
			}
			group.Ranges[languageIndex].StartIndex = startIndex;
			group.Ranges[languageIndex].Size = stringList.Strings.Count;
			return stringList.Strings.Count;
		}
示例#2
0
		private void FixUnicListReferences(DataBlock block, ITag tag, IWriter buffer, IStream stream)
		{
			foreach (DataBlockUnicListFixup fixup in block.UnicListFixups)
			{
				var pack = _languageCache.LoadLanguage((GameLanguage)fixup.LanguageIndex, stream);
				var stringList = new LocalizedStringList(tag);
				foreach (var str in fixup.Strings)
				{
					var id = InjectStringID(str.StringID);
					stringList.Strings.Add(new LocalizedString(id, str.String));
				}
				pack.AddStringList(stringList);
			}
		}
示例#3
0
 /// <summary>
 /// Adds a localized string list to the language pack.
 /// </summary>
 /// <param name="list">The list to add.</param>
 public void AddStringList(LocalizedStringList list)
 {
     _listsByTag[list.SourceTag] = list;
 }
示例#4
0
			public StringEntry(string stringId, string val, LocalizedStringList group, LocalizedString baseString)
			{
				_stringId = stringId;
				_val = val;
				Group = group;
				Base = baseString;
			}
示例#5
0
		private void cbLocaleGroups_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
		{
			var group = cbLocaleGroups.SelectedItem as NamedStringList;
			if (group != null)
			{
				_currentGroup = group.Base;
				_stringView.CurrentGroup = group.Base;
				_stringView.Refresh();
				lvLocales.CanUserAddRows = (group.Base != null);
				ShowCurrentItem();
			}
		}
示例#6
0
		/// <summary>
		///     Wraps the strings in a <see cref="LocalizedStringList" />.
		/// </summary>
		/// <param name="list">The list to wrap.</param>
		/// <returns>The wrapped strings.</returns>
		private IEnumerable<StringEntry> WrapStrings(LocalizedStringList list)
		{
			return list.Strings.Select(s =>
			{
				string stringIdName = _cache.StringIDs.GetString(s.Key) ?? s.Key.ToString();
				string adjustedStr = ReplaceSymbols(s.Value);
				var entry = new StringEntry(stringIdName, adjustedStr, list, s);
				return entry;
			});
		}
示例#7
0
		/// <summary>
		/// Adds a localized string list to the language pack.
		/// </summary>
		/// <param name="list">The list to add.</param>
		public void AddStringList(LocalizedStringList list)
		{
			_listsByTag[list.SourceTag] = list;
		}