Ejemplo n.º 1
0
        public MultilanguageResultCode Initialize(MulitlanguageXml languageXml)
        {
            if (languageXml.stringList == null)
            {
                return(MultilanguageResultCode.FILE_PARSING_ERROR);
            }

            foreach (var data in languageXml.stringList.list)
            {
                string key       = data.key;
                var    languages = data.language;

                foreach (var language in languages.list)
                {
                    string languageCode = language.LocalName;

                    StringDictionary languageStringMap;
                    if (languagePacks.TryGetValue(languageCode, out languageStringMap) == false)
                    {
                        languageStringMap = new StringDictionary();
                        languagePacks.Add(languageCode, languageStringMap);
                    }

                    string value = language.InnerText.Replace("\\n", "\n");
                    if (languageStringMap.ContainsKey(key) == true)
                    {
                        Debug.LogWarning(string.Format("Already have a string key. (key: {0}, language: {1})", key, languageCode));
                    }
                    else
                    {
                        languageStringMap.Add(key, value);
                    }
                }
            }

            return(InitializeLanguageCode(languageXml.defaultData));
        }
Ejemplo n.º 2
0
        private MultilanguageResultCode InitializeService(string serviceName, MultilanguageResultCode resultCode, MulitlanguageXml xmlData)
        {
            if (resultCode != MultilanguageResultCode.SUCCESS)
            {
                return(resultCode);
            }

            MultilanguageServiceData languageInfo = new MultilanguageServiceData();

            resultCode = languageInfo.Initialize(xmlData);
            if (resultCode == MultilanguageResultCode.SUCCESS)
            {
                services.Add(serviceName, languageInfo);
            }

            return(resultCode);
        }