예제 #1
0
 public static void LoadLanguage(string languageCode)
 {
     Editor.InitSystem(String.Format("Localisation ({0})", languageCode), () =>
     {
         BoxEd = LocaleDictionary.Load(Resources.Load("Editor") as TextAsset, languageCode);
         return(BoxEd != null);
     });
 }
예제 #2
0
        public static LocaleDictionary Load(string xmlString, string languageCode)
        {
            var dictionary = new LocaleDictionary();
            var document   = new XmlDocument();

            document.LoadXml(xmlString);

            foreach (var phrase in document.FirstChild.ChildNodes.OfType <XmlElement>().Where(phrase => phrase.HasAttribute(languageCode)))
            {
                dictionary.Add(phrase.GetAttribute("en"), phrase.GetAttribute(languageCode));
            }

            return(dictionary);
        }