Exemplo n.º 1
0
		private void GetXXLangsForICULocalePortion(IcuDataNode rootNode, LocalePortion portion, string localeKey, ref Hashtable xxFiles)
		{
			string customChild = LocalePortionAsString(portion);
			NodeSpecification node = new NodeSpecification("root", "Custom", customChild, localeKey);
			IcuDataNode dataNode = node.FindNode(rootNode, false);
			if (dataNode != null)
			{
				// get the list of xx.txt files to edit in this section
				foreach (IcuDataNode.IcuDataAttribute attr in dataNode.Attributes)
				{
					xxFileInfo xxFile;
					string xx = attr.StringValue;	// the lang code {ex: "en"}
					if (xxFiles.ContainsKey(xx))
					{
						xxFile = xxFiles[xx] as xxFileInfo;
					}
					else
					{
						xxFile = new xxFileInfo(xx);
						xxFiles[xx] = xxFile;
					}
					if (portion == LocalePortion.Variant)
					{
						xxFile.rmFromVariant = true;
						xxFile.xxVariantKey = localeKey;
					}
					else if (portion == LocalePortion.Lang)
					{
						xxFile.rmFromLang = true;
						xxFile.xxLangKey = localeKey;
					}
					else if (portion == LocalePortion.Script)
					{
						xxFile.rmFromScript = true;
						xxFile.xxScriptKey = localeKey;
					}
					else if (portion == LocalePortion.Country)
					{
						xxFile.rmFromCountry = true;
						xxFile.xxCountryKey = localeKey;
					}
				}
				// remove the key from the section of custom in root.txt
				if (!ICUDataFiles.RemoveICUDataFileChild(rootNode,
					new NodeSpecification("root", "Custom", customChild),
					localeKey))
				{
					LogFile.AddVerboseLine("***Unable to remove <"+localeKey+"> from the <"+customChild+"> section in the root.txt");
				}

			}
		}
Exemplo n.º 2
0
		private string LocalePortionAsString(LocalePortion portion)
		{
			string name = "";
			switch (portion)
			{
				case LocalePortion.Lang:
					name = "LanguagesAdded";
					break;
				case LocalePortion.Variant:
					name = "VariantsAdded";
					break;
				case LocalePortion.Country:
					name = "CountriesAdded";
					break;
				case LocalePortion.Script:
					name = "ScriptsAdded";
					break;
			}
			return name;
		}