- Home /
Is it possible to download and overwrite a .resx file on mobile?
My game uses SmartLocalization, which uses .resx files as resources to keep the localization data. Would it be possible to write a script that checks online for an update to the .resx and saves it on the local device?
Answer by NiklasBorglund · Oct 26, 2015 at 08:22 PM
Yes it is possible. The following methods can help you in the LanguageManager found in SmartLocalization:
This method takes the language data sent in and tries to append it to the currently loaded language. LanguageManager.AppendLanguageWithTextData(string languageDataInResX)
This method tries to change the whole language with completely new data from the sent in .resx file. LanguageManager.ChangeLanguageWithTextData(string languageDataInResX, string languageCode)
Hope that helps. /Niklas
Hey I'm trying to do something similar, though I don't need to load it from the web - just from a local folder. I've checked that the path is correct but no matter which of the two functions I use, I get the same error:
Any ideas why / how to solve it?
XmlException: unexpected end of file. Current depth is 1 Line 2, position 98.
at $$anonymous$$ono.Xml2.XmlTextReader.ReadContent () [0x00000] in <filename unknown>:0
at $$anonymous$$ono.Xml2.XmlTextReader.Read () [0x00000] in <filename unknown>:0
at System.Xml.XmlTextReader.Read () [0x00000] in <filename unknown>:0
at SmartLocalization.LanguageParser.ReadElements (System.Xml.XmlReader reader, System.Collections.Generic.SortedDictionary`2 loadedLanguageDictionary) [0x00000] in <filename unknown>:0
at SmartLocalization.LanguageParser.LoadLanguage (System.String languageDataInResX) [0x00000] in <filename unknown>:0
at SmartLocalization.LanguageDataHandler.LoadLanguageDictionary (System.String resxData) [0x00000] in <filename unknown>:0
at SmartLocalization.LanguageDataHandler.Load (System.String resxData) [0x00000] in <filename unknown>:0
at SmartLocalization.Language$$anonymous$$anager.LoadLanguage (System.String languageData, System.String languageCode) [0x00000] in <filename unknown>:0
at SmartLocalization.Language$$anonymous$$anager.ChangeLanguageWithData (System.String languageDataInResX, System.String languageCode) [0x00000] in <filename unknown>:0
at Text$$anonymous$$anager.Initialize () [0x00023] in C:\Users\$$anonymous$$onstantinos\WorkInProgress\A Game of Coins\Unity Project\Assets\Scripts\Singletons\Text$$anonymous$$anager.cs:44
Well, as the error said you don't have a valid X$$anonymous$$L file:
XmlException: unexpected end of file
Have you edited the file manually? Are you sure you don't have any errors? Like an open element? $$anonymous$$aybe you wanted to create an empty element and forgot the "/" at the end?
X$$anonymous$$L parsers only accept 100% valid X$$anonymous$$L text, not like most browsers which interpret the HT$$anonymous$$L as good as possible.
Turns out it was due to the localization asset - its function expected xmldata and I misunderstood and provided it with path to an xml. So it tried parsing the path as if it were the content of an xml file -_-
Thanks for the quick reply - in a weird way it pointed me to the right direction!
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Reading level specific file in build (from another level) 0 Answers
Finding ScriptableObject file in GamePlay 3 Answers
Load files from resource 1 Answer